Skip to content

Commit f0af21f

Browse files
committed
Limit Minimum Header Opacity
Update selected interface after open the settings
1 parent 3cd0069 commit f0af21f

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

ResourcesWidget/MyWidget.xaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,29 @@
1111
<SolidColorBrush Opacity="{Binding WindowOpacity,Mode=OneWay}" Color="{Binding WindowColor,Mode=OneWay}"/>
1212
</Window.Background>
1313

14-
<DockPanel Margin="3,0">
14+
<DockPanel>
1515
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center" DockPanel.Dock="Top">
16+
<Grid.Background>
17+
<SolidColorBrush Opacity="{Binding HeaderOpacity,Mode=OneWay}" Color="{Binding WindowColor,Mode=OneWay}"/>
18+
</Grid.Background>
1619
<Grid.ColumnDefinitions>
1720
<ColumnDefinition/>
1821
<ColumnDefinition/>
1922
<ColumnDefinition/>
2023
</Grid.ColumnDefinitions>
2124
<CheckBox HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="0" IsChecked="{Binding AlwaysOnTop}" ToolTip="Always On Top"
22-
HorizontalContentAlignment="Left"/>
25+
HorizontalContentAlignment="Left" Margin="3,0"/>
2326
<Button ToolTip="Settings" Click="Settings_Click" VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1"
24-
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" HorizontalContentAlignment="Center">
27+
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" HorizontalContentAlignment="Center" Margin="3,0">
2528
<Image Source="/Images/SettingsIcon.png" Width="32"/>
2629
</Button>
2730
<Button ToolTip="Close" Click="Close_Click" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="2"
28-
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" HorizontalContentAlignment="Right">
31+
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" HorizontalContentAlignment="Right" Margin="3,0">
2932
<TextBlock Text="X" FontWeight="Bold" />
3033
</Button>
3134
</Grid>
3235
<Separator HorizontalAlignment="Stretch" DockPanel.Dock="Top"/>
33-
<Grid HorizontalAlignment="Center" DockPanel.Dock="Bottom">
36+
<Grid HorizontalAlignment="Center" DockPanel.Dock="Bottom" Margin="3,0">
3437
<Grid.ColumnDefinitions>
3538
<ColumnDefinition Width="Auto"/>
3639
<ColumnDefinition Width="Auto"/>

ResourcesWidget/MyWidget.xaml.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public decimal RamUsage
124124

125125
public double WindowOpacity
126126
{ get { return Settings.Default.WindowOpacity; } }
127+
public double HeaderOpacity { get { return WindowOpacity < 0.2 ? 0.2 : WindowOpacity; } }
127128
public Color WindowColor
128129
{ get { return Settings.Default.WindowColor; } }
129130

@@ -343,9 +344,10 @@ private void CpuRamCalc()
343344
RamUsage = computerInfo.TotalPhysicalMemory - computerInfo.AvailablePhysicalMemory;
344345
}
345346

346-
private void UpdateColorsAndVis()
347+
private void UpdateProperties()
347348
{
348349
OnPropertyChanged("WindowOpacity");
350+
OnPropertyChanged("HeaderOpacity");
349351
OnPropertyChanged("WindowColor");
350352
OnPropertyChanged("TaskbarIcon");
351353

@@ -379,6 +381,8 @@ private void UpdateColorsAndVis()
379381
OnPropertyChanged("USpeedLableVisiblity");
380382
OnPropertyChanged("CPULabelVisibility");
381383
OnPropertyChanged("RamLableVisiblity");
384+
385+
OnPropertyChanged("SelectedInterface");
382386
}
383387
#endregion
384388

@@ -396,8 +400,8 @@ private void Settings_Click(object sender, RoutedEventArgs e)
396400
{
397401
var settings = new SettingsWindow();
398402
settings.ShowDialog();
399-
UpdateColorsAndVis();
400403
InitializeNetworkMeter();
404+
UpdateProperties();
401405
}
402406
private void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
403407
{

0 commit comments

Comments
 (0)