我有下面的Windows Phone 7应用程序的示例代码,我试图将它转换为VB.Net作为起点。这样的分配:如何从C#中的匿名事件处理程序转换为VB.Net
Loaded += (_, __) => { anonymousMethodBody();}
是失败当我使用C#-to-VB转换工具转换。这些应该如何翻译?
public MainPage()
{
InitializeComponent();
Loaded += (_, __) =>
{
PhoneApplicationService.Current.ApplicationIdleDetectionMode = 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();
};
}
你得到哪些错误? – 2012-04-16 16:43:42
有关类似于+ =(___,____)=> – Matt9Atkins 2012-04-16 16:45:40
的方法的错误您的lambda命名约定会使我的眼睛流血。 – abatishchev 2012-04-16 17:04:49