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 @@ + + + + + + + + + + + +