WP7中可以打開相機的閃光燈嗎?打開WP7中的相機閃光燈
2
A
回答
13
這現在可以在Windows Phone OS 7.1 SDK中使用。
這裏的鏈接到MSDN文章:Access Camera API on WP7
PhotoCamera cam = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
cam.FlashMode = FlashMode.On;
2
這不能在當前的SDK中以編程方式完成。
用戶在手機上獨佔控制此功能。
1
嗨藉此鏈路上的樣子。 我想幫助你的問題
http://msdn.microsoft.com/en-us/library/hh202949%28v=vs.92%29.aspx
0
1)在主頁XAML文件MainPage.xaml中,添加以下代碼中的StackPanel元素,名爲ShutterButton按鈕元素下面。此代碼是相機閃光燈的按鈕。
<Button Name="FlashButton" Content="Fl:TBD" Click="changeFlash_Clicked" FontSize="26" FontWeight="ExtraBold" Height="75"/>
2)打開代碼隱藏文件的主網頁,MainPage.xaml.cs中,並添加MainPage類構造函數上面的以下變量聲明:
//保存當前閃光模式。
private string currentFlashMode;
3)在MainPage.xaml.cs中,將下面的代碼添加到OnNavigatedTo方法中,在Disable UI註釋的下方。
FlashButton.IsEnabled = false;
4)在MainPage.xaml.cs中,下面的代碼添加到cam_Initialized方法,只是txtDebug聲明如下:
//設置閃光燈按鈕上的文字。
FlashButton.Content = "Fl:" + cam.FlashMode.ToString();
此代碼顯示FlashButton按鈕上的當前Flash模式。
5)在MainPage.xaml.cs中,將以下代碼添加到MainPage類。此代碼通過每次按下按鈕時切換到不同的閃光模式來實現changeFlash_Clicked的事件處理程序。
// Activate a flash mode.
// Cycle through flash mode options when the flash button is pressed.
private void changeFlash_Clicked(object sender, RoutedEventArgs e)
{
switch (cam.FlashMode)
{
case FlashMode.Off:
if (cam.IsFlashModeSupported(FlashMode.On))
{
// Specify that flash should be used.
cam.FlashMode = FlashMode.On;
FlashButton.Content = "Fl:On";
currentFlashMode = "Flash mode: On";
}
break;
case FlashMode.On:
if (cam.IsFlashModeSupported(FlashMode.RedEyeReduction))
{
// Specify that the red-eye reduction flash should be used.
cam.FlashMode = FlashMode.RedEyeReduction;
FlashButton.Content = "Fl:RER";
currentFlashMode = "Flash mode: RedEyeReduction";
}
else if (cam.IsFlashModeSupported(FlashMode.Auto))
{
// If red-eye reduction is not supported, specify automatic mode.
cam.FlashMode = FlashMode.Auto;
FlashButton.Content = "Fl:Auto";
currentFlashMode = "Flash mode: Auto";
}
else
{
// If automatic is not supported, specify that no flash should be used.
cam.FlashMode = FlashMode.Off;
FlashButton.Content = "Fl:Off";
currentFlashMode = "Flash mode: Off";
}
break;
case FlashMode.RedEyeReduction:
if (cam.IsFlashModeSupported(FlashMode.Auto))
{
// Specify that the flash should be used in the automatic mode.
cam.FlashMode = FlashMode.Auto;
FlashButton.Content = "Fl:Auto";
currentFlashMode = "Flash mode: Auto";
}
else
{
// If automatic is not supported, specify that no flash should be used.
cam.FlashMode = FlashMode.Off;
FlashButton.Content = "Fl:Off";
currentFlashMode = "Flash mode: Off";
}
break;
case FlashMode.Auto:
if (cam.IsFlashModeSupported(FlashMode.Off))
{
// Specify that no flash should be used.
cam.FlashMode = FlashMode.Off;
FlashButton.Content = "Fl:Off";
currentFlashMode = "Flash mode: Off";
}
break;
}
// Display current flash mode.
this.Dispatcher.BeginInvoke(delegate()
{
txtDebug.Text = currentFlashMode;
});
}
相關問題
- 1. 永久打開WP7閃光燈
- 2. iPhone 4 - 相機閃光燈
- 3. 從動作腳本中打開閃光燈相機設置
- 4. 在通話過程中無法打開相機閃光燈
- 5. 如何在服務中打開和關閉閃光燈相機
- 6. 打開/關閉閃光燈
- 7. 閃光燈未打開
- 8. 在Android中打開相機閃光LED?
- 9. iOS:打開相機時如何設置相機閃光燈爲開?
- 10. 如何打開/關閉Swift 2 iPhone相機閃光燈?
- 11. 如何用閃光燈模式打開相機
- 12. Android相機閃光燈在關閉後沒有打開
- 13. 如何檢查相機閃光燈是打開還是關閉?
- 14. 用SL4A打開/關閉相機閃光燈蟒蛇Python
- 15. 如何在相機閃光燈開啓與commonsware相機庫
- 16. Trigger.io:在相機中禁用閃光燈
- 17. 機器人和相機閃光燈
- 18. Windows 10手機應用程序打開閃光燈(燈)
- 19. Android的 - 使用相機閃光燈
- 20. 在Android中同時打開不支持閃光燈的手電筒和相機
- 21. Android相機閃光燈控制
- 22. 安卓相機閃光燈不工作
- 23. 相機閃光燈不能從uiimageviewcontroller IOS
- 24. 控制相機閃光燈iPhone
- 25. 相機閃光燈不工作
- 26. Android切換相機閃光燈
- 27. Android相機閃光燈預覽
- 28. 問題與相機閃光燈iphone
- 29. 像原生相機應用那樣執行閃光燈(燈光)
- 30. Windows Phone在後臺打開閃光燈
儘管像HTC原始設備製造商能夠爲他們被允許在手機更多的訪問要做到這一點,他們的手電筒應用程序使用這種能力,其他人不能(雖然這將是很好)。 – RoguePlanetoid 2010-11-25 13:03:25