make the peers page prettier

This commit is contained in:
Grant Limberg 2015-11-04 20:03:25 -08:00
parent 5e9166cec7
commit df74dd6e41
4 changed files with 60 additions and 5 deletions

View File

@ -181,7 +181,7 @@ namespace WinUI
using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{ {
var responseText = streamReader.ReadToEnd(); var responseText = streamReader.ReadToEnd();
//Console.WriteLine(responseText);
List<ZeroTierPeer> peerList = null; List<ZeroTierPeer> peerList = null;
try try
{ {

View File

@ -19,7 +19,23 @@
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" /> <SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" /> <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}"> <Style TargetType="{x:Type TabItem}">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>

View File

@ -5,7 +5,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" Background="White" Foreground="Black"> 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> <DataGrid.Columns>
<DataGridTextColumn Header="Address" Binding="{Binding Address}"/> <DataGridTextColumn Header="Address" Binding="{Binding Address}"/>
<DataGridTextColumn Header="Version" Binding="{Binding VersionString}"/> <DataGridTextColumn Header="Version" Binding="{Binding VersionString}"/>
@ -13,7 +20,7 @@
<DataGridTextColumn Header="Data Paths" Binding="{Binding DataPaths}"/> <DataGridTextColumn Header="Data Paths" Binding="{Binding DataPaths}"/>
<DataGridTextColumn Header="Last Unicast" Binding="{Binding LastUnicastFrame}"/> <DataGridTextColumn Header="Last Unicast" Binding="{Binding LastUnicastFrame}"/>
<DataGridTextColumn Header="Last Multicast" Binding="{Binding LastMulticastFrame}"/> <DataGridTextColumn Header="Last Multicast" Binding="{Binding LastMulticastFrame}"/>
<DataGridTextColumn Header="Role" Binding="{Binding Role}"/> <DataGridTextColumn Width="*" Header="Role" Binding="{Binding Role}"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
</UserControl> </UserControl>

View File

@ -12,11 +12,43 @@ namespace WinUI
[JsonProperty("address")] [JsonProperty("address")]
public string Address { get; set; } public string Address { get; set; }
private Int64 _lastUnicast;
[JsonProperty("lastUnicastFrame")] [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")] [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")] [JsonProperty("versionMajor")]
public int VersionMajor { get; set; } public int VersionMajor { get; set; }