summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
authorGrant Limberg <glimberg@gmail.com>2015-11-04 20:03:25 -0800
committerGrant Limberg <glimberg@gmail.com>2015-11-04 20:03:25 -0800
commitdf74dd6e41007b55ca879967092ab59af4c3a279 (patch)
treed47efa9a58422d4dbc2b757cb0b2f6d228bc7e9c /windows
parent5e9166cec737f46fa2530f8daa07d92717c685f9 (diff)
downloadinfinitytier-df74dd6e41007b55ca879967092ab59af4c3a279.tar.gz
infinitytier-df74dd6e41007b55ca879967092ab59af4c3a279.zip
make the peers page prettier
Diffstat (limited to 'windows')
-rw-r--r--windows/WinUI/APIHandler.cs2
-rw-r--r--windows/WinUI/MainWindow.xaml16
-rw-r--r--windows/WinUI/PeersPage.xaml11
-rw-r--r--windows/WinUI/ZeroTierPeer.cs36
4 files changed, 60 insertions, 5 deletions
diff --git a/windows/WinUI/APIHandler.cs b/windows/WinUI/APIHandler.cs
index ada7369a..2968c963 100644
--- a/windows/WinUI/APIHandler.cs
+++ b/windows/WinUI/APIHandler.cs
@@ -181,7 +181,7 @@ namespace WinUI
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var responseText = streamReader.ReadToEnd();
-
+ //Console.WriteLine(responseText);
List<ZeroTierPeer> peerList = null;
try
{
diff --git a/windows/WinUI/MainWindow.xaml b/windows/WinUI/MainWindow.xaml
index b5365a37..660cbd9b 100644
--- a/windows/WinUI/MainWindow.xaml
+++ b/windows/WinUI/MainWindow.xaml
@@ -19,7 +19,23 @@
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />
+
+ <Style TargetType="{x:Type DataGrid}">
+ <Setter Property="Background" Value="#FFF" />
+ <Setter Property="AlternationCount" Value="2" />
+ </Style>
+ <Style TargetType="{x:Type DataGridRow}">
+ <Style.Triggers>
+ <Trigger Property="ItemsControl.AlternationIndex" Value="0">
+ <Setter Property="Background" Value="#EEE"></Setter>
+ </Trigger>
+ <Trigger Property="ItemsControl.AlternationIndex" Value="1">
+ <Setter Property="Background" Value="#FFF"></Setter>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+
<Style TargetType="{x:Type TabItem}">
<Setter Property="Template">
<Setter.Value>
diff --git a/windows/WinUI/PeersPage.xaml b/windows/WinUI/PeersPage.xaml
index bf96f5ef..57b11edf 100644
--- a/windows/WinUI/PeersPage.xaml
+++ b/windows/WinUI/PeersPage.xaml
@@ -5,7 +5,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" Background="White" Foreground="Black">
- <DataGrid x:Name="dataGrid" AutoGenerateColumns="False" CanUserResizeColumns="True" Margin="0,0,0,0" CanUserReorderColumns="False" Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=ActualWidth}" Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=ActualHeight}" CanUserSortColumns="False">
+
+ <DataGrid x:Name="dataGrid" GridLinesVisibility="None" AutoGenerateColumns="False" CanUserResizeColumns="True" Margin="0,0,0,0" CanUserReorderColumns="False" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Auto" CanUserSortColumns="False">
+ <DataGrid.CellStyle>
+ <Style TargetType="DataGridCell">
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ </Style>
+ </DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="Address" Binding="{Binding Address}"/>
<DataGridTextColumn Header="Version" Binding="{Binding VersionString}"/>
@@ -13,7 +20,7 @@
<DataGridTextColumn Header="Data Paths" Binding="{Binding DataPaths}"/>
<DataGridTextColumn Header="Last Unicast" Binding="{Binding LastUnicastFrame}"/>
<DataGridTextColumn Header="Last Multicast" Binding="{Binding LastMulticastFrame}"/>
- <DataGridTextColumn Header="Role" Binding="{Binding Role}"/>
+ <DataGridTextColumn Width="*" Header="Role" Binding="{Binding Role}"/>
</DataGrid.Columns>
</DataGrid>
</UserControl>
diff --git a/windows/WinUI/ZeroTierPeer.cs b/windows/WinUI/ZeroTierPeer.cs
index 3153f7e2..06a8896b 100644
--- a/windows/WinUI/ZeroTierPeer.cs
+++ b/windows/WinUI/ZeroTierPeer.cs
@@ -12,11 +12,43 @@ namespace WinUI
[JsonProperty("address")]
public string Address { get; set; }
+ private Int64 _lastUnicast;
[JsonProperty("lastUnicastFrame")]
- public UInt64 LastUnicastFrame { get; set; }
+ public Int64 LastUnicastFrame
+ {
+ get
+ {
+ if (_lastUnicast == 0)
+ return 0;
+
+ TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
+ Int64 millisecondsSinceEpoch = (Int64)t.TotalMilliseconds;
+ return (millisecondsSinceEpoch - _lastUnicast) / 1000;
+ }
+ set
+ {
+ _lastUnicast = value;
+ }
+ }
+ private Int64 _lastMulticast;
[JsonProperty("lastMulticastFrame")]
- public UInt64 LastMulticastFrame { get; set; }
+ public Int64 LastMulticastFrame
+ {
+ get
+ {
+ if (_lastMulticast == 0)
+ return 0;
+
+ TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
+ Int64 millisecondsSinceEpoch = (Int64)t.TotalMilliseconds;
+ return (millisecondsSinceEpoch - _lastMulticast) / 1000;
+ }
+ set
+ {
+ _lastMulticast = value;
+ }
+ }
[JsonProperty("versionMajor")]
public int VersionMajor { get; set; }