mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
Initial peers page
This commit is contained in:
parent
c4c67e591b
commit
095539de29
@ -99,8 +99,10 @@
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem x:Name="Peers" Header="Peers" Background="#FF234447" Foreground="White">
|
||||
<Grid Background="#FFE5E5E5"/>
|
||||
</TabItem>
|
||||
<Grid Background="#FFE5E5E5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<local:PeersPage x:Name="peersPage" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></local:PeersPage>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
|
@ -73,7 +73,12 @@ namespace WinUI
|
||||
|
||||
private void updatePeers()
|
||||
{
|
||||
var peers = handler.GetPeers();
|
||||
|
||||
peersPage.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
|
||||
{
|
||||
peersPage.SetPeers(peers);
|
||||
}));
|
||||
}
|
||||
|
||||
private void OnUpdateTimer(object source, ElapsedEventArgs e)
|
||||
|
19
windows/WinUI/PeersPage.xaml
Normal file
19
windows/WinUI/PeersPage.xaml
Normal file
@ -0,0 +1,19 @@
|
||||
<UserControl x:Class="WinUI.PeersPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
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">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Address" Binding="{Binding Address}"/>
|
||||
<DataGridTextColumn Header="Version" Binding="{Binding VersionString}"/>
|
||||
<DataGridTextColumn Header="Latency" Binding="{Binding Latency}"/>
|
||||
<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}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</UserControl>
|
39
windows/WinUI/PeersPage.xaml.cs
Normal file
39
windows/WinUI/PeersPage.xaml.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace WinUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PeersPage.xaml
|
||||
/// </summary>
|
||||
public partial class PeersPage : UserControl
|
||||
{
|
||||
private List<ZeroTierPeer> peersList = new List<ZeroTierPeer>();
|
||||
|
||||
public PeersPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
dataGrid.ItemsSource = peersList;
|
||||
}
|
||||
|
||||
public void SetPeers(List<ZeroTierPeer> peerList)
|
||||
{
|
||||
this.peersList = peerList;
|
||||
dataGrid.ItemsSource = this.peersList;
|
||||
dataGrid.Items.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
@ -100,6 +100,9 @@
|
||||
<Compile Include="NetworksPage.xaml.cs">
|
||||
<DependentUpon>NetworksPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PeersPage.xaml.cs">
|
||||
<DependentUpon>PeersPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ZeroTierPeerPhysicalPath.cs" />
|
||||
<Compile Include="ZeroTierPeer.cs" />
|
||||
<Compile Include="ZeroTierNetwork.cs" />
|
||||
@ -125,6 +128,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="PeersPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Simple Styles.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -30,6 +30,17 @@ namespace WinUI
|
||||
[JsonProperty("version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
public string VersionString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Version == "-1.-1.-1")
|
||||
return "-";
|
||||
else
|
||||
return Version;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonProperty("latency")]
|
||||
public string Latency { get; set; }
|
||||
|
||||
@ -38,5 +49,18 @@ namespace WinUI
|
||||
|
||||
[JsonProperty("paths")]
|
||||
public List<ZeroTierPeerPhysicalPath> Paths { get; set; }
|
||||
|
||||
public string DataPaths
|
||||
{
|
||||
get
|
||||
{
|
||||
string pathStr = "";
|
||||
foreach(ZeroTierPeerPhysicalPath path in Paths)
|
||||
{
|
||||
pathStr += path.Address + "\n";
|
||||
}
|
||||
return pathStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user