Skip to content

Commit d39b290

Browse files
committed
* Added a new setting to change opacity
* Added a new setting to change resize border thickness
1 parent 9239484 commit d39b290

File tree

10 files changed

+83
-11
lines changed

10 files changed

+83
-11
lines changed

MemPlus/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@
7979
<setting name="RamCleaningMessage" serializeAs="String">
8080
<value>True</value>
8181
</setting>
82+
<setting name="WindowOpacity" serializeAs="String">
83+
<value>1</value>
84+
</setting>
85+
<setting name="WindowResizeBorder" serializeAs="String">
86+
<value>3</value>
87+
</setting>
8288
</MemPlus.Properties.Settings>
8389
</userSettings>
8490
</configuration>

MemPlus/Business/GUI/StyleManager.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ internal static void ChangeStyle(DependencyObject o)
2020
{
2121
SkinStorage.SetVisualStyle(o, Properties.Settings.Default.VisualStyle);
2222
SkinStorage.SetMetroBrush(o, new SolidColorBrush(Properties.Settings.Default.MetroColor));
23-
((ChromelessWindow)o).BorderThickness = new Thickness(Properties.Settings.Default.BorderThickness);
24-
((ChromelessWindow)o).CornerRadius = new CornerRadius(0, 0, 0, 0);
23+
if (!(o is ChromelessWindow window)) return;
24+
window.BorderThickness = new Thickness(Properties.Settings.Default.BorderThickness);
25+
window.CornerRadius = new CornerRadius(0, 0, 0, 0);
26+
window.Opacity = Properties.Settings.Default.WindowOpacity;
27+
window.ResizeBorderThickness = new Thickness(Properties.Settings.Default.WindowResizeBorder);
2528
}
2629
catch (Exception ex)
2730
{

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
@@ -74,5 +74,11 @@
7474
<Setting Name="RamCleaningMessage" Type="System.Boolean" Scope="User">
7575
<Value Profile="(Default)">True</Value>
7676
</Setting>
77+
<Setting Name="WindowOpacity" Type="System.Double" Scope="User">
78+
<Value Profile="(Default)">1</Value>
79+
</Setting>
80+
<Setting Name="WindowResizeBorder" Type="System.Double" Scope="User">
81+
<Value Profile="(Default)">3</Value>
82+
</Setting>
7783
</Settings>
7884
</SettingsFile>

MemPlus/Views/Windows/AboutWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
TitleTextAlignment="Center"
1010
WindowStartupLocation="CenterScreen"
1111
UseLayoutRounding="True"
12+
AllowsTransparency="True"
1213
Title="MemPlus - About" Height="200" Width="350" Icon="/MemPlus;component/Resources/Images/ram.png">
1314
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
1415
<Grid.RowDefinitions>

MemPlus/Views/Windows/AnalyzerWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
88
mc:Ignorable="d"
99
UseLayoutRounding="True"
10+
AllowsTransparency="True"
1011
TitleTextAlignment="Center"
1112
Title="MemPlus - RAM Analyzer" Height="300" Width="350"
1213
Icon="/MemPlus;component/Resources/Images/ram.png"

MemPlus/Views/Windows/LogWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
mc:Ignorable="d"
99
UseLayoutRounding="True"
1010
WindowStartupLocation="CenterScreen"
11+
AllowsTransparency="True"
1112
TitleTextAlignment="Center"
1213
Title="MemPlus - Logs" Height="300" Width="450" Icon="/Resources/Images/ram.png">
1314
<Grid>

MemPlus/Views/Windows/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
UseLayoutRounding="True"
1111
TitleTextAlignment="Center"
1212
Closing="MainWindow_OnClosing"
13+
AllowsTransparency="True"
1314
Title="MemPlus" Height="300" Width="500" WindowStartupLocation="CenterScreen" Icon="/Resources/Images/ram.png">
1415
<Grid>
1516
<Grid.RowDefinitions>

MemPlus/Views/Windows/SettingsWindow.xaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
88
mc:Ignorable="d"
99
UseLayoutRounding="True"
10+
AllowsTransparency="True"
1011
TitleTextAlignment="Center"
1112
WindowStartupLocation="CenterScreen"
1213
Title="MemPlus - Settings" Height="380" Width="450" Icon="/MemPlus;component/Resources/Images/ram.png">
@@ -192,12 +193,14 @@
192193
<RowDefinition Height="Auto" />
193194
<RowDefinition Height="Auto" />
194195
<RowDefinition Height="Auto" />
196+
<RowDefinition Height="Auto" />
197+
<RowDefinition Height="Auto" />
195198
</Grid.RowDefinitions>
196199
<Grid.ColumnDefinitions>
197-
<ColumnDefinition />
198-
<ColumnDefinition />
200+
<ColumnDefinition Width="Auto" />
201+
<ColumnDefinition Width="Auto" />
199202
</Grid.ColumnDefinitions>
200-
<Label Margin="3" Content="Style:"></Label>
203+
<Label Margin="3" Content="Style:" />
201204
<ComboBox Margin="3" x:Name="CboStyle" SelectedValuePath="Content" Grid.Row="0" Grid.Column="1" IsReadOnly="True">
202205
<ComboBoxItem>Metro</ComboBoxItem>
203206
<ComboBoxItem>Blend</ComboBoxItem>
@@ -215,10 +218,14 @@
215218
<ComboBoxItem>Transparent</ComboBoxItem>
216219
<ComboBoxItem>None</ComboBoxItem>
217220
</ComboBox>
218-
<Label Margin="3" Grid.Row="1" Grid.Column="0" Content="Metro brush:"></Label>
221+
<Label Margin="3" Grid.Row="1" Grid.Column="0" Content="Metro brush:" />
219222
<syncfusion:ColorPicker Margin="3" x:Name="CpMetroBrush" Grid.Row="1" Grid.Column="1" />
220-
<Label Margin="3" Grid.Row="2" Grid.Column="0" Content="Border thickness:"></Label>
223+
<Label Margin="3" Grid.Row="2" Grid.Column="0" Content="Border thickness:" />
221224
<syncfusion:IntegerTextBox Margin="3" x:Name="IntBorderThickness" Grid.Row="2" Grid.Column="1" MinValue="0"></syncfusion:IntegerTextBox>
225+
<Label Margin="3" Grid.Row="3" Grid.Column="0" Content="Window opacity:" />
226+
<Slider x:Name="SldOpacity" Margin="3" Grid.Row="3" Grid.Column="1" Minimum="30" Maximum="100" Width="150" ValueChanged="SldOpacity_OnValueChanged" />
227+
<Label Margin="3" Grid.Row="4" Grid.Column="0" Content="Resize border:" />
228+
<Slider x:Name="SldWindowResize" Margin="3" Grid.Row="4" Grid.Column="1" Minimum="2" Maximum="10" Width="150" ValueChanged="SldWindowResize_OnValueChanged" />
222229
</Grid>
223230
</GroupBox>
224231
</Grid>

MemPlus/Views/Windows/SettingsWindow.xaml.cs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ public partial class SettingsWindow
3535
public SettingsWindow(MainWindow mainWindow, LogController logController)
3636
{
3737
_logController = logController;
38+
_mainWindow = mainWindow;
3839
_logController.AddLog(new ApplicationLog("Initializing SettingsWindow"));
3940

4041
InitializeComponent();
4142
ChangeVisualStyle();
4243
LoadProperties();
4344

44-
_mainWindow = mainWindow;
45-
4645
_logController.AddLog(new ApplicationLog("Done initializing SettingsWindow"));
4746
}
4847

@@ -153,6 +152,8 @@ private void LoadProperties()
153152
CboStyle.Text = Properties.Settings.Default.VisualStyle;
154153
CpMetroBrush.Color = Properties.Settings.Default.MetroColor;
155154
IntBorderThickness.Value = Properties.Settings.Default.BorderThickness;
155+
SldOpacity.Value = Properties.Settings.Default.WindowOpacity * 100;
156+
SldWindowResize.Value = Properties.Settings.Default.WindowResizeBorder;
156157
}
157158
catch (Exception ex)
158159
{
@@ -268,16 +269,17 @@ private void SaveProperties()
268269

269270
//Theme
270271
Properties.Settings.Default.VisualStyle = CboStyle.Text;
271-
272272
Properties.Settings.Default.MetroColor = CpMetroBrush.Color;
273273
if (IntBorderThickness.Value != null) Properties.Settings.Default.BorderThickness = (int)IntBorderThickness.Value;
274+
Properties.Settings.Default.WindowOpacity = SldOpacity.Value / 100;
275+
Properties.Settings.Default.WindowResizeBorder = SldWindowResize.Value;
274276

275277
Properties.Settings.Default.Save();
276278

277-
LoadProperties();
278279
_mainWindow.ChangeVisualStyle();
279280
_mainWindow.LoadProperties();
280281
ChangeVisualStyle();
282+
LoadProperties();
281283

282284
_logController.AddLog(new ApplicationLog("Properties have been saved"));
283285

@@ -452,5 +454,25 @@ private void LsvExclusions_OnDrop(object sender, DragEventArgs e)
452454
}
453455
}
454456
}
457+
458+
/// <summary>
459+
/// Method that is called when the opacity should change dynamically
460+
/// </summary>
461+
/// <param name="sender">The object that called this method</param>
462+
/// <param name="e">The RoutedPropertyChangedEventArgs</param>
463+
private void SldOpacity_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
464+
{
465+
Opacity = SldOpacity.Value / 100;
466+
}
467+
468+
/// <summary>
469+
/// Method that is called when the ResizeBorderThickness should change dynamically
470+
/// </summary>
471+
/// <param name="sender">The object that called this method</param>
472+
/// <param name="e">The RoutedPropertyChangedEventArgs</param>
473+
private void SldWindowResize_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
474+
{
475+
ResizeBorderThickness = new Thickness(SldWindowResize.Value);
476+
}
455477
}
456478
}

0 commit comments

Comments
 (0)