From 7bea7097475dba27e67146bc0d865a37870818dd Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Fri, 18 Nov 2016 11:42:15 -0800 Subject: wire up the rest of the views to the menu. views not implemented yet tho. --- windows/WinUI/PreferencesView.xaml.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 windows/WinUI/PreferencesView.xaml.cs (limited to 'windows/WinUI/PreferencesView.xaml.cs') diff --git a/windows/WinUI/PreferencesView.xaml.cs b/windows/WinUI/PreferencesView.xaml.cs new file mode 100644 index 00000000..9de8766e --- /dev/null +++ b/windows/WinUI/PreferencesView.xaml.cs @@ -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 +{ + /// + /// Interaction logic for PreferencesView.xaml + /// + public partial class PreferencesView : Window + { + public PreferencesView() + { + InitializeComponent(); + } + } +} -- cgit v1.2.3 From a6ed711492eddfc85afa6fe171e69d7f8798ec23 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Fri, 18 Nov 2016 15:44:41 -0800 Subject: wired up the startup registry key to the registry --- windows/WinUI/JoinNetworkView.xaml | 4 ++-- windows/WinUI/PreferencesView.xaml | 2 +- windows/WinUI/PreferencesView.xaml.cs | 25 ++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 4 deletions(-) (limited to 'windows/WinUI/PreferencesView.xaml.cs') diff --git a/windows/WinUI/JoinNetworkView.xaml b/windows/WinUI/JoinNetworkView.xaml index 0bd065a4..1cd1e98d 100644 --- a/windows/WinUI/JoinNetworkView.xaml +++ b/windows/WinUI/JoinNetworkView.xaml @@ -5,12 +5,12 @@ 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" Icon="ZeroTierIcon.ico"> + Title="Join a Network" SizeToContent="WidthAndHeight" Height="Auto" Width="Auto" Icon="ZeroTierIcon.ico"> - + + diff --git a/windows/WinUI/OnboardProcess/CreateAccount.xaml.cs b/windows/WinUI/OnboardProcess/CreateAccount.xaml.cs new file mode 100644 index 00000000..72ba2182 --- /dev/null +++ b/windows/WinUI/OnboardProcess/CreateAccount.xaml.cs @@ -0,0 +1,66 @@ +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.OnboardProcess +{ + /// + /// Interaction logic for CreateAccount.xaml + /// + public partial class CreateAccount : UserControl, ISwitchable + { + public CreateAccount() + { + InitializeComponent(); + } + + public void UtilizeState(object state) + { + throw new NotImplementedException(); + } + + public void CreateAccount_Click(object sender, RoutedEventArgs e) + { + DoCreateAccount(); + } + + public void BackButton_Click(object sender, RoutedEventArgs e) + { + Switcher.Switch(new RegisterOrLogIn()); + } + + public async void DoCreateAccount() + { + if (PasswordTextBox1.Password.ToString() != PasswordTextBox2.Password.ToString()) + { + ErrorText.Content = "Passwords do not match!"; + } + else + { + CentralAPI api = CentralAPI.Instance; + bool accountCreated = await api.Login(EmailAddressTextBox.Text, + PasswordTextBox1.Password.ToString(), true); + + if (accountCreated) + { + Switcher.Switch(new CreateOrJoin()); + } + else + { + ErrorText.Content = "An error ocurred while creating your account."; + } + } + } + } +} diff --git a/windows/WinUI/OnboardProcess/CreateOrJoin.xaml b/windows/WinUI/OnboardProcess/CreateOrJoin.xaml new file mode 100644 index 00000000..21413e84 --- /dev/null +++ b/windows/WinUI/OnboardProcess/CreateOrJoin.xaml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + diff --git a/windows/WinUI/OnboardProcess/Finished.xaml.cs b/windows/WinUI/OnboardProcess/Finished.xaml.cs new file mode 100644 index 00000000..a34abfe2 --- /dev/null +++ b/windows/WinUI/OnboardProcess/Finished.xaml.cs @@ -0,0 +1,37 @@ +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.OnboardProcess +{ + /// + /// Interaction logic for Finished.xaml + /// + public partial class Finished : UserControl, ISwitchable + { + public Finished() + { + InitializeComponent(); + } + public void UtilizeState(object state) + { + throw new NotImplementedException(); + } + + private void DoneButton_Click(object sender, RoutedEventArgs e) + { + Window.GetWindow(this).Close(); + } + } +} diff --git a/windows/WinUI/OnboardProcess/LogIn.xaml b/windows/WinUI/OnboardProcess/LogIn.xaml new file mode 100644 index 00000000..501f7e0f --- /dev/null +++ b/windows/WinUI/OnboardProcess/LogIn.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/windows/WinUI/OnboardProcess/LogIn.xaml.cs b/windows/WinUI/OnboardProcess/LogIn.xaml.cs new file mode 100644 index 00000000..8657b800 --- /dev/null +++ b/windows/WinUI/OnboardProcess/LogIn.xaml.cs @@ -0,0 +1,57 @@ +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.OnboardProcess +{ + /// + /// Interaction logic for LogIn.xaml + /// + public partial class LogIn : UserControl, ISwitchable + { + public LogIn() + { + InitializeComponent(); + } + + public void UtilizeState(object state) + { + throw new NotImplementedException(); + } + + public void LoginButton_Click(object sender, RoutedEventArgs e) + { + DoLogin(); + } + + public void BackButton_Click(object sender, RoutedEventArgs e) + { + Switcher.Switch(new RegisterOrLogIn()); + } + + private async void DoLogin() + { + CentralAPI api = CentralAPI.Instance; + bool didLogIn = await api.Login(EmailAddressTextBox.Text, PasswordTextBox.Password.ToString(), false); + if (didLogIn) + { + Switcher.Switch(new CreateOrJoin()); + } + else + { + ErrorText.Content = "Invalid username or password"; + } + } + } +} diff --git a/windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml b/windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml new file mode 100644 index 00000000..01f3ba9d --- /dev/null +++ b/windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml @@ -0,0 +1,27 @@ + + + Welcome to ZeroTier + Let's get started! + + If you haven't yet created an account, click "Create Account" below. If you have an account, you can log in with your username/password, or simply enter an API key. + + + + +