From c666f92e359061c0a4c133ba090832a059298782 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Fri, 22 Sep 2017 15:33:09 -0700 Subject: new startup process UI for Windows --- windows/WinUI/OnboardProcess/CreateAccount.xaml | 38 +++++++++ windows/WinUI/OnboardProcess/CreateAccount.xaml.cs | 66 +++++++++++++++ windows/WinUI/OnboardProcess/CreateOrJoin.xaml | 49 +++++++++++ windows/WinUI/OnboardProcess/CreateOrJoin.xaml.cs | 98 ++++++++++++++++++++++ windows/WinUI/OnboardProcess/EnterToken.xaml | 29 +++++++ windows/WinUI/OnboardProcess/EnterToken.xaml.cs | 57 +++++++++++++ windows/WinUI/OnboardProcess/Finished.xaml | 27 ++++++ windows/WinUI/OnboardProcess/Finished.xaml.cs | 37 ++++++++ windows/WinUI/OnboardProcess/LogIn.xaml | 35 ++++++++ windows/WinUI/OnboardProcess/LogIn.xaml.cs | 57 +++++++++++++ windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml | 27 ++++++ .../WinUI/OnboardProcess/RegisterOrLogIn.xaml.cs | 48 +++++++++++ 12 files changed, 568 insertions(+) create mode 100644 windows/WinUI/OnboardProcess/CreateAccount.xaml create mode 100644 windows/WinUI/OnboardProcess/CreateAccount.xaml.cs create mode 100644 windows/WinUI/OnboardProcess/CreateOrJoin.xaml create mode 100644 windows/WinUI/OnboardProcess/CreateOrJoin.xaml.cs create mode 100644 windows/WinUI/OnboardProcess/EnterToken.xaml create mode 100644 windows/WinUI/OnboardProcess/EnterToken.xaml.cs create mode 100644 windows/WinUI/OnboardProcess/Finished.xaml create mode 100644 windows/WinUI/OnboardProcess/Finished.xaml.cs create mode 100644 windows/WinUI/OnboardProcess/LogIn.xaml create mode 100644 windows/WinUI/OnboardProcess/LogIn.xaml.cs create mode 100644 windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml create mode 100644 windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml.cs (limited to 'windows/WinUI/OnboardProcess') diff --git a/windows/WinUI/OnboardProcess/CreateAccount.xaml b/windows/WinUI/OnboardProcess/CreateAccount.xaml new file mode 100644 index 00000000..ddf50252 --- /dev/null +++ b/windows/WinUI/OnboardProcess/CreateAccount.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 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. + + + + +