summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
Diffstat (limited to 'windows')
-rw-r--r--windows/WinUI/APIHandler.cs452
-rw-r--r--windows/WinUI/AboutView.xaml4
-rw-r--r--windows/WinUI/CentralAPI.cs2
-rw-r--r--windows/WinUI/NetworkMonitor.cs2
-rw-r--r--windows/WinUI/OnboardProcess/CreateAccount.xaml38
-rw-r--r--windows/WinUI/OnboardProcess/CreateAccount.xaml.cs66
-rw-r--r--windows/WinUI/OnboardProcess/CreateOrJoin.xaml49
-rw-r--r--windows/WinUI/OnboardProcess/CreateOrJoin.xaml.cs98
-rw-r--r--windows/WinUI/OnboardProcess/EnterToken.xaml29
-rw-r--r--windows/WinUI/OnboardProcess/EnterToken.xaml.cs57
-rw-r--r--windows/WinUI/OnboardProcess/Finished.xaml27
-rw-r--r--windows/WinUI/OnboardProcess/Finished.xaml.cs37
-rw-r--r--windows/WinUI/OnboardProcess/LogIn.xaml35
-rw-r--r--windows/WinUI/OnboardProcess/LogIn.xaml.cs57
-rw-r--r--windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml27
-rw-r--r--windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml.cs48
-rw-r--r--windows/WinUI/PageSwitcher.xaml13
-rw-r--r--windows/WinUI/PageSwitcher.xaml.cs56
-rw-r--r--windows/WinUI/Switcher.cs24
-rw-r--r--windows/WinUI/ToolbarItem.xaml.cs59
-rw-r--r--windows/WinUI/WinUI.csproj50
-rw-r--r--windows/ZeroTierOne.sln7
-rw-r--r--windows/ZeroTierOne/ZeroTierOne.vcxproj55
-rw-r--r--windows/ZeroTierOne/ZeroTierOne.vcxproj.filters13
24 files changed, 296 insertions, 1009 deletions
diff --git a/windows/WinUI/APIHandler.cs b/windows/WinUI/APIHandler.cs
index 015415c3..6a944f0f 100644
--- a/windows/WinUI/APIHandler.cs
+++ b/windows/WinUI/APIHandler.cs
@@ -12,7 +12,7 @@ using System.Windows.Threading;
namespace WinUI
{
-
+
public class APIHandler
{
@@ -58,19 +58,19 @@ namespace WinUI
String authToken = "";
Int32 port = 9993;
- if (resetToken)
- {
- instance = null;
- if (File.Exists(localZtDir + "\\authtoken.secret"))
- {
- File.Delete(localZtDir + "\\authtoken.secret");
- }
+ if (resetToken)
+ {
+ instance = null;
+ if (File.Exists(localZtDir + "\\authtoken.secret"))
+ {
+ File.Delete(localZtDir + "\\authtoken.secret");
+ }
- if (File.Exists(localZtDir + "\\zerotier-one.port"))
- {
- File.Delete(localZtDir + "\\zerotier-one.port");
- }
- }
+ if (File.Exists(localZtDir + "\\zerotier-one.port"))
+ {
+ File.Delete(localZtDir + "\\zerotier-one.port");
+ }
+ }
if (!File.Exists(localZtDir + "\\authtoken.secret") || !File.Exists(localZtDir + "\\zerotier-one.port"))
{
@@ -78,7 +78,7 @@ namespace WinUI
String curPath = System.Reflection.Assembly.GetEntryAssembly().Location;
int index = curPath.LastIndexOf("\\");
curPath = curPath.Substring(0, index);
- ProcessStartInfo startInfo = new ProcessStartInfo(curPath + "\\copyutil.exe", "\""+globalZtDir+"\"" + " " + "\""+localZtDir+"\"");
+ ProcessStartInfo startInfo = new ProcessStartInfo(curPath + "\\copyutil.exe", "\"" + globalZtDir + "\"" + " " + "\"" + localZtDir + "\"");
startInfo.Verb = "runas";
@@ -148,7 +148,7 @@ namespace WinUI
this.authtoken = authtoken;
}
-
+
public void GetStatus(StatusCallback cb)
{
@@ -162,33 +162,33 @@ namespace WinUI
try
{
var httpResponse = (HttpWebResponse)request.GetResponse();
- if (httpResponse.StatusCode == HttpStatusCode.OK)
- {
- using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
- {
- var responseText = streamReader.ReadToEnd();
+ if (httpResponse.StatusCode == HttpStatusCode.OK)
+ {
+ using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
+ {
+ var responseText = streamReader.ReadToEnd();
- ZeroTierStatus status = null;
- try
- {
- status = JsonConvert.DeserializeObject<ZeroTierStatus>(responseText);
+ ZeroTierStatus status = null;
+ try
+ {
+ status = JsonConvert.DeserializeObject<ZeroTierStatus>(responseText);
if (ZeroTierAddress != status.Address)
{
ZeroTierAddress = status.Address;
}
- }
- catch (JsonReaderException e)
- {
- Console.WriteLine(e.ToString());
- }
- cb(status);
- }
- }
- else if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
+ }
+ catch (JsonReaderException e)
+ {
+ Console.WriteLine(e.ToString());
+ }
+ cb(status);
+ }
+ }
+ else if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
}
catch (System.Net.Sockets.SocketException)
{
@@ -196,19 +196,19 @@ namespace WinUI
}
catch (System.Net.WebException e)
{
- HttpWebResponse res = (HttpWebResponse)e.Response;
- if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
- else
- {
- cb(null);
- }
+ HttpWebResponse res = (HttpWebResponse)e.Response;
+ if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
+ else
+ {
+ cb(null);
+ }
}
}
-
+
public void GetNetworks(NetworkListCallback cb)
{
@@ -226,33 +226,33 @@ namespace WinUI
{
var httpResponse = (HttpWebResponse)request.GetResponse();
- if (httpResponse.StatusCode == HttpStatusCode.OK)
- {
- using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
- {
- var responseText = streamReader.ReadToEnd();
-
- List<ZeroTierNetwork> networkList = null;
- try
- {
- networkList = JsonConvert.DeserializeObject<List<ZeroTierNetwork>>(responseText);
- foreach (ZeroTierNetwork n in networkList)
- {
- // all networks received via JSON are connected by definition
- n.IsConnected = true;
- }
- }
- catch (JsonReaderException e)
- {
- Console.WriteLine(e.ToString());
- }
- cb(networkList);
- }
- }
- else if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
+ if (httpResponse.StatusCode == HttpStatusCode.OK)
+ {
+ using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
+ {
+ var responseText = streamReader.ReadToEnd();
+
+ List<ZeroTierNetwork> networkList = null;
+ try
+ {
+ networkList = JsonConvert.DeserializeObject<List<ZeroTierNetwork>>(responseText);
+ foreach (ZeroTierNetwork n in networkList)
+ {
+ // all networks received via JSON are connected by definition
+ n.IsConnected = true;
+ }
+ }
+ catch (JsonReaderException e)
+ {
+ Console.WriteLine(e.ToString());
+ }
+ cb(networkList);
+ }
+ }
+ else if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
}
catch (System.Net.Sockets.SocketException)
{
@@ -260,137 +260,137 @@ namespace WinUI
}
catch (System.Net.WebException e)
{
- HttpWebResponse res = (HttpWebResponse)e.Response;
- if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
- else
- {
- cb(null);
- }
+ HttpWebResponse res = (HttpWebResponse)e.Response;
+ if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
+ else
+ {
+ cb(null);
+ }
}
}
public void JoinNetwork(Dispatcher d, string nwid, bool allowManaged = true, bool allowGlobal = false, bool allowDefault = false)
{
- Task.Factory.StartNew(() =>
- {
- var request = WebRequest.Create(url + "/network/" + nwid + "?auth=" + authtoken) as HttpWebRequest;
- if (request == null)
- {
- return;
- }
-
- request.Method = "POST";
- request.ContentType = "applicaiton/json";
- request.Timeout = 30000;
- try
- {
- using (var streamWriter = new StreamWriter(((HttpWebRequest)request).GetRequestStream()))
- {
- string json = "{\"allowManaged\":" + (allowManaged ? "true" : "false") + "," +
- "\"allowGlobal\":" + (allowGlobal ? "true" : "false") + "," +
- "\"allowDefault\":" + (allowDefault ? "true" : "false") + "}";
- streamWriter.Write(json);
- streamWriter.Flush();
- streamWriter.Close();
- }
- }
- catch (System.Net.WebException)
- {
- d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
- {
- MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
- }));
- return;
- }
-
- try
- {
- var httpResponse = (HttpWebResponse)request.GetResponse();
-
- if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
- else if (httpResponse.StatusCode != HttpStatusCode.OK)
- {
- Console.WriteLine("Error sending join network message");
- }
- }
- catch (System.Net.Sockets.SocketException)
- {
- d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
- {
- MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
- }));
- }
- catch (System.Net.WebException e)
- {
- HttpWebResponse res = (HttpWebResponse)e.Response;
- if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
- d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
- {
- MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
- }));
- }
- });
+ Task.Factory.StartNew(() =>
+ {
+ var request = WebRequest.Create(url + "/network/" + nwid + "?auth=" + authtoken) as HttpWebRequest;
+ if (request == null)
+ {
+ return;
+ }
+
+ request.Method = "POST";
+ request.ContentType = "applicaiton/json";
+ request.Timeout = 30000;
+ try
+ {
+ using (var streamWriter = new StreamWriter(((HttpWebRequest)request).GetRequestStream()))
+ {
+ string json = "{\"allowManaged\":" + (allowManaged ? "true" : "false") + "," +
+ "\"allowGlobal\":" + (allowGlobal ? "true" : "false") + "," +
+ "\"allowDefault\":" + (allowDefault ? "true" : "false") + "}";
+ streamWriter.Write(json);
+ streamWriter.Flush();
+ streamWriter.Close();
+ }
+ }
+ catch (System.Net.WebException)
+ {
+ d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
+ }));
+ return;
+ }
+
+ try
+ {
+ var httpResponse = (HttpWebResponse)request.GetResponse();
+
+ if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
+ else if (httpResponse.StatusCode != HttpStatusCode.OK)
+ {
+ Console.WriteLine("Error sending join network message");
+ }
+ }
+ catch (System.Net.Sockets.SocketException)
+ {
+ d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
+ }));
+ }
+ catch (System.Net.WebException e)
+ {
+ HttpWebResponse res = (HttpWebResponse)e.Response;
+ if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
+ d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ MessageBox.Show("Error Joining Network: Cannot connect to ZeroTier service.");
+ }));
+ }
+ });
}
public void LeaveNetwork(Dispatcher d, string nwid)
{
- Task.Factory.StartNew(() =>
- {
- var request = WebRequest.Create(url + "/network/" + nwid + "?auth=" + authtoken) as HttpWebRequest;
- if (request == null)
- {
- return;
- }
-
- request.Method = "DELETE";
- request.Timeout = 30000;
-
- try
- {
- var httpResponse = (HttpWebResponse)request.GetResponse();
-
- if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
- else if (httpResponse.StatusCode != HttpStatusCode.OK)
- {
- Console.WriteLine("Error sending leave network message");
- }
- }
- catch (System.Net.Sockets.SocketException)
- {
- d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
- {
- MessageBox.Show("Error Leaving Network: Cannot connect to ZeroTier service.");
- }));
- }
- catch (System.Net.WebException e)
- {
- HttpWebResponse res = (HttpWebResponse)e.Response;
- if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
- d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
- {
- MessageBox.Show("Error Leaving Network: Cannot connect to ZeroTier service.");
- }));
- }
- catch
- {
- Console.WriteLine("Error leaving network: Unknown error");
- }
- });
+ Task.Factory.StartNew(() =>
+ {
+ var request = WebRequest.Create(url + "/network/" + nwid + "?auth=" + authtoken) as HttpWebRequest;
+ if (request == null)
+ {
+ return;
+ }
+
+ request.Method = "DELETE";
+ request.Timeout = 30000;
+
+ try
+ {
+ var httpResponse = (HttpWebResponse)request.GetResponse();
+
+ if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
+ else if (httpResponse.StatusCode != HttpStatusCode.OK)
+ {
+ Console.WriteLine("Error sending leave network message");
+ }
+ }
+ catch (System.Net.Sockets.SocketException)
+ {
+ d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ MessageBox.Show("Error Leaving Network: Cannot connect to ZeroTier service.");
+ }));
+ }
+ catch (System.Net.WebException e)
+ {
+ HttpWebResponse res = (HttpWebResponse)e.Response;
+ if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
+ d.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ MessageBox.Show("Error Leaving Network: Cannot connect to ZeroTier service.");
+ }));
+ }
+ catch
+ {
+ Console.WriteLine("Error leaving network: Unknown error");
+ }
+ });
}
public delegate void PeersCallback(List<ZeroTierPeer> peers);
@@ -409,28 +409,28 @@ namespace WinUI
try
{
var httpResponse = (HttpWebResponse)request.GetResponse();
- if (httpResponse.StatusCode == HttpStatusCode.OK)
- {
- using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
- {
- var responseText = streamReader.ReadToEnd();
- //Console.WriteLine(responseText);
- List<ZeroTierPeer> peerList = null;
- try
- {
- peerList = JsonConvert.DeserializeObject<List<ZeroTierPeer>>(responseText);
- }
- catch (JsonReaderException e)
- {
- Console.WriteLine(e.ToString());
- }
- cb(peerList);
- }
- }
- else if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
+ if (httpResponse.StatusCode == HttpStatusCode.OK)
+ {
+ using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
+ {
+ var responseText = streamReader.ReadToEnd();
+ //Console.WriteLine(responseText);
+ List<ZeroTierPeer> peerList = null;
+ try
+ {
+ peerList = JsonConvert.DeserializeObject<List<ZeroTierPeer>>(responseText);
+ }
+ catch (JsonReaderException e)
+ {
+ Console.WriteLine(e.ToString());
+ }
+ cb(peerList);
+ }
+ }
+ else if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
}
catch (System.Net.Sockets.SocketException)
{
@@ -438,15 +438,15 @@ namespace WinUI
}
catch (System.Net.WebException e)
{
- HttpWebResponse res = (HttpWebResponse)e.Response;
- if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
- {
- APIHandler.initHandler(true);
- }
- else
- {
- cb(null);
- }
+ HttpWebResponse res = (HttpWebResponse)e.Response;
+ if (res != null && res.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ APIHandler.initHandler(true);
+ }
+ else
+ {
+ cb(null);
+ }
}
}
diff --git a/windows/WinUI/AboutView.xaml b/windows/WinUI/AboutView.xaml
index 118a61b1..8d715fd2 100644
--- a/windows/WinUI/AboutView.xaml
+++ b/windows/WinUI/AboutView.xaml
@@ -19,9 +19,9 @@
<Run Text="ZeroTier One"/>
</Paragraph>
<Paragraph TextAlignment="Center">
- <Run FontSize="14" Text="Version 1.2.12"/>
+ <Run FontSize="14" Text="Version 1.2.99 (1.4.0pre)"/>
<LineBreak/>
- <Run FontSize="14" Text="(c) 2011-2018 ZeroTier, Inc."/>
+ <Run FontSize="14" Text="(c) 2011-2019 ZeroTier, Inc."/>
<LineBreak/>
<Run FontSize="14" Text="www.zerotier.com"/>
</Paragraph>
diff --git a/windows/WinUI/CentralAPI.cs b/windows/WinUI/CentralAPI.cs
index 8c36f455..b0b4a267 100644
--- a/windows/WinUI/CentralAPI.cs
+++ b/windows/WinUI/CentralAPI.cs
@@ -67,7 +67,7 @@ namespace WinUI
UseCookies = true,
CookieContainer = cookieContainer
};
-
+
client = new HttpClient(clientHandler);
string centralConfigPath = CentralConfigFile();
diff --git a/windows/WinUI/NetworkMonitor.cs b/windows/WinUI/NetworkMonitor.cs
index ce722e45..927f804c 100644
--- a/windows/WinUI/NetworkMonitor.cs
+++ b/windows/WinUI/NetworkMonitor.cs
@@ -156,7 +156,7 @@ namespace WinUI
{
Console.WriteLine("Monitor Thread Exception: " + "\n" + e.StackTrace);
}
- Console.WriteLine("Monitor Thread Ended");
+ Console.WriteLine("Monitor Thread Ended");
}
public void SubscribeStatusUpdates(StatusCallback cb)
diff --git a/windows/WinUI/OnboardProcess/CreateAccount.xaml b/windows/WinUI/OnboardProcess/CreateAccount.xaml
deleted file mode 100644
index ddf50252..00000000
--- a/windows/WinUI/OnboardProcess/CreateAccount.xaml
+++ /dev/null
@@ -1,38 +0,0 @@
-<UserControl x:Class="WinUI.OnboardProcess.CreateAccount"
- 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"
- xmlns:local="clr-namespace:WinUI.OnboardProcess"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
- <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
-
- <Label Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" Margin="10">Email Address:</Label>
- <TextBox x:Name="EmailAddressTextBox" Grid.Column="1" Grid.Row="0" Width="150" Margin="10"></TextBox>
-
- <Label Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" Margin="10">Password:</Label>
- <PasswordBox x:Name="PasswordTextBox1" Grid.Column="1" Grid.Row="1" PasswordChar="*" Margin="10"/>
- <Label Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" Margin="10">Repeat Password:</Label>
- <PasswordBox x:Name="PasswordTextBox2" Grid.Column="1" Grid.Row="2" PasswordChar="*" Margin="10"/>
-
- <Button Grid.Column="1" Grid.Row="3" Click="CreateAccount_Click" Margin="10" Content="Create Account" Background="#FFFFB354" Width="90" HorizontalAlignment="Right"/>
-
- <Label x:Name="ErrorText" Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Center"></Label>
- <Label Grid.Row="5"></Label>
- <Button Grid.Column="0" Grid.Row="6" Background="#FFFFB354" Click="BackButton_Click">Go Back</Button>
- </Grid>
-</UserControl>
diff --git a/windows/WinUI/OnboardProcess/CreateAccount.xaml.cs b/windows/WinUI/OnboardProcess/CreateAccount.xaml.cs
deleted file mode 100644
index 72ba2182..00000000
--- a/windows/WinUI/OnboardProcess/CreateAccount.xaml.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-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
-{
- /// <summary>
- /// Interaction logic for CreateAccount.xaml
- /// </summary>
- 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
deleted file mode 100644
index 21413e84..00000000
--- a/windows/WinUI/OnboardProcess/CreateOrJoin.xaml
+++ /dev/null
@@ -1,49 +0,0 @@
-<UserControl x:Class="WinUI.OnboardProcess.CreateOrJoin"
- 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"
- xmlns:local="clr-namespace:WinUI.OnboardProcess"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="400">
- <Grid HorizontalAlignment="Stretch" Margin="15">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
-
- <Button Grid.Column="1" x:Name="CreateButton" Content="Create a Network" Background="#FFFFB354" Click="OnCreateButtonClick"/>
-
- <Label Grid.Column="1" Grid.Row="1" Content="Or" HorizontalAlignment="Center"/>
-
- <Label Grid.Column="1" Grid.Row="2" Content="Join a Network:" HorizontalAlignment="Center"/>
-
- <ListBox Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="3" Name="listViewDataBinding" HorizontalContentAlignment="Stretch">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid HorizontalAlignment="Stretch">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <TextBlock Grid.Column="0" Grid.Row="0" Margin="5" HorizontalAlignment="Left" Text="{Binding Id}"/>
- <TextBlock Grid.Column="1" Grid.Row="0" Margin="5" HorizontalAlignment="Center" Text="{Binding Config.Name}"/>
- <Button Grid.Column="2" Grid.Row="0" Margin="5" Content="Join" HorizontalAlignment="Right" Background="#FFFFB354" Tag="{Binding Id}" Click="OnJoinButtonClick"/>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
-</UserControl>
diff --git a/windows/WinUI/OnboardProcess/CreateOrJoin.xaml.cs b/windows/WinUI/OnboardProcess/CreateOrJoin.xaml.cs
deleted file mode 100644
index 91330540..00000000
--- a/windows/WinUI/OnboardProcess/CreateOrJoin.xaml.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-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
-{
- /// <summary>
- /// Interaction logic for CreateOrJoin.xaml
- /// </summary>
- public partial class CreateOrJoin : UserControl, ISwitchable
- {
- private List<CentralNetwork> networkList = new List<CentralNetwork>();
-
- public CreateOrJoin()
- {
- InitializeComponent();
- listViewDataBinding.ItemsSource = networkList;
-
- GetAvailableNetworks();
- }
-
- public void UtilizeState(object state)
- {
- throw new NotImplementedException();
- }
-
- private async void GetAvailableNetworks()
- {
- CentralAPI api = CentralAPI.Instance;
-
- List<CentralNetwork> networks = await api.GetNetworkList();
-
- foreach (CentralNetwork n in networks)
- {
- networkList.Add(n);
- }
-
- listViewDataBinding.Items.Refresh();
- }
-
- public void OnJoinButtonClick(object sender, RoutedEventArgs e)
- {
- Button button = sender as Button;
- string networkId = button.Tag as string;
-
- APIHandler handler = APIHandler.Instance;
-
- handler.JoinNetwork(this.Dispatcher, networkId);
-
- AuthorizeNetworkMember(networkId);
- }
-
- public void OnCreateButtonClick(object sender, RoutedEventArgs e)
- {
- CreateNewNetwork();
- }
-
- private async void CreateNewNetwork()
- {
- CentralAPI api = CentralAPI.Instance;
-
- CentralNetwork newNetwork = await api.CreateNewNetwork();
-
- APIHandler handler = APIHandler.Instance;
-
- handler.JoinNetwork(this.Dispatcher, newNetwork.Id);
-
- AuthorizeNetworkMember(newNetwork.Id);
- }
-
- private async void AuthorizeNetworkMember(string networkId)
- {
- string nodeId = APIHandler.Instance.NodeAddress();
-
- bool authorized = await CentralAPI.Instance.AuthorizeNode(nodeId, networkId);
-
- if (authorized)
- {
- Switcher.Switch(new Finished());
- }
- else
- {
-
- }
- }
- }
-}
diff --git a/windows/WinUI/OnboardProcess/EnterToken.xaml b/windows/WinUI/OnboardProcess/EnterToken.xaml
deleted file mode 100644
index 1880167d..00000000
--- a/windows/WinUI/OnboardProcess/EnterToken.xaml
+++ /dev/null
@@ -1,29 +0,0 @@
-<UserControl x:Class="WinUI.OnboardProcess.EnterToken"
- 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"
- xmlns:local="clr-namespace:WinUI.OnboardProcess"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
- <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Margin="10" TextWrapping="Wrap" HorizontalAlignment="Center" Text="Your API Token can be found or created on https://my.zerotier.com"/>
- <TextBlock Grid.Column="0" Grid.Row="1" Text="API Token:" Margin="10"/>
- <TextBox x:Name="APITokenInput" Grid.Column="1" Grid.Row="1" Margin="10"/>
-
- <Button Grid.Column="1" Grid.Row="2" Background="#FFFFB354" Content="Next" HorizontalAlignment="Right" Click="Next_Click" Margin="10"/>
- <Label Grid.Row="3"/>
- <Button Grid.Column="0" Grid.Row="4" Background="#FFFFB354" Content="Go Back" Click="BackButton_Click" />
- </Grid>
-</UserControl>
diff --git a/windows/WinUI/OnboardProcess/EnterToken.xaml.cs b/windows/WinUI/OnboardProcess/EnterToken.xaml.cs
deleted file mode 100644
index 5d2cc515..00000000
--- a/windows/WinUI/OnboardProcess/EnterToken.xaml.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-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
-{
- /// <summary>
- /// Interaction logic for EnterToken.xaml
- /// </summary>
- public partial class EnterToken : UserControl, ISwitchable
- {
- public EnterToken()
- {
- InitializeComponent();
-
- if (!string.IsNullOrEmpty(CentralAPI.Instance.Central.APIKey))
- {
- APITokenInput.Text = CentralAPI.Instance.Central.APIKey;
- }
- }
-
- public void UtilizeState(object staqte)
- {
-
- }
-
- private void Next_Click(object sender, RoutedEventArgs e)
- {
- CentralAPI api = CentralAPI.Instance;
-
- if (api.Central.APIKey != APITokenInput.Text)
- {
- CentralServer server = new CentralServer();
- server.APIKey = APITokenInput.Text;
- api.Central = server;
- }
-
- Switcher.Switch(new CreateOrJoin());
- }
-
- private void BackButton_Click(object sender, RoutedEventArgs e)
- {
- Switcher.Switch(new RegisterOrLogIn());
- }
- }
-}
diff --git a/windows/WinUI/OnboardProcess/Finished.xaml b/windows/WinUI/OnboardProcess/Finished.xaml
deleted file mode 100644
index d29f536c..00000000
--- a/windows/WinUI/OnboardProcess/Finished.xaml
+++ /dev/null
@@ -1,27 +0,0 @@
-<UserControl x:Class="WinUI.OnboardProcess.Finished"
- 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"
- xmlns:local="clr-namespace:WinUI.OnboardProcess"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
- <Grid VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
-
- <TextBlock Grid.Column="0" Grid.Row="0" Text="All Finished!" HorizontalAlignment="Center"/>
- <TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Center" Text=""/>
- <TextBlock Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="2" MaxWidth="270" HorizontalAlignment="Center" Margin="10" Text="You've now joined your first ZeroTier network. Now go to add your other machines!" TextWrapping="Wrap"/>
- <TextBlock Grid.Column="0" Grid.Row="3" HorizontalAlignment="Center" Text=""/>
- <Button Grid.Column="0" Grid.Row="4" MaxWidth="100" Click="DoneButton_Click" Background="#FFFFB354" Margin="10">Done!</Button>
- </Grid>
-</UserControl>
diff --git a/windows/WinUI/OnboardProcess/Finished.xaml.cs b/windows/WinUI/OnboardProcess/Finished.xaml.cs
deleted file mode 100644
index a34abfe2..00000000
--- a/windows/WinUI/OnboardProcess/Finished.xaml.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-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
-{
- /// <summary>
- /// Interaction logic for Finished.xaml
- /// </summary>
- 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
deleted file mode 100644
index 501f7e0f..00000000
--- a/windows/WinUI/OnboardProcess/LogIn.xaml
+++ /dev/null
@@ -1,35 +0,0 @@
-<UserControl x:Class="WinUI.OnboardProcess.LogIn"
- 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"
- xmlns:local="clr-namespace:WinUI.OnboardProcess"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
- <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
-
- <Label Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" Margin="10">Email Address:</Label>
- <TextBox x:Name="EmailAddressTextBox" Grid.Column="1" Grid.Row="0" MinWidth="150" Margin="10"></TextBox>
-
- <Label Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" Margin="10">Password:</Label>
- <PasswordBox x:Name="PasswordTextBox" Grid.Column="1" Grid.Row="1" PasswordChar="*" Margin="10"/>
-
- <Button Grid.Column="1" Grid.Row="2" Click="LoginButton_Click" Content="LogIn" Background="#FFFFB354" Width="90" Margin="10" HorizontalAlignment="Right"/>
-
- <Label x:Name="ErrorText" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center"></Label>
- <Label Grid.Row="4"></Label>
- <Button Grid.Column="0" Grid.Row="5" Background="#FFFFB354" Click="BackButton_Click">Go Back</Button>
- </Grid>
-</UserControl>
diff --git a/windows/WinUI/OnboardProcess/LogIn.xaml.cs b/windows/WinUI/OnboardProcess/LogIn.xaml.cs
deleted file mode 100644
index 8657b800..00000000
--- a/windows/WinUI/OnboardProcess/LogIn.xaml.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-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
-{
- /// <summary>
- /// Interaction logic for LogIn.xaml
- /// </summary>
- 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
deleted file mode 100644
index 01f3ba9d..00000000
--- a/windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml
+++ /dev/null
@@ -1,27 +0,0 @@
-<UserControl x:Class="WinUI.OnboardProcess.RegisterOrLogIn"
- 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"
- xmlns:local="clr-namespace:WinUI.OnboardProcess"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
- <StackPanel>
- <TextBlock HorizontalAlignment="Center" FontSize="20" FontWeight="Bold" FontFamily="Segoe UI">Welcome to ZeroTier</TextBlock>
- <TextBlock HorizontalAlignment="Center" FontSize="16">Let's get started!</TextBlock>
- <TextBlock HorizontalAlignment="Center"> </TextBlock>
- <TextBlock HorizontalAlignment="Center" TextWrapping="Wrap">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.</TextBlock>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
- <StackPanel.Resources>
- <Style TargetType="{x:Type Button}">
- <Setter Property="Margin" Value="10,10,0,0"/>
- </Style>
- </StackPanel.Resources>
- <Button x:Name="CreateAccountButton" Margin="10,5" Content="Create Account" Background="#FFFFB354" Click="CreateAccountButton_Click"/>
-
- <Button x:Name="LogInButton" Margin="10,5" Content="Log In" Background="#FFFFB354" Click="LogInButton_Click"/>
-
- <Button x:Name="TokenButton" Margin="10,5" Content="API Token" Background="#FFFFB354" Click="APIToken_Click"/>
- </StackPanel>
- </StackPanel>
-</UserControl>
diff --git a/windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml.cs b/windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml.cs
deleted file mode 100644
index 19c578dd..00000000
--- a/windows/WinUI/OnboardProcess/RegisterOrLogIn.xaml.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-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
-{
- /// <summary>
- /// Interaction logic for RegisterOrLogIn.xaml
- /// </summary>
- public partial class RegisterOrLogIn : UserControl, ISwitchable
- {
- public RegisterOrLogIn()
- {
- InitializeComponent();
- }
-
- public void UtilizeState(object state)
- {
- throw new NotImplementedException();
- }
-
- public void CreateAccountButton_Click(object sender, System.Windows.RoutedEventArgs e)
- {
- Switcher.Switch(new CreateAccount());
- }
-
- private void LogInButton_Click(object sender, RoutedEventArgs e)
- {
- Switcher.Switch(new LogIn());
- }
-
- public void APIToken_Click(object sender, RoutedEventArgs e)
- {
- Switcher.Switch(new EnterToken());
- }
- }
-}
diff --git a/windows/WinUI/PageSwitcher.xaml b/windows/WinUI/PageSwitcher.xaml
deleted file mode 100644
index 2e463e7a..00000000
--- a/windows/WinUI/PageSwitcher.xaml
+++ /dev/null
@@ -1,13 +0,0 @@
-<Window x:Class="WinUI.PageSwitcher"
- 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"
- Icon="ZeroTierIcon.ico"
- Title="ZeroTier One" Height="300" Width="400">
- <Grid>
-
- </Grid>
-</Window>
diff --git a/windows/WinUI/PageSwitcher.xaml.cs b/windows/WinUI/PageSwitcher.xaml.cs
deleted file mode 100644
index c9aa659f..00000000
--- a/windows/WinUI/PageSwitcher.xaml.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-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 PageSwitcher.xaml
- /// </summary>
- public partial class PageSwitcher : Window
- {
- public PageSwitcher()
- {
- InitializeComponent();
- Switcher.pageSwitcher = this;
-
- CentralAPI api = CentralAPI.Instance;
-
- if (api.HasAccessToken())
- {
- Switcher.Switch(new OnboardProcess.CreateOrJoin());
- }
- else
- {
- Switcher.Switch(new OnboardProcess.RegisterOrLogIn());
- }
- }
-
- public void Navigate(UserControl nextPage)
- {
- this.Content = nextPage;
- }
-
- public void Navigate(UserControl nextPage, object state)
- {
- this.Content = nextPage;
- ISwitchable s = nextPage as ISwitchable;
-
- if (s != null)
- s.UtilizeState(state);
- else
- throw new ArgumentException("NextPage is not ISwitchable! "
- + nextPage.Name.ToString());
- }
- }
-}
diff --git a/windows/WinUI/Switcher.cs b/windows/WinUI/Switcher.cs
deleted file mode 100644
index f48835df..00000000
--- a/windows/WinUI/Switcher.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows.Controls;
-using System.Threading.Tasks;
-
-namespace WinUI
-{
- public static class Switcher
- {
- public static PageSwitcher pageSwitcher;
-
- public static void Switch(UserControl newPage)
- {
- pageSwitcher.Navigate(newPage);
- }
-
- public static void Switch(UserControl newPage, object state)
- {
- pageSwitcher.Navigate(newPage, state);
- }
- }
-}
diff --git a/windows/WinUI/ToolbarItem.xaml.cs b/windows/WinUI/ToolbarItem.xaml.cs
index 2a0d717b..e38f9802 100644
--- a/windows/WinUI/ToolbarItem.xaml.cs
+++ b/windows/WinUI/ToolbarItem.xaml.cs
@@ -45,10 +45,6 @@ namespace WinUI
private ObservableCollection<MenuItem> _networkCollection = new ObservableCollection<MenuItem>();
- private static Boolean shouldShowOnboardProcess = true;
-#if DEBUG
- private static bool isFirstRun = true;
-#endif
public ObservableCollection<MenuItem> NetworkCollection
{
@@ -85,23 +81,6 @@ namespace WinUI
{
if (networks != null)
{
- if (networks.Count > 0)
- {
-#if DEBUG
- if (isFirstRun)
- {
- shouldShowOnboardProcess = true;
- isFirstRun = false;
- }
- else
- {
- shouldShowOnboardProcess = false;
- }
-#else
- shouldShowOnboardProcess = false;
-#endif
- }
-
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
{
NetworkCollection.Clear();
@@ -116,25 +95,9 @@ namespace WinUI
NetworkCollection.Add(item);
}
}));
-
- if (shouldShowOnboardProcess)
- {
- // TODO: Show onboarding process window (on main thread
- showOnboardProcess();
-
- shouldShowOnboardProcess = false;
- }
}
}
- private void showOnboardProcess()
- {
- Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
- {
- PageSwitcher ps = new PageSwitcher();
- ps.Show();
- }));
- }
private void updateStatus(ZeroTierStatus status)
{
if (status != null)
@@ -144,16 +107,16 @@ namespace WinUI
nodeIdMenuItem.Header = "Node ID: " + status.Address;
nodeIdMenuItem.IsEnabled = true;
nodeId = status.Address;
- }));
- }
- if (CentralAPI.Instance.HasAccessToken())
- {
- newNetworkItem.IsEnabled = true;
- }
- else
- {
- newNetworkItem.IsEnabled = false;
+ if (CentralAPI.Instance.HasAccessToken())
+ {
+ newNetworkItem.IsEnabled = true;
+ }
+ else
+ {
+ newNetworkItem.IsEnabled = false;
+ }
+ }));
}
}
@@ -356,10 +319,6 @@ namespace WinUI
string nodeId = APIHandler.Instance.NodeAddress();
bool authorized = await CentralAPI.Instance.AuthorizeNode(nodeId, newNetwork.Id);
- }
- else
- {
- showOnboardProcess();
}
}
diff --git a/windows/WinUI/WinUI.csproj b/windows/WinUI/WinUI.csproj
index 6bbc1cd7..7a2a1e2b 100644
--- a/windows/WinUI/WinUI.csproj
+++ b/windows/WinUI/WinUI.csproj
@@ -121,34 +121,12 @@
<Compile Include="NetworksPage.xaml.cs">
<DependentUpon>NetworksPage.xaml</DependentUpon>
</Compile>
- <Compile Include="OnboardProcess\CreateAccount.xaml.cs">
- <DependentUpon>CreateAccount.xaml</DependentUpon>
- </Compile>
- <Compile Include="OnboardProcess\CreateOrJoin.xaml.cs">
- <DependentUpon>CreateOrJoin.xaml</DependentUpon>
- </Compile>
- <Compile Include="OnboardProcess\EnterToken.xaml.cs">
- <DependentUpon>EnterToken.xaml</DependentUpon>
- </Compile>
- <Compile Include="OnboardProcess\Finished.xaml.cs">
- <DependentUpon>Finished.xaml</DependentUpon>
- </Compile>
- <Compile Include="OnboardProcess\LogIn.xaml.cs">
- <DependentUpon>LogIn.xaml</DependentUpon>
- </Compile>
- <Compile Include="OnboardProcess\RegisterOrLogIn.xaml.cs">
- <DependentUpon>RegisterOrLogIn.xaml</DependentUpon>
- </Compile>
- <Compile Include="PageSwitcher.xaml.cs">
- <DependentUpon>PageSwitcher.xaml</DependentUpon>
- </Compile>
<Compile Include="PeersPage.xaml.cs">
<DependentUpon>PeersPage.xaml</DependentUpon>
</Compile>
<Compile Include="PreferencesView.xaml.cs">
<DependentUpon>PreferencesView.xaml</DependentUpon>
</Compile>
- <Compile Include="Switcher.cs" />
<Compile Include="ToolbarItem.xaml.cs">
<DependentUpon>ToolbarItem.xaml</DependentUpon>
</Compile>
@@ -185,34 +163,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
- <Page Include="OnboardProcess\CreateAccount.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="OnboardProcess\CreateOrJoin.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="OnboardProcess\EnterToken.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="OnboardProcess\Finished.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="OnboardProcess\LogIn.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="OnboardProcess\RegisterOrLogIn.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="PageSwitcher.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
<Page Include="PeersPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/windows/ZeroTierOne.sln b/windows/ZeroTierOne.sln
index 05f498fb..76d579a8 100644
--- a/windows/ZeroTierOne.sln
+++ b/windows/ZeroTierOne.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.28010.2050
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroTierOne", "ZeroTierOne\ZeroTierOne.vcxproj", "{B00A4957-5977-4AC1-9EF4-571DC27EADA2}"
EndProject
@@ -460,4 +460,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AD00A172-C020-4874-B00A-C396AAC893FC}
+ EndGlobalSection
EndGlobal
diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj b/windows/ZeroTierOne/ZeroTierOne.vcxproj
index 29f08874..3f6397ca 100644
--- a/windows/ZeroTierOne/ZeroTierOne.vcxproj
+++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@@ -30,7 +30,8 @@
<ClCompile Include="..\..\controller\DB.cpp" />
<ClCompile Include="..\..\controller\EmbeddedNetworkController.cpp" />
<ClCompile Include="..\..\controller\FileDB.cpp" />
- <ClCompile Include="..\..\controller\RethinkDB.cpp" />
+ <ClCompile Include="..\..\controller\PostgreSQL.cpp" />
+ <ClCompile Include="..\..\controller\RabbitMQ.cpp" />
<ClCompile Include="..\..\ext\http-parser\http_parser.c" />
<ClCompile Include="..\..\ext\libnatpmp\getgateway.c" />
<ClCompile Include="..\..\ext\libnatpmp\natpmp.c" />
@@ -115,7 +116,8 @@
<ClInclude Include="..\..\controller\DB.hpp" />
<ClInclude Include="..\..\controller\EmbeddedNetworkController.hpp" />
<ClInclude Include="..\..\controller\FileDB.hpp" />
- <ClInclude Include="..\..\controller\RethinkDB.hpp" />
+ <ClInclude Include="..\..\controller\PostgreSQL.hpp" />
+ <ClInclude Include="..\..\controller\RabbitMQ.hpp" />
<ClInclude Include="..\..\ext\http-parser\http_parser.h" />
<ClInclude Include="..\..\ext\json\json.hpp" />
<ClInclude Include="..\..\ext\libnatpmp\getgateway.h" />
@@ -153,6 +155,7 @@
<ClInclude Include="..\..\node\IncomingPacket.hpp" />
<ClInclude Include="..\..\node\InetAddress.hpp" />
<ClInclude Include="..\..\node\MAC.hpp" />
+ <ClInclude Include="..\..\node\Membership.hpp" />
<ClInclude Include="..\..\node\Multicaster.hpp" />
<ClInclude Include="..\..\node\MulticastGroup.hpp" />
<ClInclude Include="..\..\node\Mutex.hpp" />
@@ -197,45 +200,48 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{B00A4957-5977-4AC1-9EF4-571DC27EADA2}</ProjectGuid>
<RootNamespace>ZeroTierOne</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
+ <PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
+ <PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
+ <PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
+ <PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
+ <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
+ <UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
+ <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
+ <UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -298,6 +304,9 @@
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_TRACE;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpp14</LanguageStandard>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -314,6 +323,8 @@
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_TRACE;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpp14</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -329,8 +340,10 @@
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_TRACE;ZT_RULES_ENGINE_DEBUGGING;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MultiProcessorCompilation>false</MultiProcessorCompilation>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpp14</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -349,6 +362,8 @@
<PreprocessorDefinitions>ZT_EXPORT;FD_SETSIZE=1024;NOMINMAX;STATICLIB;WIN32;ZT_USE_MINIUPNPC;MINIUPNP_STATICLIB;ZT_SOFTWARE_UPDATE_DEFAULT="disable";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpp14</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -359,7 +374,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level2</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
@@ -375,9 +390,15 @@
<OmitFramePointers>true</OmitFramePointers>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<ControlFlowGuard>Guard</ControlFlowGuard>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpp14</LanguageStandard>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ <CompileAsManaged>false</CompileAsManaged>
+ <CompileAsWinRT>false</CompileAsWinRT>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -386,7 +407,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level2</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
@@ -404,9 +425,15 @@
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnableParallelCodeGeneration>false</EnableParallelCodeGeneration>
<CallingConvention>VectorCall</CallingConvention>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpp14</LanguageStandard>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ <CompileAsManaged>false</CompileAsManaged>
+ <CompileAsWinRT>false</CompileAsWinRT>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>wsock32.lib;ws2_32.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters
index d07c0638..1fcf7b69 100644
--- a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters
+++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters
@@ -258,7 +258,10 @@
<ClCompile Include="..\..\controller\FileDB.cpp">
<Filter>Source Files\controller</Filter>
</ClCompile>
- <ClCompile Include="..\..\controller\RethinkDB.cpp">
+ <ClCompile Include="..\..\controller\PostgreSQL.cpp">
+ <Filter>Source Files\controller</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\controller\RabbitMQ.cpp">
<Filter>Source Files\controller</Filter>
</ClCompile>
</ItemGroup>
@@ -494,7 +497,13 @@
<ClInclude Include="..\..\controller\FileDB.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
- <ClInclude Include="..\..\controller\RethinkDB.hpp">
+ <ClInclude Include="..\..\node\Membership.hpp">
+ <Filter>Header Files\node</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\controller\PostgreSQL.hpp">
+ <Filter>Header Files\controller</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\controller\RabbitMQ.hpp">
<Filter>Header Files\controller</Filter>
</ClInclude>
</ItemGroup>