Skip to content

Commit 1a6e793

Browse files
committed
* Added ability to select intervals in certain time formats
* Minor design changes
1 parent 0cca5c0 commit 1a6e793

File tree

5 files changed

+110
-9
lines changed

5 files changed

+110
-9
lines changed

MemPlus/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
<setting name="HideOnStart" serializeAs="String">
5656
<value>False</value>
5757
</setting>
58+
<setting name="RamMonitorIntervalIndex" serializeAs="String">
59+
<value>0</value>
60+
</setting>
61+
<setting name="AutoOptimizeTimedIntervalIndex" serializeAs="String">
62+
<value>0</value>
63+
</setting>
5864
</MemPlus.Properties.Settings>
5965
</userSettings>
6066
</configuration>

MemPlus/Properties/Settings.Designer.cs

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MemPlus/Properties/Settings.settings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,11 @@
5050
<Setting Name="HideOnStart" Type="System.Boolean" Scope="User">
5151
<Value Profile="(Default)">False</Value>
5252
</Setting>
53+
<Setting Name="RamMonitorIntervalIndex" Type="System.Int32" Scope="User">
54+
<Value Profile="(Default)">0</Value>
55+
</Setting>
56+
<Setting Name="AutoOptimizeTimedIntervalIndex" Type="System.Int32" Scope="User">
57+
<Value Profile="(Default)">0</Value>
58+
</Setting>
5359
</Settings>
5460
</SettingsFile>

MemPlus/Windows/SettingsWindow.xaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,13 @@
7575
</Grid.ColumnDefinitions>
7676

7777
<Label Content="Update interval:" Margin="3" />
78-
<syncfusion:IntegerTextBox Grid.Column="1" x:Name="ItbRamMonitorTimeout" MinValue="100" MaxValue="60000" Margin="3" />
79-
<Label Grid.Column="2" Content="ms" Margin="3"></Label>
80-
78+
<syncfusion:IntegerTextBox Grid.Column="1" x:Name="ItbRamMonitorTimeout" MinValue="1" Margin="3" />
79+
<ComboBox x:Name="CboRamMonitorInterval" Grid.Column="2" Margin="3" SelectedIndex="0">
80+
<ComboBoxItem Content="milliseconds" />
81+
<ComboBoxItem Content="seconds" />
82+
<ComboBoxItem Content="minutes" />
83+
<ComboBoxItem Content="hours" />
84+
</ComboBox>
8185
</Grid>
8286
</Grid>
8387
</GroupBox>
@@ -99,8 +103,10 @@
99103

100104
<CheckBox x:Name="ChbAutoOptimizeTimed" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Content="Automatically optimize after" Margin="3"/>
101105
<syncfusion:IntegerTextBox x:Name="ItbAutoOptimizeTimed" Grid.Row="1" Grid.Column="1" Margin="3" />
102-
<Label Grid.Row="1" Grid.Column="2" Content="minutes" Margin="3" />
103-
106+
<ComboBox Grid.Row="1" Grid.Column="2" x:Name="CboAutoOptimizeTimedIndex" Margin="3" SelectedIndex="0">
107+
<ComboBoxItem Content="minutes" />
108+
<ComboBoxItem Content="hours" />
109+
</ComboBox>
104110
</Grid>
105111
</GroupBox>
106112
</Grid>

MemPlus/Windows/SettingsWindow.xaml.cs

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,40 @@ private void LoadProperties()
8383
//RAM Monitor
8484
ChbRamMonitor.IsChecked = Properties.Settings.Default.RamMonitor;
8585
ChbDisableInactive.IsChecked = Properties.Settings.Default.DisableOnInactive;
86-
ItbRamMonitorTimeout.Value = Properties.Settings.Default.RamMonitorInterval;
86+
87+
int ramInterval = Properties.Settings.Default.RamMonitorInterval;
88+
switch (Properties.Settings.Default.RamMonitorIntervalIndex)
89+
{
90+
case 0:
91+
ItbRamMonitorTimeout.Value = ramInterval;
92+
break;
93+
case 1:
94+
ItbRamMonitorTimeout.Value = ramInterval / 1000;
95+
break;
96+
case 2:
97+
ItbRamMonitorTimeout.Value = ramInterval / 1000 / 60;
98+
break;
99+
case 3:
100+
ItbRamMonitorTimeout.Value = ramInterval / 1000 / 60 / 60;
101+
break;
102+
}
103+
CboRamMonitorInterval.SelectedIndex = Properties.Settings.Default.RamMonitorIntervalIndex;
87104

