Skip to content

Commit

Permalink
added show PC name setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcadeRenegade committed Dec 20, 2018
1 parent a17861b commit 3a052f8
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 8 deletions.
13 changes: 11 additions & 2 deletions SidebarDiagnostics/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@
<Style x:Key="SidebarWindow" TargetType="{x:Type win:AppBarWindow}">
<Setter Property="Title" Value="{x:Static frame:Resources.Sidebar}" />
<Setter Property="Icon" Value="Sidebar.ico" />
<Setter Property="Width" Value="{Binding Source={x:Static frame:Settings.Instance}, Path=SidebarWidth, Mode=OneWay}" />
<Setter Property="Height" Value="800" />
<Setter Property="Left" Value="0" />
<Setter Property="Top" Value="0" />
<Setter Property="Width" Value="0" />
<Setter Property="Height" Value="0" />
<!--<Setter Property="Width" Value="{Binding Source={x:Static frame:Settings.Instance}, Path=SidebarWidth, Mode=OneWay}" />-->
<!--<Setter Property="Height" Value="800" />-->
<Setter Property="AutoDPI" Value="False" />
<Setter Property="ShowInTaskbar" Value="False" />
<Setter Property="AllowsTransparency" Value="True" />
Expand Down Expand Up @@ -165,6 +169,11 @@
<Setter Property="Orientation" Value="Vertical" />
</Style>

<Style x:Key="HeaderPanel" TargetType="{x:Type StackPanel}">
<Setter Property="Orientation" Value="Vertical" />
<Setter Property="Margin" Value="0,0,0,10" />
</Style>

<Style x:Key="GroupPanel" TargetType="{x:Type StackPanel}">
<Setter Property="Orientation" Value="Vertical" />
<Setter Property="Margin" Value="0,10" />
Expand Down
8 changes: 8 additions & 0 deletions SidebarDiagnostics/ChangeLog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[
{
"Version": "3.5.2",
"Changes": [
"Added an option to show the computer name at the top of the sidebar.",
"Enable it in the settings under the customize tab.",
"Disabled by default."
]
},
{
"Version": "3.5.1",
"Changes": [
Expand Down
4 changes: 2 additions & 2 deletions SidebarDiagnostics/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.5.1.0")]
[assembly: AssemblyFileVersion("3.5.1.0")]
[assembly: AssemblyVersion("3.5.2.0")]
[assembly: AssemblyFileVersion("3.5.2.0")]
18 changes: 18 additions & 0 deletions SidebarDiagnostics/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions SidebarDiagnostics/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1033,4 +1033,12 @@
<value>Ext</value>
<comment>Short label for network ext IP address metric</comment>
</data>
<data name="SettingsShowMachineName" xml:space="preserve">
<value>Show PC Name</value>
<comment>Settings show machine name label</comment>
</data>
<data name="SettingsShowMachineNameTooltip" xml:space="preserve">
<value>Shows the name of the computer.</value>
<comment>Settings show machine name tooltip</comment>
</data>
</root>
17 changes: 17 additions & 0 deletions SidebarDiagnostics/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,23 @@ public bool AlertBlink
}
}

private bool _showMachineName { get; set; } = false;

[JsonProperty]
public bool ShowMachineName
{
get
{
return _showMachineName;
}
set
{
_showMachineName = value;

NotifyPropertyChanged("ShowMachineName");
}
}

private bool _showClock { get; set; } = true;

[JsonProperty]
Expand Down
10 changes: 7 additions & 3 deletions SidebarDiagnostics/Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@
<RowDefinition Height="38px"></RowDefinition>
<RowDefinition Height="38px"></RowDefinition>
<RowDefinition Height="38px"></RowDefinition>
<RowDefinition Height="38px"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="38px"></RowDefinition>
</Grid.RowDefinitions>

<Label Grid.Column="0" Grid.Row="0" Content="{x:Static frame:Resources.SettingsSidebarWidth}" />
Expand Down Expand Up @@ -195,14 +196,17 @@
<Label Grid.Column="0" Grid.Row="8" Content="{x:Static frame:Resources.SettingsAlertBlink}" />
<CheckBox Grid.Column="1" Grid.Row="8" IsChecked="{Binding Path=AlertBlink, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ToolTip="{x:Static frame:Resources.SettingsAlertBlinkTooltip}" />

<Label Grid.Column="0" Grid.Row="9" Content="{x:Static frame:Resources.SettingsDateFormat}" />
<ComboBox Grid.Column="1" Grid.Row="9" ItemsSource="{Binding Path=DateSettingItems}" DisplayMemberPath="Display" SelectedValue="{Binding Path=DateSetting, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=ShowClock, Mode=OneWay}" ToolTip="{x:Static frame:Resources.SettingsDateFormatTooltip}" />
<Label Grid.Column="0" Grid.Row="9" Content="{x:Static frame:Resources.SettingsShowMachineName}" />
<CheckBox Grid.Column="1" Grid.Row="9" IsChecked="{Binding Path=ShowMachineName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ToolTip="{x:Static frame:Resources.SettingsShowMachineNameTooltip}" />

<Label Grid.Column="0" Grid.Row="10" Content="{x:Static frame:Resources.SettingsShowClock}" />
<CheckBox Grid.Column="1" Grid.Row="10" IsChecked="{Binding Path=ShowClock, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ToolTip="{x:Static frame:Resources.SettingsShowClockTooltip}" />

<Label Grid.Column="0" Grid.Row="11" Content="{x:Static frame:Resources.Settings24HourClock}" />
<CheckBox Grid.Column="1" Grid.Row="11" IsChecked="{Binding Path=Clock24HR, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=ShowClock, Mode=OneWay}" ToolTip="{x:Static frame:Resources.Settings24HourClockTooltip}" />

<Label Grid.Column="0" Grid.Row="12" Content="{x:Static frame:Resources.SettingsDateFormat}" />
<ComboBox Grid.Column="1" Grid.Row="12" ItemsSource="{Binding Path=DateSettingItems}" DisplayMemberPath="Display" SelectedValue="{Binding Path=DateSetting, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=ShowClock, Mode=OneWay}" ToolTip="{x:Static frame:Resources.SettingsDateFormatTooltip}" />
</Grid>
</TabItem>
<TabItem Header="{x:Static frame:Resources.SettingsMonitorsTab}">
Expand Down
18 changes: 18 additions & 0 deletions SidebarDiagnostics/SettingsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public SettingsModel(Sidebar sidebar)
DateSetting = Framework.Settings.Instance.DateSetting;
CollapseMenuBar = Framework.Settings.Instance.CollapseMenuBar;
InitiallyHidden = Framework.Settings.Instance.InitiallyHidden;
ShowMachineName = Framework.Settings.Instance.ShowMachineName;
ShowClock = Framework.Settings.Instance.ShowClock;
Clock24HR = Framework.Settings.Instance.Clock24HR;

Expand Down Expand Up @@ -158,6 +159,7 @@ public void Save()
Framework.Settings.Instance.DateSetting = DateSetting;
Framework.Settings.Instance.CollapseMenuBar = CollapseMenuBar;
Framework.Settings.Instance.InitiallyHidden = InitiallyHidden;
Framework.Settings.Instance.ShowMachineName = ShowMachineName;
Framework.Settings.Instance.ShowClock = ShowClock;
Framework.Settings.Instance.Clock24HR = Clock24HR;

Expand Down Expand Up @@ -798,6 +800,22 @@ public bool InitiallyHidden
}
}

