Skip to content

Commit

Permalink
Visual improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
r-smith committed Jan 6, 2017
1 parent d014281 commit aeb3eb6
Show file tree
Hide file tree
Showing 12 changed files with 140 additions and 52 deletions.
2 changes: 1 addition & 1 deletion vmPing/Classes/ApplicationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public int PingTimeout
public string EmailFromAddress { get; set; }
public bool LogOutput { get; set; }
public string LogPath { get; set; }
public PopupNotificationOption PopupOption { get; set; } = PopupNotificationOption.WhenMinimized;
public PopupNotificationOption PopupOption { get; set; } = PopupNotificationOption.Always;

public static void BlurWindows()
{
Expand Down
3 changes: 0 additions & 3 deletions vmPing/Classes/StatusChangeLog.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace vmPing.Classes
{
Expand Down
6 changes: 3 additions & 3 deletions vmPing/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("vmPing")]
[assembly: AssemblyCopyright("Copyright © 2016 Ryan Smith")]
[assembly: AssemblyCopyright("Copyright © 2017 Ryan Smith")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down 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("1.1.5.0")]
[assembly: AssemblyFileVersion("1.1.5.0")]
[assembly: AssemblyVersion("1.1.6.0")]
[assembly: AssemblyFileVersion("1.1.6.0")]
10 changes: 10 additions & 0 deletions vmPing/Properties/Resources.Designer.cs

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

3 changes: 3 additions & 0 deletions vmPing/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,7 @@
<data name="caution_40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\caution-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cancelWhite_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cancelWhite-16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file added vmPing/Resources/cancelWhite-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions vmPing/Views/HelpWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,25 @@
<StackPanel Margin="0,0,0,25">
<!-- Title and description -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,10">
<Image Source="vmPing.ico" Width="32" Height="32" Margin="0,0,18,0" />
<Image Source="/vmPing.ico" Width="32" Height="32" Margin="0,0,18,0" />
<TextBlock Style="{StaticResource TitleText}"
VerticalAlignment="Center"
Text="vmPing">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="4" Direction="330" Color="Black" Opacity="0.2" BlurRadius="4" />
<DropShadowEffect ShadowDepth="4" Direction="330" Color="Black" Opacity="0.15" BlurRadius="4" />
</TextBlock.Effect>
</TextBlock>
</StackPanel>

<TextBlock HorizontalAlignment="Center">
<Hyperlink NavigateUri="https://www.github.com/R-Smith/vmPing"
RequestNavigate="Hyperlink_RequestNavigate"
TextDecorations="None"
FontSize="13"
Foreground="#6c71c4">
https://www.github.com/R-Smith/vmPing
</Hyperlink>
</TextBlock>
<TextBlock Style="{StaticResource VersionText}"
Name="tbVersion"
Text="Version X.XXXX.XXXX" />
Expand Down
16 changes: 16 additions & 0 deletions vmPing/Views/HelpWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Windows;

namespace vmPing.Views
Expand All @@ -22,5 +23,20 @@ public HelpWindow()
// without having to first click in the window.
mainScrollViewer.Focus();
}

private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
try
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
}
catch
{
}
finally
{
e.Handled = true;
}
}
}
}
27 changes: 18 additions & 9 deletions vmPing/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@
<MenuItem Name="mnuPopupWhenMinimized"
Header="When Minimized"
Click="mnuPopupNotification_Click"
IsCheckable="True"
IsChecked="True" />
IsCheckable="True" />
<MenuItem Name="mnuPopupAlways"
Header="Always"
Click="mnuPopupNotification_Click"
IsCheckable="True" />
IsCheckable="True"
IsChecked="True" />
</MenuItem>

<Separator Padding="0,6" />
Expand Down Expand Up @@ -230,29 +230,37 @@
<Grid DockPanel.Dock="Top">
<TextBlock Width="{Binding ElementName=lbHistory, Path=ActualWidth}"/>
<Button Name="btnRemove"
Padding="4,3"
Margin="0,0,4,0"
Padding="5,3"
Margin="0,0,3,0"
Background="Transparent"
HorizontalAlignment="Right"
IsTabStop="False"
Click="btnRemove_Click">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Name="controlButton_border" BorderThickness="0"
<Border Name="controlButton_border"
BorderThickness="1"
BorderBrush="Transparent"
CornerRadius="4"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}">
<Image Name="controlButton_image" Source="/Resources/cancel-16.png"
Stretch="None"
Opacity="0.35"
Width="14" Height="14"
Opacity="0.4"
/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="controlButton_border" Property="BorderBrush" Value="#33000000" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="controlButton_image" Property="Opacity" Value="1" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="controlButton_border" Property="Background" Value="#D0D0D0" />
<Setter TargetName="controlButton_border" Property="Background" Value="White" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="controlButton_border" Property="BorderBrush" Value="Black" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Expand Down Expand Up @@ -316,6 +324,7 @@
</Setter.Value>
</Setter>
<Setter Property="IsTabStop" Value="False" />
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
</Style>
</ListBox.ItemContainerStyle>

