diff --git a/CMMModel/CMMModel.csproj b/CMMModel/CMMModel.csproj
new file mode 100644
index 0000000..0cbd1f4
--- /dev/null
+++ b/CMMModel/CMMModel.csproj
@@ -0,0 +1,27 @@
+
+
+
+ net7.0-windows
+ CMM.Model
+ CMM.Model
+ ControlMyMonitorManagement
+ enable
+ enable
+ Dang
+ Copyright © DangWang $([System.DateTime]::Now.ToString(yyyy))
+
+
+
+ 1
+ 0
+ $([System.DateTime]::op_Subtraction($([System.DateTime]::get_Now().get_Date()),$([System.DateTime]::new(2017,9,17))).get_TotalDays())
+ $([System.DateTime]::Now.ToString(Hmm))
+ $([System.DateTime]::Now.ToString(yyyyMMdd))
+ $(Major).$(Minor).$(ProjectStartedDate).$(DaysSinceProjectStarted)
+ 0.0.0.1
+ $(VersionSuffix)
+ 0.0.0.1
+ $(DateTimeSuffix)
+
+
+
diff --git a/CMMModel/Model/SMonitorModel.cs b/CMMModel/Model/SMonitorModel.cs
new file mode 100644
index 0000000..e94e8db
--- /dev/null
+++ b/CMMModel/Model/SMonitorModel.cs
@@ -0,0 +1,17 @@
+using System.Text.Json.Serialization;
+
+public class SMonitorModel
+{
+ [JsonPropertyName("VCP Code")]
+ public string? VCPCode { get; set; }
+ [JsonPropertyName("VCP Code Name")]
+ public string? VCPCodeName { get; set; }
+ [JsonPropertyName("Read-Write")]
+ public string? ReadWrite { get; set; }
+ [JsonPropertyName("Current Value")]
+ public string? CurrentValue { get; set; }
+ [JsonPropertyName("Maximum Value")]
+ public string? MaximumValue { get; set; }
+ [JsonPropertyName("Possible Values")]
+ public string? PossibleValues { get; set; }
+}
\ No newline at end of file
diff --git a/CMMService/CMMService.csproj b/CMMService/CMMService.csproj
new file mode 100644
index 0000000..134eab8
--- /dev/null
+++ b/CMMService/CMMService.csproj
@@ -0,0 +1,32 @@
+
+
+
+ net7.0-windows
+ enable
+ CMM.Service
+ CMM.Service
+ ControlMyMonitorManagement
+ enable
+ Dang
+ Copyright © DangWang $([System.DateTime]::Now.ToString(yyyy))
+
+
+
+ 1
+ 0
+ $([System.DateTime]::op_Subtraction($([System.DateTime]::get_Now().get_Date()),$([System.DateTime]::new(2023,7,2))).get_TotalDays())
+ $([System.DateTime]::Now.ToString(Hmm))
+ $([System.DateTime]::Now.ToString(yyyyMMdd))
+ $(Major).$(Minor).$(ProjectStartedDate).$(DaysSinceProjectStarted)
+ 0.0.0.1
+ $(VersionSuffix)
+ 0.0.0.1
+ $(DateTimeSuffix)
+
+
+
+
+
+
+
+
diff --git a/ControlMyMonitorManagement.sln b/ControlMyMonitorManagement.sln
index dfd99ed..822f1a8 100644
--- a/ControlMyMonitorManagement.sln
+++ b/ControlMyMonitorManagement.sln
@@ -11,7 +11,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Language", "Language\Langua
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tester", "Tester\Tester.csproj", "{0D34DD73-3282-40EB-8F59-DF190944BF12}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DellMonitorControl", "DellMonitorControl\DellMonitorControl.csproj", "{64E96610-D431-40B9-A00B-55CE195B4B58}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DellMonitorControl", "DellMonitorControl\DellMonitorControl.csproj", "{64E96610-D431-40B9-A00B-55CE195B4B58}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMMService", "CMMService\CMMService.csproj", "{FEA2B019-32BC-4704-939F-1CD26F373F55}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMMModel", "CMMModel\CMMModel.csproj", "{88440737-DB6E-4ACA-B1BC-E40350153F96}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -39,6 +43,14 @@ Global
{64E96610-D431-40B9-A00B-55CE195B4B58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64E96610-D431-40B9-A00B-55CE195B4B58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64E96610-D431-40B9-A00B-55CE195B4B58}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FEA2B019-32BC-4704-939F-1CD26F373F55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FEA2B019-32BC-4704-939F-1CD26F373F55}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FEA2B019-32BC-4704-939F-1CD26F373F55}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FEA2B019-32BC-4704-939F-1CD26F373F55}.Release|Any CPU.Build.0 = Release|Any CPU
+ {88440737-DB6E-4ACA-B1BC-E40350153F96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {88440737-DB6E-4ACA-B1BC-E40350153F96}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {88440737-DB6E-4ACA-B1BC-E40350153F96}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {88440737-DB6E-4ACA-B1BC-E40350153F96}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ControlMyMonitorManagement/ControlMyMonitorManagement.csproj b/ControlMyMonitorManagement/ControlMyMonitorManagement.csproj
index 04191ea..3062287 100644
--- a/ControlMyMonitorManagement/ControlMyMonitorManagement.csproj
+++ b/ControlMyMonitorManagement/ControlMyMonitorManagement.csproj
@@ -2,7 +2,7 @@
WinExe
- net6.0-windows
+ net7.0-windows
CMM.Management
true
Copyright © DangWang $([System.DateTime]::Now.ToString(yyyy))
diff --git a/DellMonitorControl/ControlPanel.xaml b/DellMonitorControl/ControlPanel.xaml
index 9f5ac20..6f786ef 100644
--- a/DellMonitorControl/ControlPanel.xaml
+++ b/DellMonitorControl/ControlPanel.xaml
@@ -7,21 +7,8 @@
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
diff --git a/DellMonitorControl/ControlPanel.xaml.cs b/DellMonitorControl/ControlPanel.xaml.cs
index 413ff3e..9561357 100644
--- a/DellMonitorControl/ControlPanel.xaml.cs
+++ b/DellMonitorControl/ControlPanel.xaml.cs
@@ -1,7 +1,8 @@
using CMM.Library.Method;
+using CMM.Library.ViewModel;
+using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace DellMonitorControl;
@@ -16,25 +17,68 @@ public partial class ControlPanel : UserControl
InitializeComponent();
}
- private void Border_MouseLeave(object sender, MouseEventArgs e)
+ public async Task Init()
{
+ await CMMCommand.ScanMonitor();
+ var monitors = await CMMCommand.ReadMonitorsData();
+ foreach (var m in monitors)
+ {
+ var status = await CMMCommand.GetMonPowerStatus(m.SerialNumber);
+ var ctrl = CreatControl(m, status);
+
+ sp.Children.Add(ctrl);
+ }
}
- private async void ToggleButton_Checked(object sender, RoutedEventArgs e)
+ private StackPanel CreatControl(XMonitor monitorModel, string powerStatus)
{
- var toggle = sender as Button;
- var tag = toggle?.Tag.ToString();
- var content = toggle?.Content as string;
+ var _sp = new StackPanel();
+
+ _sp.Orientation = Orientation.Vertical;
+ _sp.Margin = new Thickness(10, 5, 5, 0);
+
+ var tb = new TextBlock
+ {
+ Text = monitorModel.MonitorName,
+ HorizontalAlignment = HorizontalAlignment.Left,
+ Style = (Style)FindResource("LableStyle")
+ };
+
+ var btn = new Button
+ {
+ Tag = monitorModel.SerialNumber,
+ Content = powerStatus,
+ Style = (Style)FindResource("TextButtonStyle")
+ };
+
+ btn.Click += async (s, e) => await ToggleButton_Checked(s, e);
+
+ _sp.Children.Add(tb);
+ _sp.Children.Add(btn);
+
+ return _sp;
+ }
+
+ private void Border_MouseLeave(object sender, MouseEventArgs e)
+ {
+
+ }
+
+ private async Task ToggleButton_Checked(object sender, RoutedEventArgs e)
+ {
+ var btn = sender as Button;
+ var tag = btn?.Tag.ToString();
+ var content = btn?.Content as string;
if (content == "Sleep")
{
- await CMMCommand.Sleep(tag);
- toggle!.Content = "PowerOn";
+ await CMMCommand.PowerOn(tag);
}
else
{
- await CMMCommand.PowerOn(tag);
- toggle!.Content = "Sleep";
+ await CMMCommand.Sleep(tag);
}
+ await Task.Delay(1000);
+ btn!.Content = await CMMCommand.GetMonPowerStatus(tag);
}
}
diff --git a/DellMonitorControl/DellMonitorControl.csproj b/DellMonitorControl/DellMonitorControl.csproj
index 525a830..ef6ecf3 100644
--- a/DellMonitorControl/DellMonitorControl.csproj
+++ b/DellMonitorControl/DellMonitorControl.csproj
@@ -2,12 +2,27 @@
WinExe
- net6.0-windows
+ net7.0-windows
enable
DellMonitorControl
DellMonitorControl
- DellMonitorControl
+ ControlMyMonitorManagement
true
+ Dang
+ Copyright © DangWang $([System.DateTime]::Now.ToString(yyyy))
+
+
+
+ 1
+ 0
+ $([System.DateTime]::op_Subtraction($([System.DateTime]::get_Now().get_Date()),$([System.DateTime]::new(2023,7,2))).get_TotalDays())
+ $([System.DateTime]::Now.ToString(Hmm))
+ $([System.DateTime]::Now.ToString(yyyyMMdd))
+ $(Major).$(Minor).$(ProjectStartedDate).$(DaysSinceProjectStarted)
+ 0.0.0.1
+ $(VersionSuffix)
+ 0.0.0.1
+ $(DateTimeSuffix)
@@ -20,6 +35,12 @@
+
+
+
+
+
+
diff --git a/DellMonitorControl/MainWindow.xaml b/DellMonitorControl/MainWindow.xaml
index 8c4b6ec..1a8bf2b 100644
--- a/DellMonitorControl/MainWindow.xaml
+++ b/DellMonitorControl/MainWindow.xaml
@@ -6,15 +6,16 @@
xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification.Net6"
xmlns:local="clr-namespace:DellMonitorControl"
mc:Ignorable="d"
+ Loaded="Window_Loaded"
Title="MainWindow" Height="450" Width="800">
-
+
diff --git a/DellMonitorControl/MainWindow.xaml.cs b/DellMonitorControl/MainWindow.xaml.cs
index b9034fb..382f3ff 100644
--- a/DellMonitorControl/MainWindow.xaml.cs
+++ b/DellMonitorControl/MainWindow.xaml.cs
@@ -10,6 +10,11 @@ public partial class MainWindow : Window
public MainWindow()
{
InitializeComponent();
+ }
+
+ private async void Window_Loaded(object sender, RoutedEventArgs e)
+ {
this.Hide();
+ await comtrolPanel.Init();
}
}
diff --git a/DellMonitorControl/Style/Btn.xaml b/DellMonitorControl/Style/Btn.xaml
index bc42bc8..fe385a4 100644
--- a/DellMonitorControl/Style/Btn.xaml
+++ b/DellMonitorControl/Style/Btn.xaml
@@ -15,7 +15,6 @@
-