新增DELL 螢幕控制開關
This commit is contained in:
40
DellMonitorControl/ControlPanel.xaml.cs
Normal file
40
DellMonitorControl/ControlPanel.xaml.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using CMM.Library.Method;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace DellMonitorControl;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for ControlPanel.xaml
|
||||
/// </summary>
|
||||
public partial class ControlPanel : UserControl
|
||||
{
|
||||
public ControlPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Border_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async void ToggleButton_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var toggle = sender as Button;
|
||||
var tag = toggle?.Tag.ToString();
|
||||
var content = toggle?.Content as string;
|
||||
if (content == "Sleep")
|
||||
{
|
||||
await CMMCommand.Sleep(tag);
|
||||
toggle!.Content = "PowerOn";
|
||||
}
|
||||
else
|
||||
{
|
||||
await CMMCommand.PowerOn(tag);
|
||||
toggle!.Content = "Sleep";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user