Expand Down
56 changes: 42 additions & 14 deletions vmPing/Views/PopupNotificationWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,61 @@
xmlns:local="clr-namespace:vmPing.Views"
xmlns:controls="clr-namespace:vmPing.Controls"
mc:Ignorable="d"
Height="150" Width="500"
Height="95" Width="500"
ResizeMode="NoResize" WindowStyle="None" ShowInTaskbar="False"
Background="#313130" BorderBrush="#636363" BorderThickness="2"
Background="#313130" BorderBrush="#636363" BorderThickness="1"
Topmost="True"
Closing="Window_Closing"
AllowsTransparency="True">
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="00:00:00.3" Storyboard.TargetProperty="Opacity" From="0" To="0.95" />
<DoubleAnimation Duration="00:00:00.3" Storyboard.TargetProperty="Opacity" From="0" To="0.99" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<!-- Close button -->
<Button Name="btnClose"
Padding="4,3"
Margin="0,0,4,0"
Background="White"
Padding="6"
Margin="0,1,3,0"
Background="Transparent"
HorizontalAlignment="Right"
IsTabStop="False"
Click="btnClose_Click">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Name="controlButton_border"
BorderThickness="0"
BorderThickness="1"
BorderBrush="Transparent"
CornerRadius="4"
Opacity="0.5"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}">
<Image Name="controlButton_image"
Source="/Resources/cancel-16.png"
Stretch="None"
Source="/Resources/cancelWhite-16.png"
Width="12"
Height="12"
/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="controlButton_image" Property="Opacity" Value="1" />
<Setter TargetName="controlButton_border" Property="Background" Value="#000" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="controlButton_border" Property="Opacity" Value="1" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="controlButton_border" Property="Background" Value="#A0A0A0" />
<Setter TargetName="controlButton_border" Property="BorderBrush" Value="White" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Expand All @@ -67,15 +76,17 @@
</Style>
</Button.Style>
</Button>

<ListView Name="lvDrives"

<!-- Status change log -->
<ListView Name="lvStatusChangeLog"
Grid.Row="1"
Background="Transparent"
SelectionMode="Single"
BorderThickness="0"
IsTabStop="False"
FocusVisualStyle="{x:Null}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
VerticalAlignment="Top"
>
<ListView.Resources>
<!-- Hide the header row of the listview -->
Expand Down Expand Up @@ -182,5 +193,22 @@
</GridView>
</ListView.View>
</ListView>

<!-- Logo -->
<StackPanel Grid.Row="3"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Image Source="/Resources/vmPing-16.png"
Width="16"
Height="16" />
<TextBlock Grid.Row="3"
Text="vmPing"
FontSize="13"
Foreground="White"
Opacity="0.5"
Margin="7,0,5,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</Window>
52 changes: 32 additions & 20 deletions vmPing/Views/PopupNotificationWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,57 @@ public PopupNotificationWindow(ObservableCollection<StatusChangeLog> statusChang
{
InitializeComponent();

var desktopWorkingArea = SystemParameters.WorkArea;
this.Left = desktopWorkingArea.Right - this.Width;
this.Top = desktopWorkingArea.Bottom - this.Height;
PositionWindow();

lvDrives.ItemsSource = statusChangeLog;
((INotifyCollectionChanged)lvDrives.Items).CollectionChanged += PopupNotificationWindow_CollectionChanged;
lvStatusChangeLog.ItemsSource = statusChangeLog;
((INotifyCollectionChanged)lvStatusChangeLog.Items).CollectionChanged += PopupNotificationWindow_CollectionChanged;
}

private void PopupNotificationWindow_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (lvDrives.Items.Count > 0)
if (lvStatusChangeLog.Items.Count > 0)
{
var border = VisualTreeHelper.GetChild(lvDrives, 0) as Decorator;
var border = VisualTreeHelper.GetChild(lvStatusChangeLog, 0) as Decorator;
if (border != null)
{
var scroll = border.Child as ScrollViewer;
if (scroll != null) scroll.ScrollToEnd();
}
}

switch (lvStatusChangeLog.Items.Count)
{
case 2:
Height = 110;
PositionWindow();
break;
case 3:
Height = 126;
PositionWindow();
break;
case 4:
Height = 147;
PositionWindow();
break;
case 5:
Height = 172;
PositionWindow();
break;
}
}

private void btnClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}

private void PositionWindow()
{
var desktopWorkingArea = SystemParameters.WorkArea;
this.Left = desktopWorkingArea.Right - this.Width;
this.Top = desktopWorkingArea.Bottom - this.Height;
}

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Closing -= Window_Closing;
Expand All @@ -52,18 +77,5 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
anim.Completed += (s, _) => this.Close();
this.BeginAnimation(UIElement.OpacityProperty, anim);
}

private void lbStatusChangeLog_Loaded(object sender, RoutedEventArgs e)
{
if (lvDrives.Items.Count > 0)
{
var border = VisualTreeHelper.GetChild(lvDrives, 0) as Decorator;
if (border != null)
{
var scroll = border.Child as ScrollViewer;
if (scroll != null) scroll.ScrollToEnd();
}
}
}
}
}
3 changes: 3 additions & 0 deletions vmPing/vmPing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@
<ItemGroup>
<Resource Include="Resources\caution-40.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\cancelWhite-16.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down

0 comments on commit aeb3eb6

Please sign in to comment.