diff options
author | Grant Limberg <grant.limberg@zerotier.com> | 2017-08-09 14:19:37 -0700 |
---|---|---|
committer | Grant Limberg <grant.limberg@zerotier.com> | 2017-08-09 14:19:37 -0700 |
commit | 6842490c1feb572936d8b3893f6d3d07e289a878 (patch) | |
tree | 9bbd6f53424779787ae9dbd6f40a853fa39871d3 /windows | |
parent | ff5e22031aa005d4bcb0839797ac4044f6992e50 (diff) | |
download | infinitytier-6842490c1feb572936d8b3893f6d3d07e289a878.tar.gz infinitytier-6842490c1feb572936d8b3893f6d3d07e289a878.zip |
Add menu option to open ZeroTier Central in the system default browser
Diffstat (limited to 'windows')
-rw-r--r-- | windows/WinUI/ToolbarItem.xaml | 3 | ||||
-rw-r--r-- | windows/WinUI/ToolbarItem.xaml.cs | 27 |
2 files changed, 26 insertions, 4 deletions
diff --git a/windows/WinUI/ToolbarItem.xaml b/windows/WinUI/ToolbarItem.xaml index 3b064fc4..85e4122a 100644 --- a/windows/WinUI/ToolbarItem.xaml +++ b/windows/WinUI/ToolbarItem.xaml @@ -41,6 +41,9 @@ </CollectionContainer> <Separator/> + <MenuItem Header="ZeroTier Central" + Click="ToolbarItem_CentralClicked"/> + <MenuItem Header="About..." Click="ToolbarItem_AboutClicked"/> <MenuItem Header="Preferences..." diff --git a/windows/WinUI/ToolbarItem.xaml.cs b/windows/WinUI/ToolbarItem.xaml.cs index 9da9fcdf..432a7aa1 100644 --- a/windows/WinUI/ToolbarItem.xaml.cs +++ b/windows/WinUI/ToolbarItem.xaml.cs @@ -44,6 +44,8 @@ namespace WinUI private ObservableCollection<MenuItem> _networkCollection = new ObservableCollection<MenuItem>(); + private static Boolean shouldShowOnboardProcess = true; + public ObservableCollection<MenuItem> NetworkCollection { get { return _networkCollection; } @@ -79,7 +81,12 @@ namespace WinUI { if (networks != null) { - this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => + if (networks.Count > 0) + { + shouldShowOnboardProcess = false; + } + + Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { NetworkCollection.Clear(); foreach (ZeroTierNetwork n in networks) @@ -93,6 +100,13 @@ namespace WinUI NetworkCollection.Add(item); } })); + + if (shouldShowOnboardProcess) + { + // TODO: Show onboarding process window (on main thread) + + shouldShowOnboardProcess = false; + } } } @@ -194,6 +208,11 @@ namespace WinUI joinNetView = null; } + private void ToolbarItem_CentralClicked(object sender, System.EventArgs e) + { + Process.Start("https://my.zerotier.com"); + } + private void ToolbarItem_AboutClicked(object sender, System.EventArgs e) { if (aboutView == null) @@ -267,7 +286,7 @@ namespace WinUI private void ToolbarItem_QuitClicked(object sender, System.EventArgs e) { NetworkMonitor.Instance.StopMonitor(); - this.Close(); + Close(); Application.Current.Shutdown(); } @@ -281,11 +300,11 @@ namespace WinUI ZeroTierNetwork network = item.DataContext as ZeroTierNetwork; if (item.IsChecked) { - APIHandler.Instance.LeaveNetwork(this.Dispatcher, network.NetworkId); + APIHandler.Instance.LeaveNetwork(Dispatcher, network.NetworkId); } else { - APIHandler.Instance.JoinNetwork(this.Dispatcher, network.NetworkId, network.AllowManaged, network.AllowGlobal, network.AllowDefault); + APIHandler.Instance.JoinNetwork(Dispatcher, network.NetworkId, network.AllowManaged, network.AllowGlobal, network.AllowDefault); } } } |