diff options
author | Grant Limberg <glimberg@gmail.com> | 2015-10-26 19:53:03 -0700 |
---|---|---|
committer | Grant Limberg <glimberg@gmail.com> | 2015-10-26 19:53:03 -0700 |
commit | 87496e9f4a78fae5f9e9bf88479525a3811da522 (patch) | |
tree | 5f3648a9633054a356f66e96180c52d5a16afdeb /windows/WinUI | |
parent | 300a951730a21d75b4800f12e8e23ca9473293ca (diff) | |
download | infinitytier-87496e9f4a78fae5f9e9bf88479525a3811da522.tar.gz infinitytier-87496e9f4a78fae5f9e9bf88479525a3811da522.zip |
can now leave networks
Diffstat (limited to 'windows/WinUI')
-rw-r--r-- | windows/WinUI/MainWindow.xaml | 2 | ||||
-rw-r--r-- | windows/WinUI/MainWindow.xaml.cs | 2 | ||||
-rw-r--r-- | windows/WinUI/NetworkInfoView.xaml | 23 | ||||
-rw-r--r-- | windows/WinUI/NetworkInfoView.xaml.cs | 12 | ||||
-rw-r--r-- | windows/WinUI/NetworksPage.xaml.cs | 8 |
5 files changed, 33 insertions, 14 deletions
diff --git a/windows/WinUI/MainWindow.xaml b/windows/WinUI/MainWindow.xaml index 2dc8e40c..553d44fe 100644 --- a/windows/WinUI/MainWindow.xaml +++ b/windows/WinUI/MainWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WinUI" mc:Ignorable="d" x:Class="WinUI.MainWindow" - Title="ZeroTier One" Height="495" Width="705" Icon="ZeroTierIcon.ico"> + Title="ZeroTier One" Height="500" Width="700" Icon="ZeroTierIcon.ico"> <Window.Resources> <ResourceDictionary> diff --git a/windows/WinUI/MainWindow.xaml.cs b/windows/WinUI/MainWindow.xaml.cs index 666a82e1..f6cb4f44 100644 --- a/windows/WinUI/MainWindow.xaml.cs +++ b/windows/WinUI/MainWindow.xaml.cs @@ -33,6 +33,8 @@ namespace WinUI { InitializeComponent(); + networksPage.SetAPIHandler(handler); + updateStatus(); updateNetworks(); updatePeers(); diff --git a/windows/WinUI/NetworkInfoView.xaml b/windows/WinUI/NetworkInfoView.xaml index 1e090381..86f2b98c 100644 --- a/windows/WinUI/NetworkInfoView.xaml +++ b/windows/WinUI/NetworkInfoView.xaml @@ -8,6 +8,7 @@ <Grid Background="#FFFFFFFF" Margin="5,0,5,1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> + <ColumnDefinition Width="10"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> @@ -23,7 +24,7 @@ <RowDefinition Height="auto"/> </Grid.RowDefinitions> - <Grid Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"> + <Grid Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3"> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="*"/> @@ -42,21 +43,21 @@ <TextBlock TextWrapping="Wrap" Text="Device" HorizontalAlignment="Right" Grid.Column="0" Grid.Row="7" Foreground="#FF000000"/> <TextBlock TextWrapping="Wrap" Text="Managed IPs" HorizontalAlignment="Right" Grid.Column="0" Grid.Row="8" Foreground="#FF000000"/> - <TextBlock x:Name="networkStatus" TextWrapping="Wrap" HorizontalAlignment="Right" Text="OK" TextAlignment="Right" Grid.Column="1" Grid.Row="1" Foreground="#FF000000"/> - <TextBlock x:Name="networkType" TextWrapping="Wrap" Text="PUBLIC" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="2" Foreground="#FF000000"/> - <TextBlock x:Name="macAddress" TextWrapping="Wrap" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="3" Foreground="#FF000000"><Span><Run Text="02:83:4a:1e:4b:3a"/></Span></TextBlock> - <TextBlock x:Name="mtu" TextWrapping="Wrap" Text="2800" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="4" Foreground="#FF000000"/> - <TextBlock x:Name="broadcastEnabled" TextWrapping="Wrap" Text="ENABLED" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="5" Foreground="#FF000000"/> - <TextBlock x:Name="bridgingEnabled" TextWrapping="Wrap" Text="DISABLED" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="6" Foreground="#FF000000"/> - <TextBlock x:Name="deviceName" TextWrapping="Wrap" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="7" Foreground="#FF000000"><Span><Run Text="ethernet_32771"/></Span></TextBlock> - <TextBlock x:Name="managedIps" TextWrapping="Wrap" HorizontalAlignment="Right" TextAlignment="Right" Grid.Column="1" Grid.Row="8" Foreground="#FF000000"><Span><Run Text="28.2.169.248/7 "/></Span><LineBreak/><Span><Run Text="fd80:56c2:e21c:0000:0199:9383:4a02:a9f8/88"/></Span></TextBlock> + <TextBlock x:Name="networkStatus" TextWrapping="Wrap" HorizontalAlignment="Right" Text="OK" TextAlignment="Right" Grid.Column="2" Grid.Row="1" Foreground="#FF000000"/> + <TextBlock x:Name="networkType" TextWrapping="Wrap" Text="PUBLIC" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="2" Foreground="#FF000000"/> + <TextBlock x:Name="macAddress" TextWrapping="Wrap" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="3" Foreground="#FF000000"><Span><Run Text="02:83:4a:1e:4b:3a"/></Span></TextBlock> + <TextBlock x:Name="mtu" TextWrapping="Wrap" Text="2800" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="4" Foreground="#FF000000"/> + <TextBlock x:Name="broadcastEnabled" TextWrapping="Wrap" Text="ENABLED" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="5" Foreground="#FF000000"/> + <TextBlock x:Name="bridgingEnabled" TextWrapping="Wrap" Text="DISABLED" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="6" Foreground="#FF000000"/> + <TextBlock x:Name="deviceName" TextWrapping="Wrap" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="7" Foreground="#FF000000"><Span><Run Text="ethernet_32771"/></Span></TextBlock> + <TextBlock x:Name="managedIps" TextWrapping="Wrap" HorizontalAlignment="Right" TextAlignment="Right" Grid.Column="2" Grid.Row="8" Foreground="#FF000000"><Span><Run Text="28.2.169.248/7 "/></Span><LineBreak/><Span><Run Text="fd80:56c2:e21c:0000:0199:9383:4a02:a9f8/88"/></Span></TextBlock> - <Grid Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="2" Background="#FFFFFFFF"> + <Grid Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="3" Background="#FFFFFFFF"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Button /> - <Button x:Name="leaveButton" Content="Leave" HorizontalAlignment="Right" VerticalAlignment="Top" Width="75" Background="#FFFFB354"/> + <Button x:Name="leaveButton" Content="Leave" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="75" Background="#FFFFB354" Click="leaveButton_Click"/> </Grid> </Grid> </UserControl> diff --git a/windows/WinUI/NetworkInfoView.xaml.cs b/windows/WinUI/NetworkInfoView.xaml.cs index cbc268ca..ccdec288 100644 --- a/windows/WinUI/NetworkInfoView.xaml.cs +++ b/windows/WinUI/NetworkInfoView.xaml.cs @@ -20,11 +20,14 @@ namespace WinUI /// </summary> public partial class NetworkInfoView : UserControl { - ZeroTierNetwork network; + private APIHandler handler; + private ZeroTierNetwork network; - public NetworkInfoView(ZeroTierNetwork network) + public NetworkInfoView(APIHandler handler, ZeroTierNetwork network) { InitializeComponent(); + + this.handler = handler; this.network = network; UpdateNetworkData(); @@ -60,5 +63,10 @@ namespace WinUI return false; } + + private void leaveButton_Click(object sender, RoutedEventArgs e) + { + handler.LeaveNetwork(network.NetworkId); + } } } diff --git a/windows/WinUI/NetworksPage.xaml.cs b/windows/WinUI/NetworksPage.xaml.cs index 60ae0b88..9ded9970 100644 --- a/windows/WinUI/NetworksPage.xaml.cs +++ b/windows/WinUI/NetworksPage.xaml.cs @@ -20,11 +20,18 @@ namespace WinUI /// </summary> public partial class NetworksPage : UserControl { + private APIHandler handler; + public NetworksPage() { InitializeComponent(); } + public void SetAPIHandler(APIHandler handler) + { + this.handler = handler; + } + public void setNetworks(List<ZeroTierNetwork> networks) { this.wrapPanel.Children.Clear(); @@ -33,6 +40,7 @@ namespace WinUI { this.wrapPanel.Children.Add( new NetworkInfoView( + handler, networks.ElementAt<ZeroTierNetwork>(i))); } } |