如何制作适用于windows phone(Visual Studio)的led手电筒/手电筒应用程序
本文关键字:手电筒 led Studio 应用程序 Visual 适用于 何制作 windows phone | 更新日期: 2023-09-27 18:28:19
嗨,我想制作一个经常使用相机LED的应用程序。我已经看到了一些这样做的例子,但我无法让它们在VB中工作,因为我需要它们。我对C#代码持开放态度,我将自己转换这些代码。我还知道你需要windows.phone.media.extended.dll程序集。我已经成功地转储了模拟器映像,但我不确定程序集是否能工作。如何使用反射?
如何将以下代码转换为vb?
private void VideoCamera_Initialized(object sender, object eventArgs)
{
if (Initialized != null)
{
Initialized.Invoke(this, new EventArgs());
}
}
public bool LampEnabled
{
get { return (bool)_videoCameraLampEnabledPropertyInfo.GetGetMethod().Invoke(_videoCamera, new object[0]); }
set { _videoCameraLampEnabledPropertyInfo.GetSetMethod().Invoke(_videoCamera, new object[] { value }); }
}
这是您粘贴的转换为VB的代码,不确定它是100%正确的
Private Sub VideoCamera_Initialized(sender As Object, eventArgs As Object)
If Initialized IsNot Nothing Then
Initialized.Invoke(Me, New EventArgs())
End If
End Sub
Public Property LampEnabled() As Boolean
Get
Return CBool(_videoCameraLampEnabledPropertyInfo.GetGetMethod().Invoke(_videoCamera, New Object(-1) {}))
End Get
Set
_videoCameraLampEnabledPropertyInfo.GetSetMethod().Invoke(_videoCamera, New Object() {value})
End Set
End Property
这是我从一个样本中得到的一些代码,并将其转换为
Dim cam As VideoCamera = Nothing
cam = New VideoCamera()
cam.Initialized += Function(s,e)
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()
cam.StartRecording()
vCam是在xaml中定义的,不确定您是否需要它。