wire up the rest of the views to the menu. views not implemented yet tho.

This commit is contained in:
Grant Limberg 2016-11-18 11:42:15 -08:00
parent 6536474b94
commit 7bea709747
7 changed files with 85 additions and 5 deletions

View file

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WinUI"
mc:Ignorable="d"
Title="AboutView" Height="300" Width="300">
Title="AboutView" Height="300" Width="300" Icon="ZeroTierIcon.ico">
<Grid>
</Grid>

View file

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WinUI"
mc:Ignorable="d"
Title="Join a Network" Height="120" Width="320">
Title="Join a Network" Height="120" Width="320" Icon="ZeroTierIcon.ico">
<Grid HorizontalAlignment="Left" Margin="0,0,0,0" Width="315">
<TextBox x:Name="joinNetworkBox" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="291" PreviewTextInput="joinNetworkBox_OnTextEntered" PreviewKeyDown="joinNetworkBox_OnKeyDown"/>
<CheckBox x:Name="allowManagedCheckbox" Content="Allow Managed" HorizontalAlignment="Left" Margin="10,38,0,0" VerticalAlignment="Top" IsChecked="True"/>

View file

@ -0,0 +1,12 @@
<Window x:Class="WinUI.PreferencesView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WinUI"
mc:Ignorable="d"
Title="PreferencesView" Height="300" Width="300" Icon="ZeroTierIcon.ico">
<Grid>
</Grid>
</Window>

View file

@ -0,0 +1,27 @@
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.Shapes;
namespace WinUI
{
/// <summary>
/// Interaction logic for PreferencesView.xaml
/// </summary>
public partial class PreferencesView : Window
{
public PreferencesView()
{
InitializeComponent();
}
}
}

View file

@ -42,8 +42,10 @@
</CollectionContainer>
<Separator/>
<MenuItem Header="About..."/>
<MenuItem Header="Preferences..."/>
<MenuItem Header="About..."
Click="ToolbarItem_AboutClicked"/>
<MenuItem Header="Preferences..."
Click="ToolbarItem_PreferencesClicked"/>
<Separator/>
<MenuItem Header="Quit"/>

View file

@ -31,6 +31,8 @@ namespace WinUI
private NetworkListView netListView = null;
private JoinNetworkView joinNetView = null;
private AboutView aboutView = null;
private PreferencesView prefsView = null;
private NetworkMonitor mon = NetworkMonitor.Instance;
@ -108,7 +110,7 @@ namespace WinUI
private void ToolbarItem_NodeIDClicked(object sender, System.Windows.RoutedEventArgs e)
{
// TODO: Copy Node ID to clipboard
}
private void ToolbarItem_ShowNetworksClicked(object sender, System.Windows.RoutedEventArgs e)
@ -141,6 +143,36 @@ namespace WinUI
joinNetView = null;
}
private void ToolbarItem_AboutClicked(object sender, System.EventArgs e)
{
if (aboutView == null)
{
aboutView = new AboutView();
aboutView.Closed += AboutClosed;
aboutView.Show();
}
}
private void AboutClosed(object sender, System.EventArgs e)
{
aboutView = null;
}
private void ToolbarItem_PreferencesClicked(object sender, System.EventArgs e)
{
if (prefsView == null)
{
prefsView = new PreferencesView();
prefsView.Closed += PreferencesClosed;
prefsView.Show();
}
}
private void PreferencesClosed(object sender, System.EventArgs e)
{
prefsView = null;
}
private void ToolbarItem_NetworkClicked(object sender, System.Windows.RoutedEventArgs e)
{
if(sender.GetType() == typeof(MenuItem))

View file

@ -115,6 +115,9 @@
<Compile Include="PeersPage.xaml.cs">
<DependentUpon>PeersPage.xaml</DependentUpon>
</Compile>
<Compile Include="PreferencesView.xaml.cs">
<DependentUpon>PreferencesView.xaml</DependentUpon>
</Compile>
<Compile Include="ToolbarItem.xaml.cs">
<DependentUpon>ToolbarItem.xaml</DependentUpon>
</Compile>
@ -155,6 +158,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PreferencesView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Simple Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>