From 46f4b13150e40ee902157ce69c6e0ce6106f5b69 Mon Sep 17 00:00:00 2001
From: Taiizor <41683699+Taiizor@users.noreply.github.com>
Date: Tue, 3 Oct 2023 01:39:06 +0300
Subject: [PATCH] Preparing Display Preferences Dialog
---
src/Portal/Sucrose.Portal/Manage/Manager.cs | 6 +-
.../Sucrose.Portal/Sucrose.Portal.csproj | 9 +
.../ViewModels/Windows/MainWindowViewModel.cs | 2 +-
.../Views/Controls/Display/Duplicate.xaml | 15 ++
.../Views/Controls/Display/Duplicate.xaml.cs | 15 ++
.../Views/Controls/Display/Expand.xaml | 15 ++
.../Views/Controls/Display/Expand.xaml.cs | 15 ++
.../Views/Controls/Display/Screen.xaml | 2 +-
.../Views/Controls/DisplayPreferences.xaml | 30 ++-
.../Views/Controls/DisplayPreferences.xaml.cs | 218 ++++++++++++++++--
.../Views/Controls/ExpanderCard.xaml | 4 -
.../Views/Controls/ExpanderCard.xaml.cs | 15 --
12 files changed, 290 insertions(+), 56 deletions(-)
create mode 100644 src/Portal/Sucrose.Portal/Views/Controls/Display/Duplicate.xaml
create mode 100644 src/Portal/Sucrose.Portal/Views/Controls/Display/Duplicate.xaml.cs
create mode 100644 src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml
create mode 100644 src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml.cs
diff --git a/src/Portal/Sucrose.Portal/Manage/Manager.cs b/src/Portal/Sucrose.Portal/Manage/Manager.cs
index e56c12bcc..51d7e8337 100644
--- a/src/Portal/Sucrose.Portal/Manage/Manager.cs
+++ b/src/Portal/Sucrose.Portal/Manage/Manager.cs
@@ -1,18 +1,18 @@
using System.Net;
using System.Windows.Media;
using Wpf.Ui.Controls;
+using SEDST = Skylark.Enum.DuplicateScreenType;
+using SEEST = Skylark.Enum.ExpandScreenType;
using SEST = Skylark.Enum.ScreenType;
using SEWTT = Skylark.Enum.WindowsThemeType;
using SHS = Skylark.Helper.Skymath;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
+using SSDEDT = Sucrose.Shared.Dependency.Enum.DisplayType;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PerformanceType;
using SSDEST = Sucrose.Shared.Dependency.Enum.StretchType;
using SWHWT = Skylark.Wing.Helper.WindowsTheme;
-using SSDEDT = Sucrose.Shared.Dependency.Enum.DisplayType;
-using SEDST = Skylark.Enum.DuplicateScreenType;
-using SEEST = Skylark.Enum.ExpandScreenType;
namespace Sucrose.Portal.Manage
{
diff --git a/src/Portal/Sucrose.Portal/Sucrose.Portal.csproj b/src/Portal/Sucrose.Portal/Sucrose.Portal.csproj
index 0e58e586b..6ad18af27 100644
--- a/src/Portal/Sucrose.Portal/Sucrose.Portal.csproj
+++ b/src/Portal/Sucrose.Portal/Sucrose.Portal.csproj
@@ -118,6 +118,15 @@
+
+
+ Code
+
+
+ Code
+
+
+
$(OutputPath)\$(TargetFramework)\win-$(Platform)
..\..\Sucrose\Package\$(TargetFramework)\$(Platform)\$(AssemblyName)\
diff --git a/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs b/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs
index ae5411198..7202e27fd 100644
--- a/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs
+++ b/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs
@@ -15,6 +15,7 @@
using SPEIL = Sucrose.Portal.Extension.ImageLoader;
using SPMI = Sucrose.Portal.Manage.Internal;
using SPMM = Sucrose.Portal.Manage.Manager;
+using SPVCDP = Sucrose.Portal.Views.Controls.DisplayPreferences;
using SSCHA = Sucrose.Shared.Core.Helper.Architecture;
using SSCHF = Sucrose.Shared.Core.Helper.Framework;
using SSCHM = Sucrose.Shared.Core.Helper.Memory;
@@ -23,7 +24,6 @@
using SSRER = Sucrose.Shared.Resources.Extension.Resources;
using WUAAT = Wpf.Ui.Appearance.ApplicationTheme;
using WUAT = Wpf.Ui.Appearance.ApplicationThemeManager;
-using SPVCDP = Sucrose.Portal.Views.Controls.DisplayPreferences;
namespace Sucrose.Portal.ViewModels.Windows
{
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/Display/Duplicate.xaml b/src/Portal/Sucrose.Portal/Views/Controls/Display/Duplicate.xaml
new file mode 100644
index 000000000..8f6f6d264
--- /dev/null
+++ b/src/Portal/Sucrose.Portal/Views/Controls/Display/Duplicate.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/Display/Duplicate.xaml.cs b/src/Portal/Sucrose.Portal/Views/Controls/Display/Duplicate.xaml.cs
new file mode 100644
index 000000000..5d8b3968c
--- /dev/null
+++ b/src/Portal/Sucrose.Portal/Views/Controls/Display/Duplicate.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace Sucrose.Portal.Views.Controls.Display
+{
+ ///
+ /// Duplicate.xaml etkileşim mantığı
+ ///
+ public partial class Duplicate : UserControl
+ {
+ public Duplicate()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml b/src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml
new file mode 100644
index 000000000..1caf5d06d
--- /dev/null
+++ b/src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml.cs b/src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml.cs
new file mode 100644
index 000000000..613bb2d77
--- /dev/null
+++ b/src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace Sucrose.Portal.Views.Controls.Display
+{
+ ///
+ /// Expand.xaml etkileşim mantığı
+ ///
+ public partial class Expand : UserControl
+ {
+ public Expand()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/Display/Screen.xaml b/src/Portal/Sucrose.Portal/Views/Controls/Display/Screen.xaml
index 7f2b20ce0..70ce2105d 100644
--- a/src/Portal/Sucrose.Portal/Views/Controls/Display/Screen.xaml
+++ b/src/Portal/Sucrose.Portal/Views/Controls/Display/Screen.xaml
@@ -2,7 +2,7 @@
x:Class="Sucrose.Portal.Views.Controls.Display.Screen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/DisplayPreferences.xaml b/src/Portal/Sucrose.Portal/Views/Controls/DisplayPreferences.xaml
index b1cbc22f6..70934a839 100644
--- a/src/Portal/Sucrose.Portal/Views/Controls/DisplayPreferences.xaml
+++ b/src/Portal/Sucrose.Portal/Views/Controls/DisplayPreferences.xaml
@@ -2,7 +2,8 @@
x:Class="Sucrose.Portal.Views.Controls.DisplayPreferences"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:vcontrols="clr-namespace:Sucrose.Portal.Views.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Sucrose.Portal.Views.Controls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -16,18 +17,27 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/DisplayPreferences.xaml.cs b/src/Portal/Sucrose.Portal/Views/Controls/DisplayPreferences.xaml.cs
index 3a8497940..e340e9ffa 100644
--- a/src/Portal/Sucrose.Portal/Views/Controls/DisplayPreferences.xaml.cs
+++ b/src/Portal/Sucrose.Portal/Views/Controls/DisplayPreferences.xaml.cs
@@ -1,33 +1,22 @@
-using System.IO;
-using System.Reflection;
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Wpf.Ui.Controls;
-using SECNT = Skylark.Enum.ClearNumericType;
-using SEMST = Skylark.Enum.ModeStorageType;
-using SEST = Skylark.Enum.StorageType;
-using SHC = Skylark.Helper.Culture;
-using SHN = Skylark.Helper.Numeric;
-using SPMI = Sucrose.Portal.Manage.Internal;
-using SSESSE = Skylark.Standard.Extension.Storage.StorageExtension;
-using SSSHS = Sucrose.Shared.Space.Helper.Size;
-using SSSSS = Skylark.Struct.Storage.StorageStruct;
using SEDST = Skylark.Enum.DuplicateScreenType;
using SEEST = Skylark.Enum.ExpandScreenType;
-using SSTHI = Sucrose.Shared.Theme.Helper.Info;
-using SSTHV = Sucrose.Shared.Theme.Helper.Various;
-using SSRER = Sucrose.Shared.Resources.Extension.Resources;
-using SPVCDS = Sucrose.Portal.Views.Controls.Display.Screen;
-using SSMMS = Skylark.Struct.Monitor.MonitorStruct;
-using SWUS = Skylark.Wing.Utility.Screene;
-using SMMM = Sucrose.Manager.Manage.Manager;
using SMC = Sucrose.Memory.Constant;
-using System.Threading;
using SMMI = Sucrose.Manager.Manage.Internal;
+using SMMM = Sucrose.Manager.Manage.Manager;
+using SPMI = Sucrose.Portal.Manage.Internal;
using SPMM = Sucrose.Portal.Manage.Manager;
+using SPVCDD = Sucrose.Portal.Views.Controls.Display.Duplicate;
+using SPVCDE = Sucrose.Portal.Views.Controls.Display.Expand;
+using SPVCDS = Sucrose.Portal.Views.Controls.Display.Screen;
using SSDEDT = Sucrose.Shared.Dependency.Enum.DisplayType;
+using SSRER = Sucrose.Shared.Resources.Extension.Resources;
+using SWUS = Skylark.Wing.Utility.Screene;
+using TextBlock = System.Windows.Controls.TextBlock;
namespace Sucrose.Portal.Views.Controls
{
@@ -36,11 +25,32 @@ namespace Sucrose.Portal.Views.Controls
///
public partial class DisplayPreferences : ContentDialog, IDisposable
{
+ private StackPanel ExpanderDuplicateContent = new();
+
+ private StackPanel ExpanderExpandContent = new();
+
+ private StackPanel ExpanderCustomContent = new();
+
public DisplayPreferences() : base(SPMI.ContentDialogService.GetContentPresenter())
{
InitializeComponent();
}
+ private async Task Test(SSDEDT Display)
+ {
+ switch (Display)
+ {
+ case SSDEDT.Expand:
+ break;
+ case SSDEDT.Duplicate:
+ break;
+ default:
+ break;
+ }
+
+ await Task.CompletedTask;
+ }
+
private async Task ScreenMonitor()
{
int ScreenCount = SWUS.Screens.Count();
@@ -72,6 +82,35 @@ private async Task ScreenMonitor()
await Task.CompletedTask;
}
+ private async Task ExpandMonitor()
+ {
+ SPVCDE Expand = new();
+
+ Expand.Content.Text = "All Monitors";
+
+ Contents.Children.Add(Expand);
+
+ Contents.InvalidateMeasure();
+
+ await Task.CompletedTask;
+ }
+
+ private async Task DuplicateMonitor()
+ {
+ for (int Count = 0; Count < SWUS.Screens.Count(); Count++)
+ {
+ SPVCDD Duplicate = new();
+
+ Duplicate.Index.Text = $"{Count + 1}";
+
+ Contents.Children.Add(Duplicate);
+ }
+
+ Contents.InvalidateMeasure();
+
+ await Task.CompletedTask;
+ }
+
private void ScreenClicked(object sender, MouseButtonEventArgs e)
{
SPVCDS ScreenMonitor = sender as SPVCDS;
@@ -94,20 +133,155 @@ private void ScreenClicked(object sender, MouseButtonEventArgs e)
}
}
+ private void ScreenChecked()
+ {
+ ExpanderCustomContent.Visibility = Visibility.Collapsed;
+ ExpanderExpandContent.Visibility = Visibility.Collapsed;
+ ExpanderDuplicateContent.Visibility = Visibility.Collapsed;
+ SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Screen);
+ }
+
+ private void ExpandChecked()
+ {
+ ExpanderCustomContent.Visibility = Visibility.Visible;
+ ExpanderExpandContent.Visibility = Visibility.Visible;
+ ExpanderDuplicateContent.Visibility = Visibility.Collapsed;
+ SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Expand);
+ }
+
+ private void DuplicateChecked()
+ {
+ ExpanderCustomContent.Visibility = Visibility.Visible;
+ ExpanderExpandContent.Visibility = Visibility.Collapsed;
+ ExpanderDuplicateContent.Visibility = Visibility.Visible;
+ SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Duplicate);
+ }
+
+ private void ExpandScreenTypeChecked(SEEST Type)
+ {
+ SMMI.EngineSettingManager.SetSetting(SMC.ExpandScreenType, Type);
+ }
+
+ private void DuplicateScreenTypeChecked(SEDST Type)
+ {
+ SMMI.EngineSettingManager.SetSetting(SMC.DuplicateScreenType, Type);
+ }
+
private async void ContentDialog_Loaded(object sender, RoutedEventArgs e)
{
+ StackPanel ExpanderContent = new();
+
+ RadioButton Screen = new()
+ {
+ Content = "Sadece seçili ekran",
+ GroupName = "DisplayType"
+ };
+
+ Screen.Checked += (s, e) => ScreenChecked();
+
+ RadioButton Expand = new()
+ {
+ Content = "Ekranlar arasında uzat",
+ GroupName = "DisplayType"
+ };
+
+ Expand.Checked += (s, e) => ExpandChecked();
+
+ RadioButton Duplicate = new()
+ {
+ Content = "Aynı duvar kağıdını çoğalt",
+ GroupName = "DisplayType"
+ };
+
+ Duplicate.Checked += (s, e) => DuplicateChecked();
+
+ ExpanderContent.Children.Add(Screen);
+ ExpanderContent.Children.Add(Expand);
+ ExpanderContent.Children.Add(Duplicate);
+
+ NavigationViewItemSeparator Separator = new()
+ {
+ Background = SSRER.GetResource("TextFillColorSecondaryBrush"),
+ Margin = new Thickness(0, 10, 0, 10)
+ };
+
+ ExpanderCustomContent.Children.Add(Separator);
+
+ TextBlock ExpandHint = new()
+ {
+ Text = "Ekranlar arasında uzatma modunu seçin",
+ Foreground = SSRER.GetResource("TextFillColorSecondaryBrush"),
+ HorizontalAlignment = HorizontalAlignment.Left,
+ TextWrapping = TextWrapping.WrapWithOverflow,
+ TextAlignment = TextAlignment.Left,
+ Margin = new Thickness(0, 0, 0, 10),
+ FontWeight = FontWeights.SemiBold
+ };
+
+ ExpanderExpandContent.Children.Add(ExpandHint);
+
+ foreach (SEEST Type in Enum.GetValues(typeof(SEEST)))
+ {
+ RadioButton Radio = new()
+ {
+ IsChecked = SPMM.ExpandScreenType == Type,
+ GroupName = "ExpandScreenType",
+ Content = $"{Type}"
+ };
+
+ Radio.Checked += (s, e) => ExpandScreenTypeChecked(Type);
+
+ ExpanderExpandContent.Children.Add(Radio);
+ }
+
+ TextBlock DuplicateHint = new()
+ {
+ Text = "Aynı duvar kağıdını çoğaltma modunu seçin",
+ Foreground = SSRER.GetResource("TextFillColorSecondaryBrush"),
+ HorizontalAlignment = HorizontalAlignment.Left,
+ TextWrapping = TextWrapping.WrapWithOverflow,
+ TextAlignment = TextAlignment.Left,
+ Margin = new Thickness(0, 0, 0, 10),
+ FontWeight = FontWeights.SemiBold
+ };
+
+ ExpanderDuplicateContent.Children.Add(DuplicateHint);
+
+ foreach (SEDST Type in Enum.GetValues(typeof(SEDST)))
+ {
+ RadioButton Radio = new()
+ {
+ IsChecked = SPMM.DuplicateScreenType == Type,
+ GroupName = "DuplicateScreenType",
+ Content = $"{Type}"
+ };
+
+ Radio.Checked += (s, e) => DuplicateScreenTypeChecked(Type);
+
+ ExpanderDuplicateContent.Children.Add(Radio);
+ }
+
switch (SPMM.DisplayType)
{
case SSDEDT.Expand:
- //await ExpandMonitor();
+ await ExpandMonitor();
+ Expand.IsChecked = true;
break;
case SSDEDT.Duplicate:
- //await DuplicateMonitor();
+ await DuplicateMonitor();
+ Duplicate.IsChecked = true;
break;
default:
await ScreenMonitor();
+ Screen.IsChecked = true;
break;
}
+
+ ExpanderContent.Children.Add(ExpanderCustomContent);
+ ExpanderContent.Children.Add(ExpanderExpandContent);
+ ExpanderContent.Children.Add(ExpanderDuplicateContent);
+
+ Expander.FooterCard = ExpanderContent;
}
public void Dispose()
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/ExpanderCard.xaml b/src/Portal/Sucrose.Portal/Views/Controls/ExpanderCard.xaml
index b0190e264..f7fc0243d 100644
--- a/src/Portal/Sucrose.Portal/Views/Controls/ExpanderCard.xaml
+++ b/src/Portal/Sucrose.Portal/Views/Controls/ExpanderCard.xaml
@@ -65,9 +65,5 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/Portal/Sucrose.Portal/Views/Controls/ExpanderCard.xaml.cs b/src/Portal/Sucrose.Portal/Views/Controls/ExpanderCard.xaml.cs
index 4e561067b..9568fbe54 100644
--- a/src/Portal/Sucrose.Portal/Views/Controls/ExpanderCard.xaml.cs
+++ b/src/Portal/Sucrose.Portal/Views/Controls/ExpanderCard.xaml.cs
@@ -50,12 +50,6 @@ public Thickness FooterFrameMargin
set => Footer.Margin = value;
}
- public Thickness FooterFrameMargin2
- {
- get => Footer2.Margin;
- set => Footer2.Margin = value;
- }
-
public object HeaderFrame
{
get => Header.Content;
@@ -68,12 +62,6 @@ public object FooterCard
set => Footer.Content = value;
}
- public object FooterCard2
- {
- get => Footer2.Content;
- set => Footer2.Content = value;
- }
-
public bool IsExpand
{
get => _IsExpand;
@@ -117,10 +105,8 @@ private void UpdateExpandState()
ExpandUp.Visibility = IsExpand ? Visibility.Visible : Visibility.Collapsed;
ExpandDown.Visibility = IsExpand ? Visibility.Collapsed : Visibility.Visible;
FooterControl.Visibility = IsExpand ? Visibility.Visible : Visibility.Collapsed;
- FooterControl2.Visibility = IsExpand && Footer2.Content != null ? Visibility.Visible : Visibility.Collapsed;
FooterFrameMargin = new Thickness(Body.Margin.Left + 32, 0, 0, 0);
- FooterFrameMargin2 = new Thickness(Body.Margin.Left + 32, 0, 0, 0);
}
else
{
@@ -132,7 +118,6 @@ private void UpdateExpandState()
ExpandUp.Visibility = Visibility.Collapsed;
ExpandDown.Visibility = Visibility.Collapsed;
FooterControl.Visibility = Visibility.Collapsed;
- FooterControl2.Visibility = Visibility.Collapsed;
}
}