Skip to content

Commit

Permalink
Preparing Performance Setting Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Sep 20, 2023
1 parent ae8b338 commit 090914a
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Library/Sucrose.Manager/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public static class Manager

public static string BackgroundImage => SMMI.PortalSettingManager.GetSetting(SMC.BackgroundImage, string.Empty);

public static SEST DownloadType => SMMI.BackgroundogSettingManager.GetSetting(SMC.DownloadType, SEST.Kilobyte);
public static SEST DownloadType => SMMI.BackgroundogSettingManager.GetSetting(SMC.DownloadType, SEST.Megabyte);

public static SEST UploadType => SMMI.BackgroundogSettingManager.GetSetting(SMC.UploadType, SEST.Kilobyte);

public static int Volume => SHS.Clamp(SMMI.EngineSettingManager.GetSettingStable(SMC.Volume, 100), 0, 100);

public static int DownloadValue => SMMI.BackgroundogSettingManager.GetSettingStable(SMC.DownloadValue, 0);
public static int DownloadValue => SMMI.BackgroundogSettingManager.GetSettingStable(SMC.DownloadValue, 10);

public static int UploadValue => SMMI.BackgroundogSettingManager.GetSettingStable(SMC.UploadValue, 0);
public static int UploadValue => SMMI.BackgroundogSettingManager.GetSettingStable(SMC.UploadValue, 800);

public static string UserAgent => SMMI.GeneralSettingManager.GetSetting(SMC.UserAgent, SMR.UserAgent);

Expand Down
2 changes: 1 addition & 1 deletion src/Portal/Sucrose.Portal/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
using SSDEST = Sucrose.Shared.Dependency.Enum.StretchType;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PerformanceType;
using SSDEST = Sucrose.Shared.Dependency.Enum.StretchType;
using SWHWT = Skylark.Wing.Helper.WindowsTheme;

namespace Sucrose.Portal.Manage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMMM = Sucrose.Manager.Manage.Manager;
using SPMM = Sucrose.Portal.Manage.Manager;
using SMR = Sucrose.Memory.Readonly;
using SPMM = Sucrose.Portal.Manage.Manager;
using SPVCEC = Sucrose.Portal.Views.Controls.ExpanderCard;
using SSDECT = Sucrose.Shared.Dependency.Enum.CommandsType;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PerformanceType;
Expand Down Expand Up @@ -85,7 +85,7 @@ private void InitializeViewModel()

Network.Title.Text = "Ağ Kullanımı";
Network.LeftIcon.Symbol = SymbolRegular.NetworkCheck24;
Network.Description.Text = "Ağ kullanımı belirlenen sınırı geçtiğinde duvar kağıdına ne olacağı.";
Network.Description.Text = "Ağ kullanımı ayarlarınız sonucunda duvar kağıdına ne olacağı.";

ComboBox NetworkPerformance = new();

Expand Down Expand Up @@ -156,6 +156,8 @@ private void InitializeViewModel()
Minimum = 0
};

NetworkUpload.ValueChanged += (s, e) => NetworkUploadChanged(NetworkUpload.Value);

ComboBox NetworkUploadType = new();

NetworkUploadType.SelectionChanged += (s, e) => NetworkUploadTypeSelected(NetworkUploadType.SelectedIndex);
Expand Down Expand Up @@ -193,6 +195,8 @@ private void InitializeViewModel()
Minimum = 0
};

NetworkDownload.ValueChanged += (s, e) => NetworkDownloadChanged(NetworkDownload.Value);

ComboBox NetworkDownloadType = new();

NetworkDownloadType.SelectionChanged += (s, e) => NetworkDownloadTypeSelected(NetworkDownloadType.SelectedIndex);
Expand Down Expand Up @@ -253,6 +257,16 @@ private void CounterStateChecked(bool State)
}
}

private void NetworkUploadChanged(double? Value)
{
int NewValue = Convert.ToInt32(Value);

if (NewValue != SMMM.UploadValue)
{
SMMI.BackgroundogSettingManager.SetSetting(SMC.UploadValue, NewValue);
}
}

private void NetworkUploadTypeSelected(int Index)
{
if (Index != (int)SMMM.UploadType)
Expand Down Expand Up @@ -281,6 +295,16 @@ private void NetworkPerformanceSelected(int Index)
}
}

private void NetworkDownloadChanged(double? Value)
{
int NewValue = Convert.ToInt32(Value);

if (NewValue != SMMM.DownloadValue)
{
SMMI.BackgroundogSettingManager.SetSetting(SMC.DownloadValue, NewValue);
}
}

private void NetworkDownloadTypeSelected(int Index)
{
if (Index != (int)SMMM.DownloadType)
Expand Down
1 change: 1 addition & 0 deletions src/Portal/Sucrose.Portal/Views/Windows/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="{DynamicResource Portal.MainWindow.Title}"
ContentRendered="MainWindow_ContentRendered"
PreviewKeyDown="MainWindow_PreviewKeyDown"
Width="900" MinWidth="900"
Height="600" MinHeight="600"
ShowInTaskbar="False"
Expand Down
9 changes: 9 additions & 0 deletions src/Portal/Sucrose.Portal/Views/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Wpf.Ui;
using Wpf.Ui.Controls;
using Button = Wpf.Ui.Controls.Button;
Expand Down Expand Up @@ -155,6 +156,14 @@ private void MainWindow_ContentRendered(object sender, EventArgs e)
ShowInTaskbar = true;
}

private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.F5)
{
e.Handled = true;
}
}

private void NavigationChange_Click(object sender, RoutedEventArgs e)
{
NavigationViewItem View = sender as NavigationViewItem;
Expand Down
7 changes: 3 additions & 4 deletions src/Project/Sucrose.Backgroundog/Helper/Specification.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using Google.Protobuf.WellKnownTypes;
using LibreHardwareMonitor.Hardware;
using LibreHardwareMonitor.Hardware;
using Skylark.Enum;
using Skylark.Helper;
using Skylark.Standard.Extension.Storage;
using System.Management;
using SBEAS = Sucrose.Backgroundog.Extension.AudioSession;
using SBEUV = Sucrose.Backgroundog.Extension.UpdateVisitor;
using SBMI = Sucrose.Backgroundog.Manage.Internal;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMMM = Sucrose.Manager.Manage.Manager;
using SSSHN = Sucrose.Shared.Space.Helper.Network;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMC = Sucrose.Memory.Constant;

namespace Sucrose.Backgroundog.Helper
{
Expand Down

0 comments on commit 090914a

Please sign in to comment.