From f0b02be1a5c1fdcf717ff2e674c9abc8e8cebeca Mon Sep 17 00:00:00 2001 From: DangHome Date: Mon, 23 May 2022 00:58:58 +0800 Subject: [PATCH] Add project files. --- ControlMyMonitorManagement.sln | 43 ++ ControlMyMonitorManagement/App.xaml | 20 + ControlMyMonitorManagement/App.xaml.cs | 34 ++ ControlMyMonitorManagement/AssemblyInfo.cs | 10 + .../Control/Loading.xaml | 137 ++++++ .../Control/Loading.xaml.cs | 28 ++ ControlMyMonitorManagement/Control/MonCtrl.cs | 55 +++ .../Control/MonitorsControl.cs | 61 +++ .../ControlMyMonitorManagement.csproj | 66 +++ ControlMyMonitorManagement/Images/icons.xaml | 64 +++ ControlMyMonitorManagement/MainWindow.xaml | 38 ++ ControlMyMonitorManagement/MainWindow.xaml.cs | 87 ++++ ControlMyMonitorManagement/Style/Btn.xaml | 59 +++ ControlMyMonitorManagement/Style/Color.xaml | 39 ++ ControlMyMonitorManagement/Style/Main.xaml | 4 + .../Style/MonCtrlStyle.xaml | 18 + .../Style/MonitorsControlStyle.xaml | 17 + ControlMyMonitorManagement/Style/Slider.xaml | 278 +++++++++++++ Display/Display.csproj | 32 ++ Display/Images/icons.xaml | 71 ++++ Display/Style/Btn.xaml | 59 +++ Display/Style/Color.xaml | 39 ++ Display/Style/Main.xaml | 4 + Display/Style/Slider.xaml | 278 +++++++++++++ Language/CulturesHelper.cs | 115 +++++ Language/Language.csproj | 35 ++ Language/StringResources.en-US.xaml | 5 + Language/StringResources.xaml | 5 + Language/StringResources.zh-TW.xam | 5 + Library/Base/ObservableRangeCollection.cs | 70 ++++ Library/Base/PropertyBase.cs | 31 ++ Library/Config/Config.cs | 76 ++++ Library/Extensions/MonitorExtension.cs | 13 + Library/Helpers/ConsoleHelper.cs | 71 ++++ Library/Helpers/FileHelper.cs | 29 ++ Library/Helpers/JsonHelper.cs | 131 ++++++ Library/Helpers/UAC.cs | 18 + Library/Library.csproj | 40 ++ Library/Method/AssemblyData.cs | 48 +++ Library/Method/CMMCommand.cs | 177 ++++++++ Library/Method/CMMMgr.cs | 29 ++ Library/Resource/ControlMyMonitor.chm | Bin 0 -> 19116 bytes Library/Resource/ControlMyMonitor.exe | Bin 0 -> 117112 bytes Library/Resource/readme.txt | 393 ++++++++++++++++++ Library/ViewModel/XMonitor.cs | 72 ++++ Library/ViewModel/XMonitorStatus.cs | 54 +++ Library/WinAPI/Blur.cs | 44 ++ Library/WinAPI/Win32Api.cs | 50 +++ Tester/Tester.csproj | 21 + Tester/UnitTest1.cs | 16 + Tester/Usings.cs | 1 + 51 files changed, 3090 insertions(+) create mode 100644 ControlMyMonitorManagement.sln create mode 100644 ControlMyMonitorManagement/App.xaml create mode 100644 ControlMyMonitorManagement/App.xaml.cs create mode 100644 ControlMyMonitorManagement/AssemblyInfo.cs create mode 100644 ControlMyMonitorManagement/Control/Loading.xaml create mode 100644 ControlMyMonitorManagement/Control/Loading.xaml.cs create mode 100644 ControlMyMonitorManagement/Control/MonCtrl.cs create mode 100644 ControlMyMonitorManagement/Control/MonitorsControl.cs create mode 100644 ControlMyMonitorManagement/ControlMyMonitorManagement.csproj create mode 100644 ControlMyMonitorManagement/Images/icons.xaml create mode 100644 ControlMyMonitorManagement/MainWindow.xaml create mode 100644 ControlMyMonitorManagement/MainWindow.xaml.cs create mode 100644 ControlMyMonitorManagement/Style/Btn.xaml create mode 100644 ControlMyMonitorManagement/Style/Color.xaml create mode 100644 ControlMyMonitorManagement/Style/Main.xaml create mode 100644 ControlMyMonitorManagement/Style/MonCtrlStyle.xaml create mode 100644 ControlMyMonitorManagement/Style/MonitorsControlStyle.xaml create mode 100644 ControlMyMonitorManagement/Style/Slider.xaml create mode 100644 Display/Display.csproj create mode 100644 Display/Images/icons.xaml create mode 100644 Display/Style/Btn.xaml create mode 100644 Display/Style/Color.xaml create mode 100644 Display/Style/Main.xaml create mode 100644 Display/Style/Slider.xaml create mode 100644 Language/CulturesHelper.cs create mode 100644 Language/Language.csproj create mode 100644 Language/StringResources.en-US.xaml create mode 100644 Language/StringResources.xaml create mode 100644 Language/StringResources.zh-TW.xam create mode 100644 Library/Base/ObservableRangeCollection.cs create mode 100644 Library/Base/PropertyBase.cs create mode 100644 Library/Config/Config.cs create mode 100644 Library/Extensions/MonitorExtension.cs create mode 100644 Library/Helpers/ConsoleHelper.cs create mode 100644 Library/Helpers/FileHelper.cs create mode 100644 Library/Helpers/JsonHelper.cs create mode 100644 Library/Helpers/UAC.cs create mode 100644 Library/Library.csproj create mode 100644 Library/Method/AssemblyData.cs create mode 100644 Library/Method/CMMCommand.cs create mode 100644 Library/Method/CMMMgr.cs create mode 100644 Library/Resource/ControlMyMonitor.chm create mode 100644 Library/Resource/ControlMyMonitor.exe create mode 100644 Library/Resource/readme.txt create mode 100644 Library/ViewModel/XMonitor.cs create mode 100644 Library/ViewModel/XMonitorStatus.cs create mode 100644 Library/WinAPI/Blur.cs create mode 100644 Library/WinAPI/Win32Api.cs create mode 100644 Tester/Tester.csproj create mode 100644 Tester/UnitTest1.cs create mode 100644 Tester/Usings.cs diff --git a/ControlMyMonitorManagement.sln b/ControlMyMonitorManagement.sln new file mode 100644 index 0000000..918ed15 --- /dev/null +++ b/ControlMyMonitorManagement.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32505.426 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlMyMonitorManagement", "ControlMyMonitorManagement\ControlMyMonitorManagement.csproj", "{DBD5D7D8-9261-40F2-AA31-20DC2E6D2176}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library", "Library\Library.csproj", "{1281FEF8-86AF-4479-A58A-05E0F212FECC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Language", "Language\Language.csproj", "{AAED30CF-DEB6-4D06-B24C-C9B5E2113B88}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tester", "Tester\Tester.csproj", "{0D34DD73-3282-40EB-8F59-DF190944BF12}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DBD5D7D8-9261-40F2-AA31-20DC2E6D2176}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DBD5D7D8-9261-40F2-AA31-20DC2E6D2176}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DBD5D7D8-9261-40F2-AA31-20DC2E6D2176}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DBD5D7D8-9261-40F2-AA31-20DC2E6D2176}.Release|Any CPU.Build.0 = Release|Any CPU + {1281FEF8-86AF-4479-A58A-05E0F212FECC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1281FEF8-86AF-4479-A58A-05E0F212FECC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1281FEF8-86AF-4479-A58A-05E0F212FECC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1281FEF8-86AF-4479-A58A-05E0F212FECC}.Release|Any CPU.Build.0 = Release|Any CPU + {AAED30CF-DEB6-4D06-B24C-C9B5E2113B88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AAED30CF-DEB6-4D06-B24C-C9B5E2113B88}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AAED30CF-DEB6-4D06-B24C-C9B5E2113B88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AAED30CF-DEB6-4D06-B24C-C9B5E2113B88}.Release|Any CPU.Build.0 = Release|Any CPU + {0D34DD73-3282-40EB-8F59-DF190944BF12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D34DD73-3282-40EB-8F59-DF190944BF12}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D34DD73-3282-40EB-8F59-DF190944BF12}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D34DD73-3282-40EB-8F59-DF190944BF12}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {88781872-23CA-43AF-ABEA-F36438B6CB58} + EndGlobalSection +EndGlobal diff --git a/ControlMyMonitorManagement/App.xaml b/ControlMyMonitorManagement/App.xaml new file mode 100644 index 0000000..dc96db3 --- /dev/null +++ b/ControlMyMonitorManagement/App.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + diff --git a/ControlMyMonitorManagement/App.xaml.cs b/ControlMyMonitorManagement/App.xaml.cs new file mode 100644 index 0000000..bf7a075 --- /dev/null +++ b/ControlMyMonitorManagement/App.xaml.cs @@ -0,0 +1,34 @@ +using CMM.Library.Config; +using CMM.Library.Method; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace CMM.Management +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + internal static XConfig cfg { get; private set; } + internal static CMMMgr CMMMgr { get; private set; } + + public App() + { + //cfg = new(); + //cfg.Load(); + CMMMgr = new CMMMgr(); + Startup += async (s, e) => await App_Startup(s, e); + } + + private async Task App_Startup(object sender, StartupEventArgs e) + { + await CMMMgr.Init(); + } + } +} diff --git a/ControlMyMonitorManagement/AssemblyInfo.cs b/ControlMyMonitorManagement/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/ControlMyMonitorManagement/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/ControlMyMonitorManagement/Control/Loading.xaml b/ControlMyMonitorManagement/Control/Loading.xaml new file mode 100644 index 0000000..d79f66e --- /dev/null +++ b/ControlMyMonitorManagement/Control/Loading.xaml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ControlMyMonitorManagement/Control/Loading.xaml.cs b/ControlMyMonitorManagement/Control/Loading.xaml.cs new file mode 100644 index 0000000..fd970e5 --- /dev/null +++ b/ControlMyMonitorManagement/Control/Loading.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace CMM.Management.Control +{ + /// + /// Interaction logic for Loading.xaml + /// + public partial class Loading : UserControl + { + public Loading() + { + InitializeComponent(); + } + } +} diff --git a/ControlMyMonitorManagement/Control/MonCtrl.cs b/ControlMyMonitorManagement/Control/MonCtrl.cs new file mode 100644 index 0000000..d0b85c9 --- /dev/null +++ b/ControlMyMonitorManagement/Control/MonCtrl.cs @@ -0,0 +1,55 @@ +using System.Windows.Controls; +using System.Windows; +using CMM.Library.ViewModel; +using CMM.Library.Base; +using CMM.Library.Method; +using System.Windows.Data; +using System; + +namespace CMM.Management.Control +{ + /// + /// 單一顆螢幕 + /// + internal class MonCtrl : System.Windows.Controls.Control + { + public readonly static DependencyProperty MonProperty; + private StackPanel _sp; + + static MonCtrl() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(MonCtrl), new FrameworkPropertyMetadata(typeof(MonCtrl))); + + MonProperty = DependencyProperty.Register( + "Monitor", + typeof(XMonitor), + typeof(MonCtrl), + new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnMonChangedCallback)); + } + + public override void OnApplyTemplate() + { + _sp = Template.FindName("sp", this) as StackPanel; + } + + public XMonitor Mon + { + get => (XMonitor)GetValue(MonProperty); + set => SetValue(MonProperty, value); + } + + static void OnMonChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs args) + { + var me = sender as MonCtrl; + if (me != null) + { + me.OnMonChanged((XMonitor)args.NewValue); + } + } + + public virtual void OnMonChanged(XMonitor value) + { + + } + } +} diff --git a/ControlMyMonitorManagement/Control/MonitorsControl.cs b/ControlMyMonitorManagement/Control/MonitorsControl.cs new file mode 100644 index 0000000..0c21a87 --- /dev/null +++ b/ControlMyMonitorManagement/Control/MonitorsControl.cs @@ -0,0 +1,61 @@ +using System.Windows.Controls; +using System.Windows; +using CMM.Library.ViewModel; +using CMM.Library.Base; +using CMM.Library.Method; +using System.Windows.Data; +using System; + +namespace CMM.Management.Control +{ + /// + /// 全部螢幕 + /// + internal class MonitorsControl : System.Windows.Controls.Control + { + public readonly static DependencyProperty MonitorsProperty; + private StackPanel _sp; + + static MonitorsControl() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(MonitorsControl), new FrameworkPropertyMetadata(typeof(MonitorsControl))); + + MonitorsProperty = DependencyProperty.Register( + "Monitors", + typeof(ObservableRangeCollection), + typeof(MonitorsControl), + new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnMonitorsChangedCallback)); + } + + public override void OnApplyTemplate() + { + _sp = Template.FindName("sp", this) as StackPanel; + } + + public ObservableRangeCollection Monitors + { + get => (ObservableRangeCollection)GetValue(MonitorsProperty); + set => SetValue(MonitorsProperty, value); + } + + static void OnMonitorsChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs args) + { + var me = sender as MonitorsControl; + if (me != null) + { + me.OnMonitorsChanged((ObservableRangeCollection)args.NewValue); + } + } + + public virtual void OnMonitorsChanged(ObservableRangeCollection value) + { + foreach (var mon in value) + { + var monCtrl = new MonCtrl(); + monCtrl.Mon = mon; + + _sp.Children.Add(monCtrl); + } + } + } +} diff --git a/ControlMyMonitorManagement/ControlMyMonitorManagement.csproj b/ControlMyMonitorManagement/ControlMyMonitorManagement.csproj new file mode 100644 index 0000000..04191ea --- /dev/null +++ b/ControlMyMonitorManagement/ControlMyMonitorManagement.csproj @@ -0,0 +1,66 @@ + + + + WinExe + net6.0-windows + CMM.Management + true + Copyright © DangWang $([System.DateTime]::Now.ToString(yyyy)) + Dang + ControlMyMonitorManagement + + + + + + + + + + + + + + + + + + + + + + $(DefaultXamlRuntime) + Designer + + + $(DefaultXamlRuntime) + Designer + + + $(DefaultXamlRuntime) + Designer + + + $(DefaultXamlRuntime) + Designer + + + $(DefaultXamlRuntime) + Designer + + + + + 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/ControlMyMonitorManagement/Images/icons.xaml b/ControlMyMonitorManagement/Images/icons.xaml new file mode 100644 index 0000000..4e978a5 --- /dev/null +++ b/ControlMyMonitorManagement/Images/icons.xaml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ControlMyMonitorManagement/MainWindow.xaml b/ControlMyMonitorManagement/MainWindow.xaml new file mode 100644 index 0000000..bb1e9d4 --- /dev/null +++ b/ControlMyMonitorManagement/MainWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + +