11using System . ComponentModel ;
2- using System . Windows ;
3- using System . Windows . Interop ;
4- using System . Windows . Media ;
5- using Bloxstrap . AppData ;
6- using Bloxstrap . Integrations ;
72using Bloxstrap . RobloxInterfaces ;
8- using Wpf . Ui . Hardware ;
93
104namespace Bloxstrap . UI . ViewModels . Settings
115{
6+
127 public class ChannelViewModel : NotifyPropertyChangedViewModel
138 {
149 public ChannelViewModel ( )
1510 {
1611 Task . Run ( ( ) => LoadChannelDeployInfo ( App . Settings . Prop . Channel ) ) ;
12+
13+ // Initialize SelectedPriority from settings
14+ _selectedPriority = App . Settings . Prop . SelectedProcessPriority ;
1715 }
1816
1917 public new event PropertyChangedEventHandler ? PropertyChanged ;
@@ -25,14 +23,6 @@ public bool UpdateCheckingEnabled
2523 get => App . Settings . Prop . CheckForUpdates ;
2624 set => App . Settings . Prop . CheckForUpdates = value ;
2725 }
28-
29- public bool HighPriority
30- {
31- get => App . Settings . Prop . HighPriority ;
32- set => App . Settings . Prop . HighPriority = value ;
33- }
34-
35-
3626 public bool DisableAnimations
3727 {
3828 get => App . Settings . Prop . DisableAnimations ;
@@ -45,6 +35,26 @@ public bool HardwareAcceleration
4535 set => App . Settings . Prop . WPFSoftwareRender = value ;
4636 }
4737
38+
39+ private ProcessPriorityOption _selectedPriority ;
40+
41+ public IReadOnlyList < ProcessPriorityOption > ProcessPriorityOptions { get ; } =
42+ Enum . GetValues ( typeof ( ProcessPriorityOption ) ) . Cast < ProcessPriorityOption > ( ) . ToList ( ) ;
43+
44+ public ProcessPriorityOption SelectedPriority
45+ {
46+ get => _selectedPriority ;
47+ set
48+ {
49+ if ( _selectedPriority != value )
50+ {
51+ _selectedPriority = value ;
52+ App . Settings . Prop . SelectedProcessPriority = value ;
53+ OnPropertyChanged ( nameof ( SelectedPriority ) ) ;
54+ }
55+ }
56+ }
57+
4858 private async Task LoadChannelDeployInfo ( string channel )
4959 {
5060 ShowLoadingError = false ;
@@ -78,17 +88,17 @@ private async Task LoadChannelDeployInfo(string channel)
7888 ShowLoadingError = true ;
7989 OnPropertyChanged ( nameof ( ShowLoadingError ) ) ;
8090
81- // channels that dont exist also throw HttpStatusCode.Unauthorized
8291 if ( ex . StatusCode == HttpStatusCode . Unauthorized )
8392 ChannelInfoLoadingText = Strings . Menu_Channel_Switcher_Unauthorized ;
8493 else
85- ChannelInfoLoadingText = $ "An http error has occured ({ ex . StatusCode } )"; // i dont think we need strings for errors
94+ ChannelInfoLoadingText = $ "An http error has occured ({ ex . StatusCode } )";
8695
8796 OnPropertyChanged ( nameof ( ChannelInfoLoadingText ) ) ;
8897 }
8998 }
9099
91- public bool IsRobloxInstallationMissing => String . IsNullOrEmpty ( App . RobloxState . Prop . Player . VersionGuid ) && String . IsNullOrEmpty ( App . RobloxState . Prop . Studio . VersionGuid ) ;
100+ public bool IsRobloxInstallationMissing => string . IsNullOrEmpty ( App . RobloxState . Prop . Player . VersionGuid ) &&
101+ string . IsNullOrEmpty ( App . RobloxState . Prop . Studio . VersionGuid ) ;
92102
93103 public bool ShowLoadingError { get ; set ; } = false ;
94104 public bool ShowChannelWarning { get ; set ; } = false ;
@@ -115,7 +125,7 @@ public string ChannelHash
115125 {
116126 const string VersionHashFormat = "version-(.*)" ;
117127 Match match = Regex . Match ( value , VersionHashFormat ) ;
118- if ( match . Success || String . IsNullOrEmpty ( value ) )
128+ if ( match . Success || string . IsNullOrEmpty ( value ) )
119129 {
120130 App . Settings . Prop . ChannelHash = value ;
121131 }
@@ -129,11 +139,11 @@ public bool UpdateRoblox
129139 }
130140
131141 public IReadOnlyDictionary < string , ChannelChangeMode > ChannelChangeModes => new Dictionary < string , ChannelChangeMode >
132- {
133- { Strings . Menu_Channel_ChangeAction_Automatic , ChannelChangeMode . Automatic } ,
134- { Strings . Menu_Channel_ChangeAction_Prompt , ChannelChangeMode . Prompt } ,
135- { Strings . Menu_Channel_ChangeAction_Ignore , ChannelChangeMode . Ignore } ,
136- } ;
142+ {
143+ { Strings . Menu_Channel_ChangeAction_Automatic , ChannelChangeMode . Automatic } ,
144+ { Strings . Menu_Channel_ChangeAction_Prompt , ChannelChangeMode . Prompt } ,
145+ { Strings . Menu_Channel_ChangeAction_Ignore , ChannelChangeMode . Ignore } ,
146+ } ;
137147
138148 public string SelectedChannelChangeMode
139149 {
@@ -147,4 +157,4 @@ public bool ForceRobloxReinstallation
147157 set => App . State . Prop . ForceReinstall = value ;
148158 }
149159 }
150- }
160+ }
0 commit comments