Skip to content

Commit

Permalink
Preparing Display Preferences Dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 3, 2023
1 parent b8dc99f commit 149ce5c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">

<Border x:Name="Border" BorderBrush="CornflowerBlue" Cursor="Hand" CornerRadius="5" BorderThickness="2" Margin="5">
Expand Down
4 changes: 2 additions & 2 deletions src/Portal/Sucrose.Portal/Views/Controls/Display/Expand.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">

<Border x:Name="Border" BorderBrush="CornflowerBlue" Cursor="Hand" CornerRadius="5" BorderThickness="2" Margin="5">
<Grid>
<Rectangle x:Name="Rectangle" Fill="{DynamicResource ControlAltFillColorSecondaryBrush}" Width="Auto" Height="100" />
<TextBlock x:Name="Content" Text="#" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource TextFillColorSecondaryBrush}" FontSize="72" FontWeight="SemiBold" Margin="10 0 10 0" />
<TextBlock x:Name="Title" Text="#" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource TextFillColorSecondaryBrush}" FontSize="72" FontWeight="SemiBold" Margin="10 0 10 0" />
</Grid>
</Border>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">

<Border x:Name="Border" BorderBrush="{DynamicResource ControlAltFillColorTertiaryBrush}" Cursor="Hand" CornerRadius="5" BorderThickness="2" Margin="5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
using SPVCDE = Sucrose.Portal.Views.Controls.Display.Expand;
using SPVCDS = Sucrose.Portal.Views.Controls.Display.Screen;
using SSDEDT = Sucrose.Shared.Dependency.Enum.DisplayType;
using SSLHK = Sucrose.Shared.Live.Helper.Kill;
using SSLHR = Sucrose.Shared.Live.Helper.Run;
using SSRER = Sucrose.Shared.Resources.Extension.Resources;
using SSSHL = Sucrose.Shared.Space.Helper.Live;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using SSSMI = Sucrose.Shared.Space.Manage.Internal;
using SWUS = Skylark.Wing.Utility.Screene;
using TextBlock = System.Windows.Controls.TextBlock;

Expand All @@ -36,6 +41,19 @@ public DisplayPreferences() : base(SPMI.ContentDialogService.GetContentPresenter
InitializeComponent();
}

private void Restart()
{
if ((!SMMM.ClosePerformance && !SMMM.PausePerformance) || !SSSHP.Work(SSSMI.Backgroundog))
{
if (SSSHL.Run())
{
SSLHK.Stop();
}

SSLHR.Start();
}
}

private async Task ScreenMonitor()
{
Contents.Children.Clear();
Expand Down Expand Up @@ -75,7 +93,7 @@ private async Task ExpandMonitor()

SPVCDE Expand = new();

Expand.Content.Text = SSRER.GetValue("Portal", "DisplayPreferences", "Expand", "Monitor");
Expand.Title.Text = SSRER.GetValue("Portal", "DisplayPreferences", "Expand", "Monitor");

Contents.Children.Add(Expand);

Expand Down Expand Up @@ -131,7 +149,13 @@ private async void ScreenChecked()
ExpanderCustomContent.Visibility = Visibility.Collapsed;
ExpanderExpandContent.Visibility = Visibility.Collapsed;
ExpanderDuplicateContent.Visibility = Visibility.Collapsed;
SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Screen);

if (SPMM.DisplayType != SSDEDT.Screen)
{
SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Screen);

Restart();
}
}

private async void ExpandChecked()
Expand All @@ -141,7 +165,13 @@ private async void ExpandChecked()
ExpanderCustomContent.Visibility = Visibility.Visible;
ExpanderExpandContent.Visibility = Visibility.Visible;
ExpanderDuplicateContent.Visibility = Visibility.Collapsed;
SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Expand);

if (SPMM.DisplayType != SSDEDT.Expand)
{
SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Expand);

Restart();
}
}

private async void DuplicateChecked()
Expand All @@ -151,17 +181,33 @@ private async void DuplicateChecked()
ExpanderCustomContent.Visibility = Visibility.Visible;
ExpanderExpandContent.Visibility = Visibility.Collapsed;
ExpanderDuplicateContent.Visibility = Visibility.Visible;
SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Duplicate);

if (SPMM.DisplayType != SSDEDT.Duplicate)
{
SMMI.EngineSettingManager.SetSetting(SMC.DisplayType, SSDEDT.Duplicate);

Restart();
}
}

private void ExpandScreenTypeChecked(SEEST Type)
{
SMMI.EngineSettingManager.SetSetting(SMC.ExpandScreenType, Type);
if (SPMM.ExpandScreenType != Type)
{
SMMI.EngineSettingManager.SetSetting(SMC.ExpandScreenType, Type);

Restart();
}
}

private void DuplicateScreenTypeChecked(SEDST Type)
{
SMMI.EngineSettingManager.SetSetting(SMC.DuplicateScreenType, Type);
if (SPMM.DuplicateScreenType != Type)
{
SMMI.EngineSettingManager.SetSetting(SMC.DuplicateScreenType, Type);

Restart();
}
}

private void ContentDialog_Loaded(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 149ce5c

Please sign in to comment.