我正试图在互联网上找到一些相机相关教程。问题是,大多数教程都是用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