private bool _showMachineName { get; set; } = true;

public bool ShowMachineName
{
get
{
return _showMachineName;
}
set
{
_showMachineName = value;

NotifyPropertyChanged("ShowMachineName");
}
}

private bool _showClock { get; set; }

public bool ShowClock
Expand Down
18 changes: 18 additions & 0 deletions SidebarDiagnostics/Sidebar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@

<ScrollViewer Style="{StaticResource ContentView}">
<StackPanel Style="{StaticResource ContentPanel}">
<ContentControl>
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=ShowMachineName, Mode=OneWay}" Value="True">
<Setter Property="Content">
<Setter.Value>
<StackPanel Style="{StaticResource HeaderPanel}">
<Label Content="{Binding Path=MachineName, Mode=OneWay}" Style="{StaticResource AppTitle}" />
</StackPanel>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>

<ContentControl>
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
Expand Down
2 changes: 1 addition & 1 deletion SidebarDiagnostics/SidebarDiagnostics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<CustomToolNamespace>SidebarDiagnostics.Framework</CustomToolNamespace>
<LastGenOutput>Resources1.Designer.cs</LastGenOutput>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
40 changes: 40 additions & 0 deletions SidebarDiagnostics/SidebarModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class SidebarModel : INotifyPropertyChanged, IDisposable
{
public SidebarModel()
{
InitMachineName();
InitClock();
InitMonitors();
}
Expand Down Expand Up @@ -73,6 +74,13 @@ public void NotifyPropertyChanged(string propertyName)

public event PropertyChangedEventHandler PropertyChanged;

private void InitMachineName()
{
ShowMachineName = Framework.Settings.Instance.ShowMachineName;

MachineName = Environment.MachineName;
}

private void InitClock()
{
ShowClock = Framework.Settings.Instance.ShowClock;
Expand Down Expand Up @@ -213,6 +221,38 @@ public bool Ready
}
}

private bool _showMachineName { get; set; }

public bool ShowMachineName
{
get
{
return _showMachineName;
}
set
{
_showMachineName = value;

NotifyPropertyChanged("ShowMachineName");
}
}

private string _machineName { get; set; }

public string MachineName
{
get
{
return _machineName;
}
set
{
_machineName = value;

NotifyPropertyChanged("MachineName");
}
}

private bool _showClock { get; set; }

public bool ShowClock
Expand Down

0 comments on commit 3a052f8

Please sign in to comment.