88105
ChbAutoOptimizePercentage.IsChecked = Properties.Settings.Default.AutoOptimizePercentage;
89106
ItbAutoOptimizePercentage.Value = Properties.Settings.Default.AutoOptimizePercentageThreshold;
90107

91108
ChbAutoOptimizeTimed.IsChecked = Properties.Settings.Default.AutoOptimizeTimed;
92-
ItbAutoOptimizeTimed.Value = Properties.Settings.Default.AutoOptimizeTimedInterval / 1000 / 60;
109+
110+
CboAutoOptimizeTimedIndex.SelectedIndex = Properties.Settings.Default.AutoOptimizeTimedIntervalIndex;
111+
switch (Properties.Settings.Default.AutoOptimizeTimedIntervalIndex)
112+
{
113+
case 0:
114+
ItbAutoOptimizeTimed.Value = Properties.Settings.Default.AutoOptimizeTimedInterval / 1000 / 60;
115+
break;
116+
case 1:
117+
ItbAutoOptimizeTimed.Value = Properties.Settings.Default.AutoOptimizeTimedInterval / 1000 / 60 / 60;
118+
break;
119+
}
93120

94121

95122
ChbFileSystemCache.IsChecked = Properties.Settings.Default.FileSystemCache;
@@ -158,13 +185,45 @@ private void SaveProperties()
158185
//RAM Monitor
159186
if (ChbRamMonitor.IsChecked != null) Properties.Settings.Default.RamMonitor = ChbRamMonitor.IsChecked.Value;
160187
if (ChbDisableInactive.IsChecked != null) Properties.Settings.Default.DisableOnInactive = ChbDisableInactive.IsChecked.Value;
161-
if (ItbRamMonitorTimeout.Value != null) Properties.Settings.Default.RamMonitorInterval = (int)ItbRamMonitorTimeout.Value;
188+
189+
Properties.Settings.Default.RamMonitorIntervalIndex = CboRamMonitorInterval.SelectedIndex;
190+
if (ItbRamMonitorTimeout.Value != null)
191+
{
192+
int ramInterval = (int)ItbRamMonitorTimeout.Value;
193+
switch (CboRamMonitorInterval.SelectedIndex)
194+
{
195+
case 1:
196+
ramInterval = ramInterval * 1000;
197+
break;
198+
case 2:
199+
ramInterval = ramInterval * 1000 * 60;
200+
break;
201+
case 3:
202+
ramInterval = ramInterval * 1000 * 60 * 60;
203+
break;
204+
}
205+
206+
Properties.Settings.Default.RamMonitorInterval = ramInterval;
207+
}
162208

163209
if (ChbAutoOptimizePercentage.IsChecked != null) Properties.Settings.Default.AutoOptimizePercentage = ChbAutoOptimizePercentage.IsChecked.Value;
164210
if (ItbAutoOptimizePercentage.Value != null) Properties.Settings.Default.AutoOptimizePercentageThreshold = (int)ItbAutoOptimizePercentage.Value;
165211

166212
if (ChbAutoOptimizeTimed.IsChecked != null) Properties.Settings.Default.AutoOptimizeTimed = ChbAutoOptimizeTimed.IsChecked.Value;
167-
if (ItbAutoOptimizeTimed.Value != null) Properties.Settings.Default.AutoOptimizeTimedInterval = (int)ItbAutoOptimizeTimed.Value * 1000 * 60;
213+
214+
Properties.Settings.Default.AutoOptimizeTimedIntervalIndex = CboAutoOptimizeTimedIndex.SelectedIndex;
215+
if (ItbAutoOptimizeTimed.Value != null)
216+
{
217+
switch (CboAutoOptimizeTimedIndex.SelectedIndex)
218+
{
219+
case 0:
220+
Properties.Settings.Default.AutoOptimizeTimedInterval = (int)ItbAutoOptimizeTimed.Value * 1000 * 60;
221+
break;
222+
case 1:
223+
Properties.Settings.Default.AutoOptimizeTimedInterval = (int)ItbAutoOptimizeTimed.Value * 1000 * 60 * 60;
224+
break;
225+
}
226+
}
168227

169228
//RAM Optimizer
170229
if (ChbFileSystemCache.IsChecked != null) Properties.Settings.Default.FileSystemCache = ChbFileSystemCache.IsChecked.Value;

0 commit comments

Comments
 (0)