我正試圖在互聯網上找到一些相機相關教程。問題是,大多數教程都是用C#完成的,而我需要它在VB.NET。我曾嘗試使用在線轉換器轉換它,但它並不總是識別所有的語法,因此我得到錯誤。如何將其轉換爲Visual Basic?如何將此方法從C#轉換爲VB.NET
Loaded += (_, __) =>
{
Microsoft.Phone.Shell.PhoneApplicationService.Current.ApplicationIdleDetectionMode =
Microsoft.Phone.Shell.IdleDetectionMode.Disabled;
cam = new VideoCamera();
cam.Initialized += (___, ____) =>
{
cam.LampEnabled = true;
cam.StartRecording();
};
vCam.SetSource(cam);
new Thread(() =>
{
try
{
var isf = IsolatedStorageFile.GetUserStoreForApplication();
var files = isf.GetFileNames();
foreach (var file in files)
{
Debug.WriteLine("Deleting... " + file);
isf.DeleteFile(file);
}
}
catch (Exception ex)
{
Debug.WriteLine("Error cleaning up isolated storage: " + ex);
}
}).Start();
};
這是我從轉換器得到的代碼:
Loaded += Function(_, __)
Microsoft.Phone.Shell.PhoneApplicationService.Current.ApplicationIdleDetectionMode = _
Microsoft.Phone.Shell.IdleDetectionMode.Disabled
cam = New VideoCamera()
cam.Initialized += Function(___, ____)
cam.LampEnabled = True
cam.StartRecording()
End Function
vCam.SetSource(cam)
New Thread(Function()
Try
Dim isf = IsolatedStorageFile.GetUserStoreForApplication()
Dim files = isf.GetFileNames()
For Each file As var In files
Debug.WriteLine("Deleting... " & Convert.ToString(file))
isf.DeleteFile(file)
Next
Catch ex As Exception
Debug.WriteLine("Error cleaning up isolated storage: " & ex)
End Try
End Function).Start()
End Function
我使用了一個轉換器,它的字面意思是給我錯誤無處不在 – Matt9Atkins 2012-03-20 00:31:05
我建議發佈轉換器做了什麼,所以人們可以幫助縮小錯誤。 – 2012-03-20 00:31:58
我在轉換器代碼中添加了 – Matt9Atkins 2012-03-20 00:34:10