merge master with all the updates in

This commit is contained in:
ziti-ci
2020-07-08 14:49:57 -04:00
99 changed files with 529 additions and 61 deletions
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
+105
View File
@@ -0,0 +1,105 @@
<Application x:Class="ZitiDesktopEdge.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ZitiDesktopEdge"
ShutdownMode="OnExplicitShutdown"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style TargetType="FrameworkElement" x:Key="VisibleAnimation">
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="Opacity" Value="0"/>
<Style.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.0" To="1.0" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
<!--Scrollbar Thumbs-->
<Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Grid x:Name="Grid">
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent" />
<Border x:Name="Rectangle1" CornerRadius="10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Tag" Value="Horizontal">
<Setter TargetName="Rectangle1" Property="Width" Value="Auto" />
<Setter TargetName="Rectangle1" Property="Height" Value="7" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--ScrollBars-->
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsFlicksEnabled" Value="true" />
<Setter Property="Foreground" Value="LightGray" />
<Setter Property="Background" Value="#000F0F23" />
<Setter Property="Width" Value="3" />
<Setter Property="Opacity" Value="0.6"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid x:Name="GridRoot" Width="6" Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="0.00001*" />
</Grid.RowDefinitions>
<Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="true" Focusable="false">
<Track.Thumb>
<Thumb x:Name="Thumb" Background="{TemplateBinding Foreground}" Style="{DynamicResource ScrollThumbs}" />
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton x:Name="PageUp" Command="ScrollBar.PageDownCommand" Opacity="0" Focusable="false" />
</Track.IncreaseRepeatButton>
<Track.DecreaseRepeatButton>
<RepeatButton x:Name="PageDown" Command="ScrollBar.PageUpCommand" Opacity="0" Focusable="false" />
</Track.DecreaseRepeatButton>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger SourceName="Thumb" Property="IsMouseOver" Value="true">
<Setter Value="{DynamicResource ButtonSelectBrush}" TargetName="Thumb" Property="Background" />
</Trigger>
<Trigger SourceName="Thumb" Property="IsDragging" Value="true">
<Setter Value="{DynamicResource DarkBrush}" TargetName="Thumb" Property="Background" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="Thumb" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="Orientation" Value="Horizontal">
<Setter TargetName="GridRoot" Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90" />
</Setter.Value>
</Setter>
<Setter TargetName="PART_Track" Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90" />
</Setter.Value>
</Setter>
<Setter Property="Width" Value="3" />
<Setter Property="Height" Value="12" />
<Setter TargetName="Thumb" Property="Tag" Value="Horizontal" />
<Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand" />
<Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Application.Resources>
</Application>
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace ZitiDesktopEdge {
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App:Application {
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

+12
View File
@@ -0,0 +1,12 @@
<UserControl x:Class="ZitiDesktopEdge.ControllerScreen"
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:ZitiDesktopEdge"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>
+25
View File
@@ -0,0 +1,25 @@
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 ZitiDesktopEdge {
/// <summary>
/// Interaction logic for ControllerScreen.xaml
/// </summary>
public partial class ControllerScreen:UserControl {
public ControllerScreen() {
InitializeComponent();
}
}
}
+55
View File
@@ -0,0 +1,55 @@
<UserControl x:Class="ZitiDesktopEdge.IdentityDetails"
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:ZitiDesktopEdge"
mc:Ignorable="d"
x:Name="IdentityArea"
d:DesignHeight="500" d:DesignWidth="350">
<Grid>
<Canvas>
<Rectangle Name="Arrow" HorizontalAlignment="Center" Height="20" Fill="White" Width="20" Canvas.Left="165" ClipToBounds="True" Canvas.Bottom="-10">
<Rectangle.LayoutTransform>
<RotateTransform Angle="-45"/>
</Rectangle.LayoutTransform>
</Rectangle>
</Canvas>
<Rectangle Fill="White" RadiusY="10" RadiusX="10"></Rectangle>
<Grid Margin="10,10,10,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Vertical" HorizontalAlignment="Stretch" Margin="10,10,10,10">
<Grid Margin="0,0,0,20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="70"/>
</Grid.ColumnDefinitions>
<local:Toggler x:Name="IdDetailToggle" Grid.Column="0" HorizontalAlignment="Left" OnToggled="IdToggle"></local:Toggler>
<Label Name="IdDetailName" Grid.Column="1" HorizontalAlignment="Center" MaxWidth="160" FontSize="14" FontWeight="SemiBold" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="#0F0F23">
<TextBlock TextTrimming="CharacterEllipsis">Identity Name</TextBlock>
</Label>
<Image Grid.Column="2" Cursor="Hand" Source="/Assets/Images/x.png" Width="20" Height="20" Margin="0,0,0,0" HorizontalAlignment="Right" MouseDown="HideMenu"></Image>
</Grid>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
<Grid>
<ScrollViewer Name="MainDetailScroll" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<StackPanel>
<local:MenuEditItem x:Name="IdentityName" HorizontalAlignment="Stretch" Label="Name" IsLocked="True"></local:MenuEditItem>
<local:MenuEditItem x:Name="IdentityNetwork" HorizontalAlignment="Stretch" Label="Network" IsLocked="True"></local:MenuEditItem>
<local:MenuEditItem x:Name="IdentityStatus" HorizontalAlignment="Stretch" Label="Status" IsLocked="True"></local:MenuEditItem>
<local:MenuEditItem x:Name="IdentityEnrollment" HorizontalAlignment="Stretch" Label="Enrollment Status" IsLocked="True"></local:MenuEditItem>
<Label Content="SERVICES" Foreground="Gray" FontWeight="SemiBold" />
<StackPanel Name="ServiceList" Orientation="Vertical"></StackPanel>
<Label Name="ForgetIdentityButton" Margin="0,10,0,10" Content="Forget This Identity" Cursor="Hand" Foreground="#F4044D" HorizontalAlignment="Center" Mouse.MouseDown="ForgetIdentity"></Label>
<Image Source="/Assets/Images/identity.png" Height="160" Width="160" HorizontalAlignment="Stretch"></Image>
</StackPanel>
</ScrollViewer>
</Grid>
</StackPanel>
</Grid>
</Grid>
</UserControl>
+132
View File
@@ -0,0 +1,132 @@
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;
using ZitiDesktopEdge.Models;
namespace ZitiDesktopEdge {
/// <summary>
/// Interaction logic for IdentityDetails.xaml
/// </summary>
public partial class IdentityDetails:UserControl {
private bool _isAttached = true;
public delegate void Forgot(ZitiIdentity forgotten);
public event Forgot OnForgot;
public delegate void ErrorOccurred(string message);
public event ErrorOccurred OnError;
private List<ZitiIdentity> identities {
get {
return (List<ZitiIdentity>)Application.Current.Properties["Identities"];
}
}
private ZitiIdentity _identity;
public ZitiIdentity Identity {
get {
return _identity;
}
set {
_identity = value;
this.IdDetailToggle.Enabled = _identity.IsEnabled;
UpdateView();
IdentityArea.Opacity = 1.0;
IdentityArea.Visibility = Visibility.Visible;
this.Visibility = Visibility.Visible;
}
}
public IdentityItem SelectedIdentity { get; set; }
public bool IsAttached {
get {
return _isAttached;
}
set {
_isAttached = value;
if (_isAttached) Arrow.Visibility = Visibility.Visible;
else Arrow.Visibility = Visibility.Collapsed;
}
}
public void UpdateView() {
IdDetailName.Content = _identity.Name;
IdDetailToggle.Enabled = _identity.IsEnabled;
IdentityName.Value = _identity.Name;
IdentityNetwork.Value = _identity.ControllerUrl;
IdentityEnrollment.Value = _identity.Status;
IdentityStatus.Value = _identity.IsEnabled ? "active" : "disabled";
ServiceList.Children.Clear();
for (int i=0; i<_identity.Services.Count; i++) {
ServiceInfo editor = new ServiceInfo();
editor.Label = _identity.Services[i].Name;
editor.Value = _identity.Services[i].Url;
editor.IsLocked = true;
ServiceList.Children.Add(editor);
}
}
private void IdToggle(bool on) {
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
client.IdentityOnOff(_identity.Fingerprint, on);
SelectedIdentity.ToggleSwitch.Enabled = on;
_identity.IsEnabled = on;
IdentityStatus.Value = _identity.IsEnabled ? "active" : "disabled";
}
public IdentityDetails() {
InitializeComponent();
}
private void HideMenu(object sender, MouseButtonEventArgs e) {
this.Visibility = Visibility.Collapsed;
}
public void SetHeight(double height) {
MainDetailScroll.Height = height;
}
private void ForgetIdentity(object sender, MouseButtonEventArgs e) {
// Jeremy - this works now as long as you pass a fingerprint that's valid!
UIModel.HideOnLostFocus = false;
MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure you want to forget this identity?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);
UIModel.HideOnLostFocus = true;
if (messageBoxResult == MessageBoxResult.Yes) {
this.Visibility = Visibility.Collapsed;
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
try {
client.RemoveIdentity(_identity.Fingerprint);
ZitiIdentity forgotten = new ZitiIdentity();
foreach (var id in identities) {
if (id.Fingerprint == _identity.Fingerprint) {
forgotten = id;
identities.Remove(id);
break;
}
}
if (OnForgot != null) {
OnForgot(forgotten);
}
} catch (ServiceClient.ServiceException se) {
OnError(se.Message);
} catch (Exception ex) {
OnError(ex.Message);
}
}
}
}
}
+44
View File
@@ -0,0 +1,44 @@
<UserControl x:Class="ZitiDesktopEdge.IdentityItem"
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:ZitiDesktopEdge"
mc:Ignorable="d"
d:DesignHeight="60" d:DesignWidth="375" Height="60">
<Canvas MouseEnter="Canvas_MouseEnter" MouseLeave="Canvas_MouseLeave">
<Rectangle Fill="#0F0C28" HorizontalAlignment="Left" Stroke="Black" VerticalAlignment="Top" ClipToBounds="True"></Rectangle>
<Rectangle Name="OverState" Fill="#FFFFFF" Height="60" Width="375" Opacity="0" ClipToBounds="True"></Rectangle>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<local:Toggler x:Name="ToggleSwitch" Grid.Column="0" Grid.Row="0" Margin="0,10,0,0"></local:Toggler>
<Label Name="ToggleStatus" Grid.Column="0" Grid.Row="1" Margin="0,-5,0,0" Content="Enabled" Foreground="White" FontSize="11" Typography.Capitals="AllSmallCaps" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Label>
<Label Name="IdName" MouseDown="OpenDetails" MaxWidth="180" Grid.Column="1" Margin="0,6,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" FontSize="18" Foreground="White" HorizontalAlignment="Left">
<TextBlock TextTrimming="CharacterEllipsis">Identity Name</TextBlock>
</Label>
<Label Name="IdUrl" MouseDown="OpenDetails" MaxWidth="180" MinWidth="180" Grid.Column="1" Grid.Row="1" FontSize="11" Margin="0,-5,0,0" Typography.Capitals="AllSmallCaps" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="White" HorizontalAlignment="Left">
<TextBlock TextTrimming="CharacterEllipsis">https://serverUrlThisShouldTrimIfItsLong:8080</TextBlock>
</Label>
<Canvas Grid.Column="2" Grid.Row="0" Width="50" Height="40" MouseDown="OpenDetails">
<Border Width="44" Height="26" Background="#0068F9" CornerRadius="12" Canvas.Top="10" Canvas.Left="3"></Border>
<Label Name="ServiceCount" Width="50" Height="26" Canvas.Top="9" Padding="0,0,0,0" FontSize="17" Content="23" Foreground="White" HorizontalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
</Canvas>
<Label Grid.Column="3" MouseDown="OpenDetails" Grid.Row="1" Margin="0,-5,0,0" Content="Services" Foreground="White" FontSize="11" HorizontalAlignment="Stretch" Typography.Capitals="AllSmallCaps" HorizontalContentAlignment="Center"></Label>
</Grid>
<Image Grid.Column="1" Source="/Assets/Images/next.png" Width="12" MouseDown="OpenDetails"></Image>
</Grid>
</Canvas>
</UserControl>
+87
View File
@@ -0,0 +1,87 @@
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;
using ZitiDesktopEdge.Models;
namespace ZitiDesktopEdge {
/// <summary>
/// User Control to list Identities and give status
/// </summary>
public partial class IdentityItem:UserControl {
public ZitiIdentity _identity;
public ZitiIdentity Identity {
get {
return _identity;
}
set {
_identity = value;
this.RefreshUI();
}
}
public void RefreshUI () {
ToggleSwitch.Enabled = _identity.IsEnabled;
IdName.Content = _identity.Name;
IdUrl.Content = _identity.ControllerUrl;
ServiceCount.Content = _identity.Services.Count.ToString();
if (ToggleSwitch.Enabled) {
ToggleStatus.Content = "ENABLED";
} else {
ToggleStatus.Content = "DISABLED";
}
}
public IdentityItem() {
InitializeComponent();
ToggleSwitch.OnToggled += ToggleIdentity;
}
private void ToggleIdentity(bool on) {
// Jeremy - make the messagebox pretty or something
try
{
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
ServiceClient.Identity id = client.IdentityOnOff(_identity.Fingerprint, on);
if (on) {
ToggleStatus.Content = "ENABLED";
// MessageBox.Show("jeremy - update the identity and services here. When disabled there will be services returned. service count: " + id?.Services?.Count());
} else {
ToggleStatus.Content = "DISABLED";
// MessageBox.Show("jeremy - update the identity and services here. When disabled there will be no services, service count: " + id?.Services?.Count());
}
} catch(ServiceClient.ServiceException se) {
MessageBox.Show("Unexpected error 5 the toggle needs to be rolled back!!! jeremy!", se.Message);
MessageBox.Show(se.AdditionalInfo, se.Message);
} catch (Exception ex) {
MessageBox.Show("Unexpected error 5 the toggle needs to be rolled back!!! jeremy!", ex.Message);
}
}
private void Canvas_MouseEnter(object sender, MouseEventArgs e) {
OverState.Opacity = 0.2;
}
private void Canvas_MouseLeave(object sender, MouseEventArgs e) {
OverState.Opacity = 0;
}
private void OpenDetails(object sender, MouseButtonEventArgs e) {
IdentityDetails deets = ((MainWindow)Application.Current.MainWindow).IdentityMenu;
deets.SelectedIdentity = this;
deets.Identity = this.Identity;
this.ToggleSwitch.IsEnabled = this.Identity.IsEnabled;
}
}
}
+78
View File
@@ -0,0 +1,78 @@
<UserControl x:Class="ZitiDesktopEdge.MainMenu"
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:ZitiDesktopEdge"
mc:Ignorable="d"
x:Name="MainMenuArea"
d:DesignHeight="400" d:DesignWidth="350" Margin="1,1,1,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Canvas>
<Rectangle Name="Arrow" HorizontalAlignment="Center" Height="20" Fill="White" VerticalAlignment="Bottom" Width="20" Canvas.Bottom="-10" Canvas.Left="165">
<Rectangle.LayoutTransform>
<RotateTransform Angle="-45"/>
</Rectangle.LayoutTransform>
</Rectangle>
</Canvas>
<Rectangle Fill="White" RadiusY="10" RadiusX="10" ClipToBounds="True"></Rectangle>
<Grid Margin="0,0,0,-20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Name="MainStack" Grid.Column="0" Grid.Row="0" Orientation="Vertical" Margin="20,20,20,20">
<Grid Margin="0,0,0,20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="70"/>
</Grid.ColumnDefinitions>
<StackPanel Name="BackArrow" Cursor="Hand" Grid.Column="0" Orientation="Horizontal" Visibility="Collapsed" MouseLeftButtonDown="GoBack">
<Image Source="/Assets/Images/lastArrow.png" Width="20" Height="20"></Image>
<Label FontSize="12" FontWeight="SemiBold" Content="Back" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
</StackPanel>
<Label Name="MenuTitle" Grid.Column="1" Content="Main Menu" HorizontalAlignment="Center" FontSize="14" FontWeight="SemiBold" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="#0F0F23"></Label>
<Image Grid.Column="2" Cursor="Hand" Source="/Assets/Images/x.png" Height="20" Margin="50,4,0,5" MouseDown="HideMenu"></Image>
</Grid>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
<StackPanel Name="MainItems" Orientation="Vertical" HorizontalAlignment="Stretch">
<local:MenuItem HorizontalAlignment="Stretch" Width="Auto" MouseUp="ShowAdvanced" Label="Advanced Settings" Icon="/Assets/Images/advanced.png"></local:MenuItem>
<local:MenuItem Label="About" Icon="/Assets/Images/about.png" MouseUp="ShowAbout"></local:MenuItem>
<local:MenuItem Label="Feedback" Icon="/Assets/Images/feedback.png" MouseUp="ShowFeedback"></local:MenuItem>
<local:MenuItem Label="Support" Icon="/Assets/Images/support.png" MouseUp="ShowSupport"></local:MenuItem>
<local:MenuItem x:Name="DetachButton" Label="Detach App" Icon="/Assets/Images/detach.png" MouseUp="DetachWindow"></local:MenuItem>
<local:MenuItem x:Name="AttachButton" Label="Attach App" Icon="/Assets/Images/detach.png" MouseUp="RetachWindow" Visibility="Collapsed"></local:MenuItem>
</StackPanel>
<StackPanel Name="AboutItems" Visibility="Collapsed" Orientation="Vertical" HorizontalAlignment="Stretch">
<local:SubMenuItem HorizontalAlignment="Stretch" Width="Auto" Label="Privacy Policy" MouseUp="ShowPrivacy"></local:SubMenuItem>
<local:SubMenuItem HorizontalAlignment="Stretch" Width="Auto" Label="Terms of Service" MouseUp="ShowTerms"></local:SubMenuItem>
</StackPanel>
<StackPanel Name="AdvancedItems" Visibility="Collapsed" Orientation="Vertical" HorizontalAlignment="Stretch">
<local:MenuItem HorizontalAlignment="Stretch" Icon="/Assets/Images/wrench.png" Width="Auto" Label="Tunnel Configuration" MouseUp="ShowConfig"></local:MenuItem>
<local:MenuItem HorizontalAlignment="Stretch" Icon="/Assets/Images/logs.png" Width="Auto" Label="Service Logs" MouseUp="ShowLogs"></local:MenuItem>
<local:MenuItem HorizontalAlignment="Stretch" Icon="/Assets/Images/logs.png" Width="Auto" Label="Application Logs" MouseUp="ShowUILogs"></local:MenuItem>
</StackPanel>
<StackPanel Name="ConfigItems" Visibility="Collapsed" Orientation="Vertical" HorizontalAlignment="Stretch">
<local:MenuEditItem x:Name="ConfigIp" HorizontalAlignment="Stretch" Width="Auto" Label="IPv4 Address:"></local:MenuEditItem>
<local:MenuEditItem x:Name="ConfigSubnet" HorizontalAlignment="Stretch" Width="Auto" Label="Subnet Mask:"></local:MenuEditItem>
<local:MenuEditItem x:Name="ConfigMtu" HorizontalAlignment="Stretch" Width="Auto" Label="MTU:"></local:MenuEditItem>
<local:MenuEditItem x:Name="ConfigDns" HorizontalAlignment="Stretch" Width="Auto" Label="DNS Servers:"></local:MenuEditItem>
</StackPanel>
<TextBox Name="LicensesItems" Height="400" Width="{Binding ActualWidth, ElementName=MainStack}" TextWrapping="Wrap" Visibility="Collapsed"></TextBox>
<TextBox Name="LogsItems" Height="400" Width="{Binding ActualWidth, ElementName=MainStack}" TextWrapping="Wrap" Visibility="Collapsed" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto"></TextBox>
<StackPanel Name="AboutItemsButton" Orientation="Vertical" HorizontalAlignment="Stretch" Visibility="Collapsed">
<Label Name="ServiceVersion" HorizontalAlignment="Center" FontSize="10" Foreground="#638190" Margin="0,-20,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
</StackPanel>
<Label Name="MainItemsButton" Margin="0,30,0,0" Foreground="#F4044D" FontWeight="SemiBold" Content="Quit Ziti Desktop Edge" Cursor="Hand" MouseDown="CloseApp" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
</StackPanel>
</Grid>
</Grid>
</UserControl>
+159
View File
@@ -0,0 +1,159 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Diagnostics;
using System;
using System.Threading;
using System.Management.Automation;
using ZitiDesktopEdge.Models;
namespace ZitiDesktopEdge
{
/// <summary>
/// Interaction logic for MainMenu.xaml
/// </summary>
public partial class MainMenu : UserControl {
public delegate void AttachementChanged(bool attached);
public event AttachementChanged OnAttachmentChange;
public string menuState = "Main";
public string licenseData = "it's open source - someone motivated could track this down. we'll add this some day i'm sure";
public MainMenu() {
InitializeComponent();
LicensesItems.Text = licenseData;
}
private void HideMenu(object sender, MouseButtonEventArgs e) {
menuState = "Menu";
UpdateState();
MainMenuArea.Visibility = Visibility.Collapsed;
}
private void CloseApp(object sender, MouseButtonEventArgs e) {
Application.Current.Shutdown();
}
private void ShowAbout(object sender, MouseButtonEventArgs e) {
menuState = "About";
UpdateState();
}
private void ShowAdvanced(object sender, MouseButtonEventArgs e) {
menuState = "Advanced";
UpdateState();
}
private void ShowLicenses(object sender, MouseButtonEventArgs e) {
menuState = "Licenses";
UpdateState();
}
private void ShowConfig(object sender, MouseButtonEventArgs e) {
menuState = "Config";
UpdateState();
}
private void ShowLogs(object sender, MouseButtonEventArgs e) {
menuState = "Logs";
UpdateState();
}
private void ShowUILogs(object sender, MouseButtonEventArgs e) {
menuState = "UILogs";
UpdateState();
}
private void UpdateState() {
MainItems.Visibility = Visibility.Collapsed;
AboutItems.Visibility = Visibility.Collapsed;
MainItemsButton.Visibility = Visibility.Collapsed;
AboutItemsButton.Visibility = Visibility.Collapsed;
BackArrow.Visibility = Visibility.Collapsed;
AdvancedItems.Visibility = Visibility.Collapsed;
LicensesItems.Visibility = Visibility.Collapsed;
LogsItems.Visibility = Visibility.Collapsed;
ConfigItems.Visibility = Visibility.Collapsed;
if (menuState=="About") {
MenuTitle.Content = "About";
AboutItemsButton.Visibility = Visibility.Visible;
AboutItems.Visibility = Visibility.Visible;
BackArrow.Visibility = Visibility.Visible;
} else if (menuState=="Advanced") {
MenuTitle.Content = "Advanced Settings";
AdvancedItems.Visibility = Visibility.Visible;
BackArrow.Visibility = Visibility.Visible;
} else if (menuState=="Licenses") {
MenuTitle.Content = "Third Party Licenses";
LicensesItems.Visibility = Visibility.Visible;
BackArrow.Visibility = Visibility.Visible;
} else if (menuState=="Logs") {
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
MenuTitle.Content = "Service Logs";
LogsItems.Text = client.GetLogs();
LogsItems.Visibility = Visibility.Visible;
BackArrow.Visibility = Visibility.Visible;
} else if (menuState == "UILogs") {
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
MenuTitle.Content = "Application Logs";
LogsItems.Text = UILog.GetLogs();
LogsItems.Visibility = Visibility.Visible;
BackArrow.Visibility = Visibility.Visible;
} else if (menuState=="Config") {
MenuTitle.Content = "Tunnel Configuration";
ConfigItems.Visibility = Visibility.Visible;
BackArrow.Visibility = Visibility.Visible;
ConfigIp.Value = Application.Current.Properties["ip"]?.ToString();
ConfigSubnet.Value = Application.Current.Properties["subnet"]?.ToString();
ConfigMtu.Value = Application.Current.Properties["mtu"]?.ToString();
ConfigDns.Value = Application.Current.Properties["dns"]?.ToString();
} else {
MenuTitle.Content = "Main Menu";
MainItems.Visibility = Visibility.Visible;
MainItemsButton.Visibility = Visibility.Visible;
}
}
private void GoBack(object sender, MouseButtonEventArgs e) {
if (menuState=="Config"||menuState=="Logs"||menuState=="UILogs") {
menuState = "Advanced";
} else if (menuState=="Licenses") {
menuState = "About";
} else {
menuState = "Menu";
}
UpdateState();
}
private void ShowPrivacy(object sender, MouseButtonEventArgs e) {
Process.Start(new ProcessStartInfo("https://netfoundry.io/privacy") { UseShellExecute = true });
}
private void ShowTerms(object sender, MouseButtonEventArgs e) {
Process.Start(new ProcessStartInfo("https://netfoundry.io/terms") { UseShellExecute = true });
}
private void ShowFeedback(object sender, MouseButtonEventArgs e) {
Process.Start(new ProcessStartInfo("mailto:ziti-support@netfoundry.io") { UseShellExecute = true });
}
private void ShowSupport(object sender, MouseButtonEventArgs e) {
Process.Start(new ProcessStartInfo("https://openziti.discourse.group/") { UseShellExecute = true });
}
private void DetachWindow(object sender, MouseButtonEventArgs e) {
Application.Current.MainWindow.ShowInTaskbar = true;
DetachButton.Visibility = Visibility.Collapsed;
AttachButton.Visibility = Visibility.Visible;
Arrow.Visibility = Visibility.Collapsed;
if (OnAttachmentChange != null) {
OnAttachmentChange(false);
}
MainMenuArea.Visibility = Visibility.Collapsed;
}
private void RetachWindow(object sender, MouseButtonEventArgs e) {
Application.Current.MainWindow.ShowInTaskbar = false;
DetachButton.Visibility = Visibility.Visible;
AttachButton.Visibility = Visibility.Collapsed;
Arrow.Visibility = Visibility.Visible;
if (OnAttachmentChange != null) {
OnAttachmentChange(true);
}
}
}
}
+275
View File
@@ -0,0 +1,275 @@
<Window x:Class="ZitiDesktopEdge.MainWindow"
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:ZitiDesktopEdge"
mc:Ignorable="d"
ShowInTaskbar="False"
x:Name="MainUI"
Title="Ziti Desktop Edge" Height="520"
Width="350" ResizeMode="NoResize"
ClipToBounds="False"
Icon="Assets/Images/icon.png" AllowsTransparency="True"
Closing="Window_Closing"
WindowStyle="None" Loaded="MainWindow1_Loaded" Deactivated="MainUI_Deactivated" Activated="MainUI_Activated" Background="#000F0F23">
<Window.Resources>
<Style TargetType="Image">
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality" />
</Style>
<SolidColorBrush x:Key="ProgressBar.Progress" Color="#FF06B025"/>
<SolidColorBrush x:Key="ProgressBar.Background" Color="#FFE6E6E6"/>
<SolidColorBrush x:Key="ProgressBar.Border" Color="#FFBCBCBC"/>
<Style TargetType="{x:Type ProgressBar}">
<Setter Property="Foreground" Value="{StaticResource ProgressBar.Progress}"/>
<Setter Property="Background" Value="{StaticResource ProgressBar.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProgressBar.Border}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Grid x:Name="TemplateRoot">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Determinate"/>
<VisualState x:Name="Indeterminate">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation">
<EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
</DoubleAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation">
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
</PointAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="5" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
<Rectangle x:Name="PART_Track"/>
<Grid x:Name="PART_Indicator" ClipToBounds="true" HorizontalAlignment="Left">
<Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>
<Rectangle x:Name="Animation" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="LayoutTransform" TargetName="TemplateRoot">
<Setter.Value>
<RotateTransform Angle="-90"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsIndeterminate" Value="true">
<Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard>
<Storyboard Name="FormFade">
<!-- <DoubleAnimation From="0" To="-505" Duration="00:00:4" Storyboard.TargetProperty="X" Storyboard.TargetName="MainUI" /> -->
<DoubleAnimation Name="FormFadeAnimation" Storyboard.TargetName="MainUI" Storyboard.TargetProperty="(Window.Opacity)" From="0.0" To="1.0" Duration="0:0:0.5" AutoReverse="False" RepeatBehavior="1x" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="Window.Unloaded">
<BeginStoryboard>
<Storyboard Name="FormFadeOut" Completed="FormFadeOut_Completed">
<DoubleAnimation Name="FormFadeOutAnimation" Storyboard.TargetName="MainUI" Storyboard.TargetProperty="(Window.Opacity)" From="1.0" To="0.0" Duration="0:0:0.5" AutoReverse="False" RepeatBehavior="1x" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Grid Margin="0,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Canvas ClipToBounds="False">
<Rectangle Name="Arrow" HorizontalAlignment="Center" Height="20" Fill="#070826" Width="20" ClipToBounds="True" Canvas.Left="165" Canvas.Bottom="-10">
<Rectangle.LayoutTransform>
<RotateTransform Angle="-45"/>
</Rectangle.LayoutTransform>
</Rectangle>
</Canvas>
<Border Name="UIBorder" BorderBrush="Black" BorderThickness="3" CornerRadius="10">
<Border.Effect>
<DropShadowEffect BlurRadius="15" Direction="2" RenderingBias="Quality" ShadowDepth="4" Opacity="1"/>
</Border.Effect>
</Border>
<Rectangle Name="BgColor" Stroke="Black" RadiusY="10" RadiusX="10" ClipToBounds="True">
<Rectangle.Fill>
<ImageBrush ImageSource="/Assets/Images/background.png" />
</Rectangle.Fill>
</Rectangle>
<StackPanel x:Name="MainView" Margin="0,0,0,-40">
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Cursor="Hand" Orientation="Vertical" Margin="14,16,14,14" MouseLeftButtonDown="ShowMenu">
<Image Source="/Assets/Images/hamburger.png" Margin="5,0,0,-4" Width="26" Height="26" HorizontalAlignment="Left"></Image>
<Label Content="MAIN" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="White" Height="25" FontSize="10"></Label>
<Label Content="MENU" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="White" Height="25" Margin="0,-14,0,0" FontSize="10"></Label>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Stretch" Margin="0,12" MouseDown="Window_MouseDown">
<Image Source="/Assets/Images/z.png" Height="40" RenderOptions.BitmapScalingMode="Fant"></Image>
<Label Content="Tap to Connect" Margin="0,-3,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Russo One" FontSize="14" Foreground="White" HorizontalAlignment="Center"></Label>
</StackPanel>
<StackPanel Grid.Column="2" Cursor="Hand" Orientation="Vertical" Margin="14,16,14,14" MouseLeftButtonDown="AddIdentity">
<Image Source="/Assets/Images/identity.png" Margin="0,0,5,-4" Width="26" Height="26" HorizontalAlignment="Right"></Image>
<Label Content="ADD" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="White" Height="25" FontSize="10" HorizontalAlignment="Right"></Label>
<Label Content="IDENTITY" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="White" Height="25" Margin="0,-14,0,0" FontSize="10" HorizontalAlignment="Right"></Label>
</StackPanel>
</Grid>
<Canvas Name="ConnectButton" Width="350" Height="160" MouseDown="Connect" Visibility="Visible">
<Grid Width="{Binding ActualWidth, ElementName=ConnectButton}" Height="140">
<Image Source="/Assets/Images/connect.png" Height="140" HorizontalAlignment="Center" />
</Grid>
</Canvas>
<Canvas Name="DisconnectButton" Width="350" Height="160" MouseDown="Disconnect" Visibility="Collapsed">
<Grid Width="{Binding ActualWidth, ElementName=DisconnectButton}" Height="140">
<Image Source="/Assets/Images/connected.png" Height="140" HorizontalAlignment="Center" />
</Grid>
<Grid Width="{Binding ActualWidth, ElementName=DisconnectButton}" Height="140">
<Label Name="ConnectedTime" HorizontalAlignment="Center" Content="00:00:00" Foreground="White" Padding="0,90,0,0"/>
</Grid>
<Grid Width="{Binding ActualWidth, ElementName=DisconnectButton}" Height="140">
<Label HorizontalAlignment="Center" Content="STOP" Foreground="White" Padding="0,105,0,0"/>
</Grid>
</Canvas>
<Grid HorizontalAlignment="Stretch" Width="Auto" Margin="0,30,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Vertical">
<Grid HorizontalAlignment="Stretch" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="Download Speed" Foreground="White" HorizontalAlignment="Right" FontSize="14" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
<Image Grid.Column="1" Source="/Assets/Images/down.png" Width="20" HorizontalAlignment="Left" Height="20"></Image>
</Grid>
<Label Name="DownloadSpeed" Margin="0,-16,0,0" Foreground="#0069FF" Content="0" FontSize="40" HorizontalAlignment="Center" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" />
<Label Name="DownloadSpeedLabel" Foreground="White" Margin="0,-20,0,30" Content="KBps" FontSize="11" HorizontalAlignment="Center" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
<Grid HorizontalAlignment="Stretch" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="Upload Speed" Foreground="White" HorizontalAlignment="Right" FontSize="14" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
<Image Grid.Column="1" Source="/Assets/Images/up.png" Width="20" HorizontalAlignment="Left" Height="20"></Image>
</Grid>
<Label Name="UploadSpeed" Margin="0,-16,0,0" Foreground="#FF0047" Content="0" FontSize="40" HorizontalAlignment="Center" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" />
<Label Name="UploadSpeedLabel" Foreground="White" Margin="0,-20,0,30" Content="KBps" FontSize="11" HorizontalAlignment="Center" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" />
</StackPanel>
</Grid>
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<StackPanel Name="IdList" Orientation="Vertical"></StackPanel>
</ScrollViewer>
<Grid HorizontalAlignment="Stretch" Margin="0,20,0,10" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Name="AddIdButton" Padding="0,0,0,20" Grid.Column="0" Margin="0,0,0,20" Content="Add Identity" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="#0069FF" FontSize="16" Cursor="Hand" HorizontalAlignment="Center" VerticalAlignment="Center" MouseDown="AddIdentity"></Label>
</Grid>
</StackPanel>
<local:MainMenu x:Name="MainMenu" Visibility="Collapsed"></local:MainMenu>
<local:IdentityDetails x:Name="IdentityMenu" Visibility="Collapsed"></local:IdentityDetails>
<Grid x:Name="NoServiceView" Visibility="Collapsed" >
<Rectangle RadiusX="10" RadiusY="10">
<Rectangle.Fill>
<SolidColorBrush Color="Black" Opacity="0.9"/>
</Rectangle.Fill>
</Rectangle>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Label Foreground="White" Content="Service Not Started" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
<Label Foreground="LightGray" Content="Start the Ziti Tunnel Service to get started" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
<Label Name="QuitButton" Grid.Row="3" Foreground="#F4044D" FontWeight="SemiBold" Content="Quit Ziti Desktop Edge" Cursor="Hand" MouseDown="CloseApp" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
</Grid>
</Grid>
<Grid x:Name="LoadingScreen" Visibility="Collapsed" Width="350">
<Rectangle RadiusX="10" RadiusY="10">
<Rectangle.Fill>
<SolidColorBrush Color="Black" Opacity="0.9"/>
</Rectangle.Fill>
</Rectangle>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="10"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Label Name="LoadingTitle" Foreground="White" Content="Loading" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
<TextBlock x:Name="LoadingDetails" TextWrapping="WrapWithOverflow" Foreground="LightGray" Padding="10" Text="Operation pending, please wait..." Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" FontSize="14" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
<ProgressBar x:Name="LoadProgress" Width="100" Grid.Row="3" IsEnabled="True" />
</Grid>
</Grid>
<Grid x:Name="ErrorView" Visibility="Collapsed" Width="350">
<Rectangle RadiusX="10" RadiusY="10">
<Rectangle.Fill>
<SolidColorBrush Color="Black" Opacity="0.9"/>
</Rectangle.Fill>
</Rectangle>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Label Name="ErrorTitle" Foreground="White" Content="An Error Occurred" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
<TextBlock x:Name="ErrorDetails" TextWrapping="WrapWithOverflow" Foreground="LightGray" Padding="10" Text="An Unknown Error Occurred, you could try restarting the service and the interface to continue" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" FontSize="14" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
<Label Grid.Row="3" Foreground="Gray" FontWeight="Light" Content="Check the Log for Details" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
<Label Name="QuitErrorButton" Grid.Row="4" Foreground="#F4044D" FontWeight="SemiBold" Content="Close" Cursor="Hand" MouseDown="CloseError" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
</Grid>
</Grid>
</Grid>
</Window>
+524
View File
@@ -0,0 +1,524 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Input;
using System.IO;
using ZitiDesktopEdge.Models;
using System.IO.Compression;
using ZitiDesktopEdge.ServiceClient;
using System.ServiceProcess;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Diagnostics;
using System.Security.Principal;
using System.Net;
using System.Windows.Controls;
using System.Threading.Tasks;
using System.Threading;
using System.Text;
namespace ZitiDesktopEdge {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow:Window {
public System.Windows.Forms.NotifyIcon notifyIcon;
private DateTime _startDate;
private System.Windows.Forms.Timer _timer;
private Client serviceClient = null;
private bool _isAttached = true;
private int _right = 75;
private int _bottom = 0;
private double _maxHeight = 800d;
private string _serviceVersion = "0.0.8";
private string[] suffixes = { "bps", "kbps", "mbps", "gbps", "tbps", "pbps" };
private List<ZitiIdentity> identities {
get {
return (List<ZitiIdentity>)Application.Current.Properties["Identities"];
}
}
private void LaunchOrInstall() {
ServiceController ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName=="ziti");
if (ctl==null) {
SetCantDisplay();
} else {
if (ctl.Status!=ServiceControllerStatus.Running) {
try {
ctl.Start();
} catch (Exception e) {
UILog.Log(e.Message);
SetCantDisplay();
}
}
}
}
private List<ZitiService> services = new List<ZitiService>();
public MainWindow() {
InitializeComponent();
App.Current.MainWindow.WindowState = WindowState.Normal;
App.Current.MainWindow.Closing += MainWindow_Closing;
App.Current.MainWindow.Deactivated += MainWindow_Deactivated;
App.Current.MainWindow.Activated += MainWindow_Activated;
notifyIcon = new System.Windows.Forms.NotifyIcon();
notifyIcon.Visible = true;
notifyIcon.Click += TargetNotifyIcon_Click;
notifyIcon.Visible = true;
LaunchOrInstall();
MainMenu.ServiceVersion.Content = _serviceVersion;
SetNotifyIcon("white");
InitializeComponent();
}
private void MainWindow_Activated(object sender, EventArgs e) {
this.Visibility = Visibility.Visible;
}
private void MainWindow_Deactivated(object sender, EventArgs e) {
this.Visibility = Visibility.Collapsed;
}
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
notifyIcon.Visible = false;
notifyIcon.Icon.Dispose();
notifyIcon.Dispose();
}
private void SetCantDisplay() {
NoServiceView.Visibility = Visibility.Visible;
SetNotifyIcon("red");
}
private void SetCanDisplay() {
NoServiceView.Visibility = Visibility.Collapsed;
SetNotifyIcon("green");
}
private void Window_MouseDown(object sender, MouseButtonEventArgs e) {
if (!_isAttached&&e.ChangedButton == MouseButton.Left) this.DragMove();
}
private void Repaint() {
LoadIdentities();
}
private void TargetNotifyIcon_Click(object sender, EventArgs e) {
this.Show();
this.Activate();
}
private void MainWindow1_Loaded(object sender, RoutedEventArgs e) {
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
this.Left = desktopWorkingArea.Right - this.Width - _right;
this.Top = desktopWorkingArea.Bottom - this.Height - _bottom;
// add a new service client
serviceClient = new Client();
serviceClient.OnClientConnected += ServiceClient_OnClientConnected;
serviceClient.OnClientDisconnected += ServiceClient_OnClientDisconnected;
serviceClient.OnIdentityEvent += ServiceClient_OnIdentityEvent;
serviceClient.OnMetricsEvent += ServiceClient_OnMetricsEvent;
serviceClient.OnServiceEvent += ServiceClient_OnServiceEvent;
serviceClient.OnTunnelStatusEvent += ServiceClient_OnTunnelStatusEvent;
Application.Current.Properties.Add("ServiceClient", serviceClient);
Application.Current.Properties.Add("Identities", new List<ZitiIdentity>());
MainMenu.OnAttachmentChange += AttachmentChanged;
IdentityMenu.OnError += IdentityMenu_OnError;
try {
serviceClient.Connect();
//var s = serviceClient.GetStatus();
//LoadStatusFromService(s.Status);
} catch /*ignored for now (Exception ex) */{
SetCantDisplay();
}
LoadIdentities();
IdentityMenu.OnForgot += IdentityForgotten;
}
private void IdentityMenu_OnError(string message) {
ShowError("Identity Error", message);
}
private void ServiceClient_OnClientConnected(object sender, object e) {
this.Dispatcher.Invoke(() => {
//e is _ALWAYS_ null at this time use this to display something if you want
NoServiceView.Visibility = Visibility.Collapsed;
SetNotifyIcon("white");
});
}
private void ServiceClient_OnClientDisconnected(object sender, object e) {
this.Dispatcher.Invoke(() => {
SetCantDisplay();
});
}
private void ServiceClient_OnIdentityEvent(object sender, IdentityEvent e) {
if (e == null) return;
ZitiIdentity zid = ZitiIdentity.FromClient(e.Id);
Debug.WriteLine($"==== IdentityEvent : action:{e.Action} fingerprint:{e.Id.FingerPrint} name:{e.Id.Name} ");
this.Dispatcher.Invoke(() => {
if (e.Action == "added") {
var found = identities.Find(i => i.Fingerprint == e.Id.FingerPrint);
if (found == null) {
identities.Add(zid);
} else {
//if we get here exit out so that LoadIdentities() doesn't get called
found.IsEnabled = true;
return;
}
} else {
IdentityForgotten(ZitiIdentity.FromClient(e.Id));
}
LoadIdentities();
});
Debug.WriteLine($"IDENTITY EVENT. Action: {e.Action} fingerprint: {zid.Fingerprint}");
}
private void ServiceClient_OnMetricsEvent(object sender, List<Identity> ids) {
if (ids != null) {
long totalUp = 0;
long totalDown = 0;
foreach (var id in ids) {
Debug.WriteLine($"==== MetricsEvent : id {id.Name} down: {id.Metrics.Down} up:{id.Metrics.Up}");
if (id?.Metrics != null) {
totalDown += id.Metrics.Down;
totalUp += id.Metrics.Up;
}
}
this.Dispatcher.Invoke(() => {
SetSpeed(totalUp, UploadSpeed, UploadSpeedLabel);
SetSpeed(totalDown, DownloadSpeed, DownloadSpeedLabel);
});
}
}
public void SetSpeed(decimal bytes, Label speed, Label speedLabel) {
int counter = 0;
while (Math.Round(bytes / 1024) >= 1) {
bytes = bytes / 1024;
counter++;
}
speed.Content = bytes.ToString("0.0");
speedLabel.Content = suffixes[counter];
}
private void ServiceClient_OnServiceEvent(object sender, ServiceEvent e) {
if (e == null) return;
Debug.WriteLine($"==== ServiceEvent : action:{e.Action} fingerprint:{e.Fingerprint} name:{e.Service.Name} ");
this.Dispatcher.Invoke(() => {
var found = identities.Find(id => id.Fingerprint == e.Fingerprint);
if (found == null) {
Debug.WriteLine($"{e.Action} service event for {e.Service.Name} but the provided identity fingerprint {e.Fingerprint} is not found!");
return;
}
if (e.Action == "added") {
ZitiService zs = new ZitiService(e.Service.Name, e.Service.HostName, e.Service.Port);
var svc = found.Services.Find(s => s.Name == zs.Name);
if (svc == null) found.Services.Add(zs);
else Debug.WriteLine("the service named " + zs.Name + " is already accounted for on this identity.");
} else {
Debug.WriteLine("removing the service named: " + e.Service.Name);
found.Services.RemoveAll(s => s.Name == e.Service.Name);
}
LoadIdentities();
});
}
private void ServiceClient_OnTunnelStatusEvent(object sender, TunnelStatusEvent e)
{
if (e == null) return; //just skip it for now...
Debug.WriteLine($"==== TunnelStatusEvent: ");
this.Dispatcher.Invoke(() => {
InitializeTimer((int)e.Status.Duration);
LoadStatusFromService(e.Status);
LoadIdentities();
});
}
private void IdentityForgotten(ZitiIdentity forgotten) {
ZitiIdentity idToRemove = null;
foreach (var id in identities) {
if (id.Fingerprint == forgotten.Fingerprint) {
idToRemove = id;
break;
}
}
identities.Remove(idToRemove);
LoadIdentities();
}
private void AttachmentChanged(bool attached) {
_isAttached = attached;
if (_isAttached) {
Arrow.Visibility = Visibility.Visible;
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
this.Left = desktopWorkingArea.Right-this.Width-_right;
this.Top = desktopWorkingArea.Bottom-this.Height-_bottom;
} else {
Arrow.Visibility = Visibility.Collapsed;
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
this.Left = desktopWorkingArea.Right-this.Width-75;
this.Top = desktopWorkingArea.Bottom-this.Height-75;
}
MainMenu.Visibility = Visibility.Collapsed;
}
private void LoadStatusFromService(TunnelStatus status) {
if (status != null) {
NoServiceView.Visibility = Visibility.Collapsed;
SetNotifyIcon("white");
if (status.Active) {
InitializeTimer((int)status.Duration);
ConnectButton.Visibility = Visibility.Collapsed;
DisconnectButton.Visibility = Visibility.Visible;
SetNotifyIcon("green");
} else {
ConnectButton.Visibility = Visibility.Visible;
DisconnectButton.Visibility = Visibility.Collapsed;
}
if (!Application.Current.Properties.Contains("ip")) {
Application.Current.Properties.Add("ip", status?.IpInfo?.Ip);
}
if (!Application.Current.Properties.Contains("subnet")) {
Application.Current.Properties.Add("subnet", status?.IpInfo?.Subnet);
}
if (!Application.Current.Properties.Contains("mtu")) {
Application.Current.Properties.Add("mtu", status?.IpInfo?.MTU);
}
if (!Application.Current.Properties.Contains("dns")) {
Application.Current.Properties.Add("dns", status?.IpInfo?.DNS);
}
foreach (var id in status.Identities) {
updateViewWithIdentity(id);
}
LoadIdentities();
} else {
SetCantDisplay();
}
}
private void updateViewWithIdentity(Identity id) {
var zid = ZitiIdentity.FromClient(id);
foreach (var i in identities) {
if (i.Fingerprint == zid.Fingerprint) {
identities.Remove(i);
break;
}
}
identities.Add(zid);
LoadIdentities();
}
private void SetNotifyIcon(string iconPrefix) {
var iconUri = new Uri("pack://application:,,/Assets/Images/ziti-" + iconPrefix + ".ico");
System.IO.Stream iconStream = System.Windows.Application.GetResourceStream(iconUri).Stream;
notifyIcon.Icon = new System.Drawing.Icon(iconStream);
Application.Current.MainWindow.Icon = System.Windows.Media.Imaging.BitmapFrame.Create(iconUri);
}
private void LoadIdentities() {
IdList.Children.Clear();
IdList.Height = 0;
IdList.MaxHeight = _maxHeight-520;
ZitiIdentity[] ids = identities.ToArray();
this.Height = 460+(ids.Length*60);
if (this.Height>_maxHeight) this.Height = _maxHeight;
IdentityMenu.SetHeight(this.Height-160);
for (int i=0; i<ids.Length; i++) {
IdentityItem id = new IdentityItem();
if (ids[i].IsEnabled) {
SetNotifyIcon("green");
ConnectButton.Visibility = Visibility.Collapsed;
DisconnectButton.Visibility = Visibility.Visible;
}
id.Identity = ids[i];
//id.OnClick += OpenIdentity;
IdList.Children.Add(id);
IdList.Height += 60;
}
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
if (this._isAttached) {
this.Left = desktopWorkingArea.Right - this.Width - _right;
this.Top = desktopWorkingArea.Bottom - this.Height - _bottom;
}
}
private void OpenIdentity(ZitiIdentity identity) {
IdentityMenu.Identity = identity;
}
private void ShowMenu(object sender, MouseButtonEventArgs e) {
MainMenu.Visibility = Visibility.Visible;
}
private void AddIdentity(object sender, MouseButtonEventArgs e) {
UIModel.HideOnLostFocus = false;
Microsoft.Win32.OpenFileDialog jwtDialog = new Microsoft.Win32.OpenFileDialog();
UIModel.HideOnLostFocus = true;
jwtDialog.DefaultExt = ".jwt";
jwtDialog.Filter = "Ziti Identities (*.jwt)|*.jwt";
if (jwtDialog.ShowDialog() == true) {
ShowLoad();
string fileContent = File.ReadAllText(jwtDialog.FileName);
try {
Identity createdId = serviceClient.AddIdentity(System.IO.Path.GetFileName(jwtDialog.FileName), false, fileContent);
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
client.IdentityOnOff(createdId.FingerPrint, true);
if (createdId != null) {
identities.Add(ZitiIdentity.FromClient(createdId));
LoadIdentities();
} else {
ShowError("Identity Error", "Identity Id was null, please try again");
}
} catch (ServiceException se) {
ShowError(se.AdditionalInfo, se.Message);
} catch (Exception ex) {
ShowError("Unexpected Error", "Code 2:" + ex.Message);
}
LoadIdentities();
HideLoad();
}
}
private void OnTimedEvent(object sender, EventArgs e) {
TimeSpan span = (DateTime.Now - _startDate);
int hours = span.Hours;
int minutes = span.Minutes;
int seconds = span.Seconds;
var hoursString = (hours>9)?hours.ToString():"0"+hours;
var minutesString = (minutes>9)? minutes.ToString():"0"+minutes;
var secondsString = (seconds>9) ? seconds.ToString() : "0"+seconds;
ConnectedTime.Content = hoursString+":"+minutesString+":"+secondsString;
}
private void InitializeTimer(int millisAgoStarted) {
_startDate = DateTime.Now.Subtract(new TimeSpan(0,0,0,0, millisAgoStarted));
_timer = new System.Windows.Forms.Timer();
_timer.Interval = 100;
_timer.Tick += OnTimedEvent;
_timer.Enabled = true;
_timer.Start();
}
private void Connect(object sender, RoutedEventArgs e)
{
this.Dispatcher.Invoke(() =>
{
ShowLoad();
//Dispatcher.Invoke(new Action(() => { }), System.Windows.Threading.DispatcherPriority.ContextIdle);
DoConnect();
HideLoad();
});
}
private void DoConnect() {
try {
serviceClient.SetTunnelState(true);
SetNotifyIcon("green");
ConnectButton.Visibility = Visibility.Collapsed;
DisconnectButton.Visibility = Visibility.Visible;
for (int i = 0; i < identities.Count; i++) {
serviceClient.IdentityOnOff(identities[i].Fingerprint, true);
}
for (int i = 0; i < IdList.Children.Count; i++) {
IdentityItem item = IdList.Children[i] as IdentityItem;
item._identity.IsEnabled = true;
item.RefreshUI();
}
} catch (ServiceException se) {
ShowError(se.AdditionalInfo, se.Message);
} catch (Exception ex) {
ShowError("Unexpected Error", "Code 3:" + ex.Message);
}
}
private void Disconnect(object sender, RoutedEventArgs e) {
ShowLoad();
try {
ConnectedTime.Content = "00:00:00";
_timer.Stop();
serviceClient.SetTunnelState(false);
SetNotifyIcon("white");
ConnectButton.Visibility = Visibility.Visible;
DisconnectButton.Visibility = Visibility.Collapsed;
for (int i = 0; i < identities.Count; i++) {
serviceClient.IdentityOnOff(identities[i].Fingerprint, false);
}
for (int i = 0; i < IdList.Children.Count; i++) {
IdentityItem item = IdList.Children[i] as IdentityItem;
item._identity.IsEnabled = false;
item.RefreshUI();
}
} catch (ServiceException se) {
ShowError(se.AdditionalInfo, se.Message);
} catch (Exception ex) {
ShowError("Unexpected Error", "Code 4:"+ex.Message);
}
HideLoad();
}
private void ShowLoad() {
LoadProgress.IsIndeterminate = true;
LoadingScreen.Visibility = Visibility.Visible;
}
private void HideLoad() {
LoadingScreen.Visibility = Visibility.Collapsed;
LoadProgress.IsIndeterminate = false;
}
private void FormFadeOut_Completed(object sender, EventArgs e) {
closeCompleted = true;
//this.Close();
}
private bool closeCompleted = false;
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
if (!closeCompleted) {
FormFadeOut.Begin();
e.Cancel = true;
}
}
private void ShowError(String title, String message) {
ErrorTitle.Content = title;
ErrorDetails.Text = message;
ErrorView.Visibility = Visibility.Visible;
}
private void CloseError(object sender, MouseButtonEventArgs e) {
ErrorView.Visibility = Visibility.Collapsed;
}
private void CloseApp(object sender, MouseButtonEventArgs e) {
Application.Current.Shutdown();
}
private void MainUI_Deactivated(object sender, EventArgs e) {
if (UIModel.HideOnLostFocus)
{
this.WindowState = WindowState.Minimized;
}
}
private void MainUI_Activated(object sender, EventArgs e) {
this.WindowState = WindowState.Normal;
}
}
}
+23
View File
@@ -0,0 +1,23 @@
<UserControl x:Class="ZitiDesktopEdge.MenuEditItem"
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:ZitiDesktopEdge"
mc:Ignorable="d"
d:DesignHeight="50" HorizontalAlignment="Stretch" d:DesignWidth="350" Cursor="Hand">
<Grid>
<StackPanel Orientation="Vertical">
<Grid Height="49">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBox Name="MainLabel" MaxWidth="150" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<TextBox Name="MainEdit" GotFocus="MainEdit_GotFocus" MaxWidth="200" Grid.Column="1" HorizontalAlignment="Right" BorderThickness="0" Background="White" TextAlignment="Right" Padding="12,12,12,12" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" ></TextBox>
</Grid>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
</StackPanel>
</Grid>
</UserControl>
+59
View File
@@ -0,0 +1,59 @@
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 ZitiDesktopEdge {
/// <summary>
/// Interaction logic for MenuItem.xaml
/// </summary>
public partial class MenuEditItem: UserControl {
private string _label = "";
public string Label {
get {
return _label;
}
set {
this._label = value;
MainLabel.Text = this._label;
}
}
public string Value {
get {
return MainEdit.Text;
}
set {
MainEdit.Text = value;
}
}
public bool IsLocked {
get {
return MainEdit.IsReadOnly;
}
set {
MainEdit.IsReadOnly = value;
}
}
public MenuEditItem() {
InitializeComponent();
}
private void MainEdit_GotFocus(object sender, RoutedEventArgs e) {
var textbox = (sender as TextBox);
textbox.SelectAll();
}
}
}
+49
View File
@@ -0,0 +1,49 @@
<UserControl x:Class="ZitiDesktopEdge.MenuItem"
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:ZitiDesktopEdge"
mc:Ignorable="d"
d:DesignHeight="50" HorizontalAlignment="Stretch" d:DesignWidth="375" Cursor="Hand">
<UserControl.Triggers>
<EventTrigger RoutedEvent="UserControl.MouseEnter" >
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BgFill" From="0" To="0.2" Duration="0:0:0.5"></DoubleAnimation>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BgFill" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BgFill" From="0" To="0.2" Duration="0:0:0.5"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="UserControl.MouseLeave" >
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BgFill" From=".2" To="0" Duration="0:0:0.5"></DoubleAnimation>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BgFill" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BgFill" From=".2" To="0" Duration="0:0:0.5"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</UserControl.Triggers>
<Grid>
<Rectangle Name="BgFill" Fill="#7d8faf" Opacity="0"></Rectangle>
<StackPanel Orientation="Vertical">
<Grid Height="49">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Image Name="MainSource" Source="/Assets/Images/advanced.png" Width="20" Height="20"></Image>
<Label Name="MainLabel" Grid.Column="1" Content="Main Menu" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></Label>
<Image Grid.Column="2" HorizontalAlignment="Right" Source="/Assets/Images/nextArrow.png" Width="20" Height="20" Margin="0,0,10,0" />
</Grid>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
</StackPanel>
</Grid>
</UserControl>
+56
View File
@@ -0,0 +1,56 @@
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 ZitiDesktopEdge {
/// <summary>
/// Interaction logic for MenuItem.xaml
/// </summary>
public partial class MenuItem : UserControl {
private string _label = "";
private string _icon = "";
public string Label {
get {
return _label;
}
set {
this._label = value;
MainLabel.Content = this._label;
}
}
public string Icon {
get {
return _icon;
}
set {
this._icon = value;
MainSource.Source = new BitmapImage(new Uri(this._icon, UriKind.Relative));
}
}
public MenuItem() {
InitializeComponent();
}
private void UserControl_MouseEnter(object sender, MouseEventArgs e) {
}
private void UserControl_MouseLeave(object sender, MouseEventArgs e) {
}
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.IO;
namespace ZitiDesktopEdge.Models {
public class UILog {
private static string _logDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "NetFoundry" ,"Logs", "Log.log");
public static void Log(string message) {
try {
File.WriteAllText(_logDirectory, message);
} catch (Exception e) {
Console.WriteLine(e.Message);
}
}
public static string GetLogs() {
return File.ReadAllText(_logDirectory);
}
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZitiDesktopEdge.Models
{
static class UIModel
{
static public bool HideOnLostFocus { get; set; } = true;
}
}
+56
View File
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZitiDesktopEdge.Models {
public class ZitiIdentity {
public List<ZitiService> Services { get; set; }
public string Name { get; set; }
public string ControllerUrl { get; set; }
public bool IsEnabled { get; set; }
public string EnrollmentStatus { get; set; }
public string Status { get; set; }
public ZitiIdentity()
{
//default constructor to support named initialization
this.Services = new List<ZitiService>();
}
public ZitiIdentity(string Name, string ControllerUrl, bool IsEnabled, List<ZitiService> Services) {
this.Name = Name;
this.Services = Services;
this.ControllerUrl = ControllerUrl;
this.IsEnabled = IsEnabled;
this.EnrollmentStatus = "Enrolled";
this.Status = "Available";
}
public string Fingerprint { get; set; }
public static ZitiIdentity FromClient(ServiceClient.Identity id)
{
ZitiIdentity zid = new ZitiIdentity()
{
ControllerUrl = id.Config.ztAPI,
EnrollmentStatus = "status",
Fingerprint = id.FingerPrint,
IsEnabled = id.Active,
Name = id.Name,
Status = id.Status,
};
if (id.Services != null)
{
foreach (var svc in id.Services)
{
var zsvc = new ZitiService(svc.Name, svc.HostName, svc.Port);
zid.Services.Add(zsvc);
}
}
return zid;
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZitiDesktopEdge.Models {
public class ZitiService {
public string Name { get; set; }
public string Url { get; set; }
public ZitiService(string Name, string hostname, int port) {
this.Name = Name;
this.Url = hostname + ":" + port;
}
}
}
+55
View File
@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Ziti Desktop Edge")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ziti Desktop Edge")]
[assembly: AssemblyCopyright("Copyright NetFoundry © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+63
View File
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Ziti.Desktop.Edge.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ziti.Desktop.Edge.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
+117
View File
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Ziti.Desktop.Edge.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+12
View File
@@ -0,0 +1,12 @@
<UserControl x:Class="ZitiDesktopEdge.RegistrationScreen"
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:ZitiDesktopEdge"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>
+25
View File
@@ -0,0 +1,25 @@
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 ZitiDesktopEdge {
/// <summary>
/// Interaction logic for RegistrationScreen.xaml
/// </summary>
public partial class RegistrationScreen:UserControl {
public RegistrationScreen() {
InitializeComponent();
}
}
}
+586
View File
@@ -0,0 +1,586 @@
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Security.Principal;
using System.Security.AccessControl;
using Newtonsoft.Json;
using System.Threading;
using System.Threading.Tasks;
using System.Runtime.Remoting.Contexts;
using System.Windows.Interop;
using System.Windows.Documents;
/// <summary>
/// The implementation will abstract away the setup of the communication to
/// the service. This implementation will communicate to the service over a
/// a NamedPipe.
///
/// All communication is effectively serial - one or more messages sent and
/// one or more messages returned.
///
/// </summary>
namespace ZitiDesktopEdge.ServiceClient
{
internal class Client
{
public event EventHandler<TunnelStatusEvent> OnTunnelStatusEvent;
public event EventHandler<List<Identity>> OnMetricsEvent;
public event EventHandler<IdentityEvent> OnIdentityEvent;
public event EventHandler<ServiceEvent> OnServiceEvent;
public event EventHandler<object> OnClientConnected;
public event EventHandler<object> OnClientDisconnected;
protected virtual void TunnelStatusEvent(TunnelStatusEvent e)
{
EventHandler<TunnelStatusEvent> handler = OnTunnelStatusEvent;
if (handler != null)
{
handler(this, e);
}
}
protected virtual void MetricsEvent(List<Identity> e)
{
EventHandler<List<Identity>> handler = OnMetricsEvent;
if (handler != null)
{
handler(this, e);
}
}
protected virtual void IdentityEvent(IdentityEvent e)
{
EventHandler<IdentityEvent> handler = OnIdentityEvent;
if (handler != null)
{
handler(this, e);
}
}
protected virtual void ServiceEvent(ServiceEvent e)
{
EventHandler<ServiceEvent> handler = OnServiceEvent;
if (handler != null)
{
handler(this, e);
}
}
protected virtual void ClientConnected(object e)
{
Connected = true;
this.Reconnecting = false;
EventHandler<object> handler = OnClientConnected;
if (handler != null)
{
handler(this, e);
}
}
protected virtual void ClientDisconnected(object e)
{
Reconnect();
Connected = false;
EventHandler<object> handler = OnClientDisconnected;
if (handler != null)
{
handler(this, e);
}
}
JsonSerializer serializer = new JsonSerializer();
private object namedPipeSyncLock = new object();
const string ipcPipe = @"NetFoundry\tunneler\ipc";
const string logPipe = @"NetFoundry\tunneler\logs";
const string eventPipe = @"NetFoundry\tunneler\events";
const string localPipeServer = ".";
const PipeDirection inOut = PipeDirection.InOut;
const int ServiceConnectTimeout = 500;
NamedPipeClientStream pipeClient = null;
StreamWriter ipcWriter = null;
StreamReader ipcReader = null;
NamedPipeClientStream eventClient = null;
bool _extendedDebug = false; //set this to true if you need to diagnose issues with the service comms
public Client()
{
try
{
string extDebugEnv = Environment.GetEnvironmentVariable("ZITI_EXTENDED_DEBUG");
if (extDebugEnv != null)
{
if (bool.Parse(extDebugEnv))
{
_extendedDebug = true;
}
}
//establish the named pipe to the service
setupPipe();
}
catch(Exception ex)
{
Debug.WriteLine("EXCEPTION IN CLIENT CONNECT: " + ex.Message);
//if this happens - enter retry mode...
Reconnect();
}
}
public bool Reconnecting { get; set; }
public bool Connected { get; set; }
public void Connect()
{
//establish the named pipe to the service
setupPipe();
}
public void Reconnect()
{
if (Reconnecting)
{
Debug.WriteLine("Already in reconnect mode.");
return;
}
else
{
Reconnecting = true;
}
Task.Run(() =>
{
while (true)
{
try
{
Thread.Sleep(2500); //wait 500ms and try to reconnect...
Debug.WriteLine("Attempting to connect to service...");
pipeClient?.Close();
eventClient?.Close();
setupPipe();
if (Connected)
{
Debug.WriteLine("Connected to the service - exiting reconect loop");
this.Connected = true;
Reconnecting = false;
return;
}
else
{
//ClientDisconnected(null);
}
}
catch
{
//fire the event and just try it all over....
//ClientDisconnected(null);
}
Debug.WriteLine("Reconnect failed. Trying again...");
}
});
}
PipeSecurity CreateSystemIOPipeSecurity()
{
PipeSecurity pipeSecurity = new PipeSecurity();
var id = new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null);
// Allow Everyone read and write access to the pipe.
pipeSecurity.SetAccessRule(new PipeAccessRule(id, PipeAccessRights.ReadWrite, AccessControlType.Allow));
return pipeSecurity;
}
private void setupPipe()
{
lock (namedPipeSyncLock)
{
pipeClient = new NamedPipeClientStream(localPipeServer, ipcPipe, inOut);
eventClient = new NamedPipeClientStream(localPipeServer, eventPipe, PipeDirection.In);
try
{
eventClient.Connect(ServiceConnectTimeout);
pipeClient.Connect(ServiceConnectTimeout);
ipcWriter = new StreamWriter(pipeClient);
ipcReader = new StreamReader(pipeClient);
ClientConnected(null);
}
catch(Exception ex)
{
throw new ServiceException("Could not connect to the service.", 1, ex.Message);
}
Task.Run(() => { //hack for now until it's async...
try
{
StreamReader eventReader = new StreamReader(eventClient);
while (true)
{
if (eventReader.EndOfStream)
{
break;
}
processEvent(eventReader);
}
}
catch(Exception ex)
{
Debug.WriteLine("unepxected error: " + ex.ToString());
}
// since this thread is always sitting waiting to read
// it should be the only one triggering this event
ClientDisconnected(null);
});
}
}
public ZitiTunnelStatus GetStatus()
{
try
{
send(new ServiceFunction() { Function = "Status" });
var rtn = read<ZitiTunnelStatus>(ipcReader);
return rtn;
}
catch (IOException ioe)
{
//almost certainly a problem with the pipe - recreate the pipe...
//setupPipe();
throw ioe;
}
}
ServiceFunction AddIdentityFunction = new ServiceFunction() { Function = "AddIdentity" };
public Identity AddIdentity(string identityName, bool activate, string jwt)
{
try
{
Identity id = new Identity
{
Active = activate,
Name = identityName
};
NewIdentity newId = new NewIdentity()
{
Id = id,
Flags = new EnrollmentFlags()
{
JwtString = jwt
}
};
send(AddIdentityFunction);
send(newId);
var resp = read<IdentityResponse>(ipcReader);
Debug.WriteLine(resp.ToString());
if(resp.Code != 0)
{
throw new ServiceException(resp.Message, resp.Code, resp.Error);
}
return resp.Payload;
}
catch (IOException)
{
//almost certainly a problem with the pipe - recreate the pipe...
//setupPipe();
throw;
}
}
public void RemoveIdentity(string fingerPrint)
{
if (string.IsNullOrEmpty(fingerPrint))
{
//nothing to do...
return;
}
try
{
FingerprintFunction removeFunction = new FingerprintFunction()
{
Function = "RemoveIdentity",
Payload = new FingerprintPayload() { Fingerprint = fingerPrint }
};
send(removeFunction);
var r = read<SvcResponse>(ipcReader);
}
catch (IOException ioe)
{
//almost certainly a problem with the pipe - recreate the pipe...
//setupPipe();
throw ioe;
}
}
private void checkConnected()
{
if (this.Reconnecting)
{
throw new ServiceException("Client is not connected", 2, "Cannot use the client at this time, it is reconnecting");
}
if (!this.Connected)
{
throw new ServiceException("Client is not connected", 2, "Cannot use the client at this time, it is not connected");
}
}
public void SetTunnelState(bool onOff)
{
/*
checkConnected();
try
{
send(new BooleanFunction("TunnelState", onOff));
read<SvcResponse>(ipcReader);
}
catch (IOException ioe)
{
//almost certainly a problem with the pipe - recreate the pipe...
//setupPipe();
throw ioe;
}
*/
}
public string GetLogs()
{
try
{
NamedPipeClientStream logClient = new NamedPipeClientStream(localPipeServer, logPipe, PipeDirection.In);
StreamReader logReader = new StreamReader(logClient);
logClient.Connect(ServiceConnectTimeout);
string content = logReader.ReadToEnd();
//ugly hack to turn ansi escaping to not... _bleck_
//todo: fix this :point_up:
content = new System.Text.RegularExpressions.Regex(@"\x1B\[[^@-~]*[@-~]").Replace(content, "");
return content;
}
catch
{
//almost certainly a problem with the pipe - probably means the service is NOT running
return "Error fetching logs from service. Is it running?";
}
}
public Identity IdentityOnOff(string fingerprint, bool onOff)
{
try
{
send(new IdentityToggleFunction(fingerprint, onOff));
IdentityResponse idr = read<IdentityResponse>(ipcReader);
return idr.Payload;
}
catch (IOException ioe)
{
//almost certainly a problem with the pipe - recreate the pipe...
//setupPipe();
throw ioe;
}
}
private void send(object objToSend)
{
bool retried = false;
while (true)
{
try
{
string toSend = JsonConvert.SerializeObject(objToSend, Formatting.None);
if (toSend?.Trim() != null)
{
debugServiceCommunication("=============== sending message =============== ");
debugServiceCommunication(toSend);
ipcWriter.Write(toSend);
ipcWriter.Write('\n');
debugServiceCommunication("=============== flushing message =============== ");
ipcWriter.Flush();
debugServiceCommunication("=============== sent message =============== ");
debugServiceCommunication("");
debugServiceCommunication("");
}
else
{
Debug.WriteLine("NOT sending empty object??? " + objToSend?.ToString());
}
break;
}
catch (IOException ioe)
{
//almost certainly a problem with the pipe - recreate the pipe... try one more time.
//setupPipe();
if (retried)
{
//we tried - throw the error...
throw ioe;
}
else
{
retried = true; //fall back through to the while and try again
}
}
catch (Exception ex)
{
//if this fails it's usually because the writer is null/invalid. throwing IOException
//will trigger the pipe to rebuild
throw new IOException("Unexpected error when sending data to service. " + ex.Message);
}
}
}
private T read<T>(StreamReader reader) where T : SvcResponse
{
string respAsString = readMessage(reader);
T resp = (T)serializer.Deserialize(new StringReader(respAsString), typeof(T));
return resp;
}
private void processEvent(StreamReader reader)
{
try
{
string respAsString = readMessage(reader);
debugServiceCommunication("----------------------------------------------------------------------");
debugServiceCommunication(respAsString);
debugServiceCommunication("----------------------------------------------------------------------");
StatusEvent evt = (StatusEvent)serializer.Deserialize(new StringReader(respAsString), typeof(StatusEvent));
switch (evt.Op)
{
case "metrics":
MetricsEvent m = (MetricsEvent)serializer.Deserialize(new StringReader(respAsString), typeof(MetricsEvent));
if (m != null)
{
this.MetricsEvent(m.Identities);
}
break;
case "status":
TunnelStatusEvent se = (TunnelStatusEvent)serializer.Deserialize(new StringReader(respAsString), typeof(TunnelStatusEvent));
if (se != null)
{
this.TunnelStatusEvent(se);
}
break;
case "identity":
IdentityEvent id = (IdentityEvent)serializer.Deserialize(new StringReader(respAsString), typeof(IdentityEvent));
if (id != null)
{
this.IdentityEvent(id);
}
break;
case "service":
ServiceEvent svc = (ServiceEvent)serializer.Deserialize(new StringReader(respAsString), typeof(ServiceEvent));
if (svc != null)
{
this.ServiceEvent(svc);
}
break;
default:
Debug.WriteLine("unexpected operation! " + evt.Op);
break;
}
} catch (Exception e)
{
Debug.WriteLine(e.Message);
}
}
public string readMessage(StreamReader reader)
{
try
{
if (reader.EndOfStream)
{
throw new ServiceException("the pipe has closed", 0, "end of stream reached");
}
int emptyCount = 1; //just a stop gap in case something crazy happens in the communication
debugServiceCommunication( "=============== reading message =============== " + emptyCount);
string respAsString = reader.ReadLine();
debugServiceCommunication(respAsString);
debugServiceCommunication("=============== read message =============== " + emptyCount);
while (string.IsNullOrEmpty(respAsString?.Trim()))
{
if (reader.EndOfStream)
{
throw new Exception("the pipe has closed");
}
debugServiceCommunication("Received empty payload - continuing to read until a payload is received");
//now how'd that happen...
debugServiceCommunication("=============== reading message =============== " + emptyCount);
respAsString = reader.ReadLine();
debugServiceCommunication(respAsString);
debugServiceCommunication("=============== read message =============== " + emptyCount);
emptyCount++;
if (emptyCount > 5)
{
Debug.WriteLine("are we there yet? " + reader.EndOfStream);
//that's just too many...
//setupPipe();
return null;
}
}
debugServiceCommunication("");
debugServiceCommunication("");
return respAsString;
}
catch (IOException ioe)
{
//almost certainly a problem with the pipe
Debug.WriteLine("io error in read: " + ioe.Message);
ClientDisconnected(null);
throw ioe;
}
catch (Exception ee)
{
//almost certainly a problem with the pipe
Debug.WriteLine("unexpected error in read: " + ee.Message);
ClientDisconnected(null);
throw ee;
}
}
private void debugServiceCommunication(string msg)
{
if (_extendedDebug)
{
Debug.WriteLine(msg);
}
}
public ZitiTunnelStatus debug()
{
try
{
send(new ServiceFunction() { Function = "Debug" });
var rtn = read<ZitiTunnelStatus>(ipcReader);
return rtn;
}
catch (IOException ioe)
{
//almost certainly a problem with the pipe - recreate the pipe...
//setupPipe();
throw ioe;
}
}
}
}
+225
View File
@@ -0,0 +1,225 @@
using System;
using System.Collections.Generic;
/// <summary>
/// These classes represent the data structures that are passed back and forth
/// between the service and the client.
/// </summary>
namespace ZitiDesktopEdge.ServiceClient
{
class SvcResponse
{
public int Code { get; set; }
public string Message { get; set; }
public string Error { get; set; }
override public string ToString()
{
return $"Code: {Code}\nMessage: {Message}\nError: {Error}";
}
}
class StatusUpdateResponse : SvcResponse
{
public StatusUpdate Payload { get; set; }
}
class StatusUpdate
{
public string Operation { get; set; }
public TunnelStatus Status { get; set; }
public Identity NewIdentity { get; set; }
}
public class NewIdentity
{
public EnrollmentFlags Flags { get; set; }
public Identity Id { get; set; }
}
class IdentityResponse : SvcResponse
{
public Identity Payload { get; set; }
}
public class ServiceFunction
{
public string Function { get; set; }
}
public class FingerprintFunction : ServiceFunction
{
public FingerprintPayload Payload { get; set; }
}
public class BooleanPayload
{
public bool OnOff { get; set; }
}
public class BooleanFunction : ServiceFunction
{
public BooleanFunction(string functionName, bool theBool)
{
this.Function = functionName;
this.Payload = new BooleanPayload() { OnOff = theBool };
}
public BooleanPayload Payload { get; set; }
}
public class IdentityTogglePayload
{
public bool OnOff { get; set; }
public string Fingerprint { get; set; }
}
public class IdentityToggleFunction : ServiceFunction
{
public IdentityToggleFunction(string fingerprint, bool theBool)
{
this.Function = "IdentityOnOff";
this.Payload = new IdentityTogglePayload()
{
OnOff = theBool,
Fingerprint = fingerprint
};
}
public IdentityTogglePayload Payload { get; set; }
}
public class FingerprintPayload
{
public string Fingerprint { get; set; }
}
public class Id
{
public string key { get; set; }
public string cert { get; set; }
}
public class Config
{
public string ztAPI { get; set; }
public Id id { get; set; }
public object configTypes { get; set; }
}
public class Metrics
{
public int TotalBytes { get; set; }
public long Up { get; set; }
public long Down { get; set; }
}
public class Identity
{
public string Name { get; set; }
public string FingerPrint { get; set; }
public bool Active { get; set; }
public Config Config { get; set; }
public string Status { get; set; }
public List<Service> Services { get; set; }
public Metrics Metrics { get; set; }
}
public class Service
{
public string Name { get; set; }
public string HostName { get; set; }
public UInt16 Port { get; set; }
}
public class EnrollmentFlags
{
public string JwtString { get; set; }
public string CertFile { get; set; }
public string KeyFile { get; set; }
public string AdditionalCAs { get; set; }
}
class IpInfo
{
public string Ip { get; set; }
public string Subnet { get; set; }
public UInt16 MTU { get; set; }
public string DNS { get; set; }
}
class ZitiTunnelStatus : SvcResponse
{
public TunnelStatus Status { get; set; }
}
class TunnelStatus
{
public bool Active { get; set; }
public long Duration { get; set; }
public List<Identity> Identities { get; set; }
public IpInfo IpInfo { get; set; }
public void Dump(System.IO.TextWriter writer)
{
writer.WriteLine($"Tunnel Active: {Active}");
foreach (Identity id in Identities)
{
writer.WriteLine($" FingerPrint: {id.FingerPrint}");
writer.WriteLine($" Name: {id.Name}");
writer.WriteLine($" Active: {id.Active}");
writer.WriteLine($" Status: {id.Status}");
writer.WriteLine($" Services:");
foreach (Service s in id.Services)
{
writer.WriteLine($" Name: {s.Name} HostName: {s.HostName} Port: {s.Port}");
}
writer.WriteLine("=============================================");
}
}
}
public class ServiceException : System.Exception
{
public ServiceException(string Message, int Code, string AdditionalInfo) : base(Message)
{
this.Code = Code;
this.AdditionalInfo = AdditionalInfo;
}
public int Code { get; }
public string AdditionalInfo { get; }
}
class StatusEvent
{
public string Op { get; set; }
}
class ActionEvent : StatusEvent
{
public string Action { get; set; }
}
class TunnelStatusEvent : StatusEvent
{
public TunnelStatus Status { get; set; }
}
class MetricsEvent : StatusEvent
{
public List<Identity> Identities { get; set; }
}
class ServiceEvent : ActionEvent
{
public string Fingerprint { get; set; }
public Service Service { get; set; }
}
class IdentityEvent : ActionEvent
{
public Identity Id { get; set; }
}
}
+23
View File
@@ -0,0 +1,23 @@
<UserControl x:Class="ZitiDesktopEdge.ServiceInfo"
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:ZitiDesktopEdge"
mc:Ignorable="d"
d:DesignHeight="36" HorizontalAlignment="Stretch" d:DesignWidth="350" Cursor="Hand">
<Grid>
<StackPanel Orientation="Vertical">
<Grid Height="35">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="150"/>
</Grid.ColumnDefinitions>
<TextBox Name="MainLabel" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<TextBox Name="MainEdit" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
</Grid>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
</StackPanel>
</Grid>
</UserControl>
+59
View File
@@ -0,0 +1,59 @@
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 ZitiDesktopEdge {
/// <summary>
/// Interaction logic for MenuItem.xaml
/// </summary>
public partial class ServiceInfo: UserControl {
private string _label = "";
public string Label {
get {
return _label;
}
set {
this._label = value;
MainLabel.Text = this._label;
}
}
public string Value {
get {
return MainEdit.Text;
}
set {
MainEdit.Text = value;
}
}
public bool IsLocked {
get {
return MainEdit.IsReadOnly;
}
set {
MainEdit.IsReadOnly = value;
}
}
public ServiceInfo() {
InitializeComponent();
}
private void MainEdit_GotFocus(object sender, RoutedEventArgs e) {
var textbox = (sender as TextBox);
textbox.SelectAll();
}
}
}
+48
View File
@@ -0,0 +1,48 @@
<UserControl x:Class="ZitiDesktopEdge.SubMenuItem"
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:ZitiDesktopEdge"
mc:Ignorable="d"
d:DesignHeight="50" HorizontalAlignment="Stretch" d:DesignWidth="375" Cursor="Hand">
<UserControl.Triggers>
<EventTrigger RoutedEvent="UserControl.MouseEnter" >
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BgFill" From="0" To="0.2" Duration="0:0:0.5"></DoubleAnimation>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BgFill" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BgFill" From="0" To="0.2" Duration="0:0:0.5"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="UserControl.MouseLeave" >
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BgFill" From=".2" To="0" Duration="0:0:0.5"></DoubleAnimation>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BgFill" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BgFill" From=".2" To="0" Duration="0:0:0.5"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</UserControl.Triggers>
<Grid>
<Rectangle Name="BgFill" Fill="#7d8faf" Opacity="0"></Rectangle>
<StackPanel Orientation="Vertical">
<Grid Height="49">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Label Name="MainLabel" Grid.Column="0" Content="Main Menu" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></Label>
<Image Grid.Column="1" Cursor="Hand" Source="/Assets/Images/nextArrow.png" Width="20" Height="20" Margin="0,0,0,0" />
</Grid>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
</StackPanel>
</Grid>
</UserControl>
+38
View File
@@ -0,0 +1,38 @@
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 ZitiDesktopEdge {
/// <summary>
/// Interaction logic for MenuItem.xaml
/// </summary>
public partial class SubMenuItem : UserControl {
private string _label = "";
public string Label {
get {
return _label;
}
set {
this._label = value;
MainLabel.Content = this._label;
}
}
public SubMenuItem() {
InitializeComponent();
}
}
}
+6
View File
@@ -0,0 +1,6 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ZitiDesktopEdge">
</ResourceDictionary>
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+28
View File
@@ -0,0 +1,28 @@
<UserControl x:Class="ZitiDesktopEdge.Toggler"
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:ZitiDesktopEdge"
mc:Ignorable="d"
d:DesignHeight="20" d:DesignWidth="35" Width="35" Height="20" Padding="0,0,0,0" Loaded="OnLoad">
<StackPanel Orientation="Vertical" Margin="0,0,0,0">
<Canvas Name="LayoutRoot" Cursor="Hand" MouseDown="OnToggle">
<Canvas.Resources>
<Storyboard Name="AnimateOnBoard" x:Key="OnAnimate">
<DoubleAnimation Name="OpaqueOnAnimate" Storyboard.TargetName="OnColor" Storyboard.TargetProperty="Opacity" Duration="1" To="1"></DoubleAnimation>
</Storyboard>
<Storyboard Name="AnimateOffBoard" x:Key="OffAnimate">
<DoubleAnimation Name="OpaqueOffAnimate" Storyboard.TargetName="OnColor" Storyboard.TargetProperty="Opacity" Duration="1" To="1"></DoubleAnimation>
</Storyboard>
</Canvas.Resources>
<Border Name="BackColor" Width="35" Height="20" CornerRadius="9" Background="#E5EAED"></Border>
<Border Name="OnColor" Width="35" Height="20" CornerRadius="9" Background="#34A22B" Opacity="0"></Border>
<Border Name="ToggleTab" Width="18" Height="18" Canvas.Top="1" Canvas.Left="1" CornerRadius="9,9,9,9" Background="White">
<Border.Effect>
<DropShadowEffect Direction="270" Opacity=".2" />
</Border.Effect>
</Border>
</Canvas>
</StackPanel>
</UserControl>
+69
View File
@@ -0,0 +1,69 @@
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;
using System.Windows.Media.Animation;
namespace ZitiDesktopEdge {
/// <summary>
/// Interaction logic for Toggler.xaml
/// </summary>
public partial class Toggler : UserControl {
public delegate void Toggled(bool on);
public event Toggled OnToggled;
private bool _isEnabled = false;
public Toggler() {
InitializeComponent();
}
public Boolean Enabled {
get {
return _isEnabled;
}
set {
_isEnabled = value;
// Clinton of the Clints... Need to blow an event bubble and turn this bad boy on or off
if (_isEnabled) {
OnColor.Opacity = 1;
// ToggleTab.SetValue(Canvas.LeftProperty, 11);
Canvas.SetLeft(ToggleTab, 16);
//Storyboard board = LayoutRoot.FindResource("OnAnimate") as Storyboard;
//board.Begin();
} else {
OnColor.Opacity = 0;
// ToggleTab.SetValue(Canvas.LeftProperty, "1");
Canvas.SetLeft(ToggleTab, 1);
//Storyboard board = LayoutRoot.FindResource("OffAnimate") as Storyboard;
//board.Begin();
}
}
}
private void OnToggle(object sender, RoutedEventArgs e) {
Enabled = !Enabled;
if (OnToggled != null) {
OnToggled(Enabled);
}
}
private void OnLoad(object sender, RoutedEventArgs e) {
if (_isEnabled) {
} else {
}
}
}
}
+353
View File
@@ -0,0 +1,353 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FA4291EA-A97E-4854-959F-91EE7B330B37}</ProjectGuid>
<OutputType>WinExe</OutputType>
<<<<<<< HEAD:DesktopEdge/ZitiDesktopEdge.csproj
<RootNamespace>Ziti</RootNamespace>
<AssemblyName>Ziti Desktop Edge</AssemblyName>
=======
<RootNamespace>Ziti.Desktop.Edge</RootNamespace>
<AssemblyName>ZitiDesktopEdge</AssemblyName>
>>>>>>> origin/master:DesktopEdge/ZitiDekstopEdge.csproj
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<SupportUrl>https://support.netfoundry.io</SupportUrl>
<TargetCulture>en-US</TargetCulture>
<ProductName>Ziti Desktop Edge</ProductName>
<PublisherName>NetFoundry</PublisherName>
<SuiteName>Ziti</SuiteName>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>189AAD422A106DC81E8E79C7E0D2118CEB2E6321</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Releases|AnyCPU'">
<OutputPath>bin\Releases\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ziti.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Management.Automation.dll.10.0.10586.0\lib\net40\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Management.Instrumentation" />
<Reference Include="System.Net" />
<Reference Include="System.Net.NetworkInformation, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.NetworkInformation.4.3.0\lib\net46\System.Net.NetworkInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ControllerScreen.xaml.cs">
<DependentUpon>ControllerScreen.xaml</DependentUpon>
</Compile>
<Compile Include="IdentityDetails.xaml.cs">
<DependentUpon>IdentityDetails.xaml</DependentUpon>
</Compile>
<Compile Include="MainMenu.xaml.cs">
<DependentUpon>MainMenu.xaml</DependentUpon>
</Compile>
<Compile Include="Models\UILog.cs" />
<Compile Include="Models\UIModel.cs" />
<Compile Include="ServiceInfo.xaml.cs">
<DependentUpon>ServiceInfo.xaml</DependentUpon>
</Compile>
<Compile Include="MenuEditItem.xaml.cs">
<DependentUpon>MenuEditItem.xaml</DependentUpon>
</Compile>
<Compile Include="ServiceClient\DataStructures.cs" />
<Compile Include="ServiceClient\ClientImpl.cs" />
<Compile Include="RegistrationScreen.xaml.cs">
<DependentUpon>RegistrationScreen.xaml</DependentUpon>
</Compile>
<Compile Include="SubMenuItem.xaml.cs">
<DependentUpon>SubMenuItem.xaml</DependentUpon>
</Compile>
<Compile Include="MenuItem.xaml.cs">
<DependentUpon>MenuItem.xaml</DependentUpon>
</Compile>
<Compile Include="Models\ZitiIdentity.cs" />
<Compile Include="Models\ZitiService.cs" />
<Compile Include="Toggler.xaml.cs">
<DependentUpon>Toggler.xaml</DependentUpon>
</Compile>
<Page Include="ControllerScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="IdentityDetails.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="IdentityItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainMenu.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="IdentityItem.xaml.cs">
<DependentUpon>IdentityItem.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="ServiceInfo.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MenuEditItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="RegistrationScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SubMenuItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MenuItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Toggler.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="ZitiDesktopEdge_TemporaryKey.pfx" />
<Resource Include="Assets\Fonts\open_sans.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Fonts\russo_one.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<None Include="..\.editorconfig">
<Link>.editorconfig</Link>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\icon.ico" />
<Resource Include="Assets\Images\icon.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\identity.png" />
<Resource Include="Assets\Images\jwt.png" />
<Resource Include="Assets\Images\loading.png" />
<Resource Include="Assets\Images\logo.png" />
<Resource Include="Assets\Images\next.png" />
<Resource Include="Assets\Images\off.png" />
<Resource Include="Assets\Images\offline.png" />
<Resource Include="Assets\Images\on.png" />
<Resource Include="Assets\Images\online.png" />
<Resource Include="Assets\Images\open.png" />
<Resource Include="Assets\Images\privacy.png" />
<Resource Include="Assets\Images\qr.png" />
<Resource Include="Assets\Images\select.png" />
<Resource Include="Assets\Images\support.png" />
<Resource Include="Assets\Images\up.png" />
<Resource Include="Assets\Images\z.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\about.png" />
<Resource Include="Assets\Images\advanced.png" />
<Resource Include="Assets\Images\appicon.png" />
<Resource Include="Assets\Images\back.png" />
<Resource Include="Assets\Images\background.png" />
<Resource Include="Assets\Images\bubble.png" />
<Resource Include="Assets\Images\card.png" />
<Resource Include="Assets\Images\close.png" />
<Resource Include="Assets\Images\closer.png" />
<Resource Include="Assets\Images\connect.png" />
<Resource Include="Assets\Images\connected.png" />
<Resource Include="Assets\Images\dashboard.png" />
<Resource Include="Assets\Images\down.png" />
<Resource Include="Assets\Images\feedback.png" />
<Resource Include="Assets\Images\globe.png" />
<Resource Include="Assets\Images\hamburger.png" />
<Resource Include="Assets\Images\header.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\x.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\nextArrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\lastArrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\logs.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\wrench.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\detach.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\ziti-green.ico" />
<Resource Include="Assets\Images\Ziti-Green.png" />
<Resource Include="Assets\Images\ziti-red.ico" />
<Resource Include="Assets\Images\Ziti-Red.png" />
<Resource Include="Assets\Images\ziti-white.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\Ziti-White.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="ziti.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\server.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Views\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+353
View File
@@ -0,0 +1,353 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FA4291EA-A97E-4854-959F-91EE7B330B37}</ProjectGuid>
<OutputType>WinExe</OutputType>
<<<<<<< HEAD:DesktopEdge/ZitiDesktopEdge.csproj
<RootNamespace>Ziti</RootNamespace>
<AssemblyName>Ziti Desktop Edge</AssemblyName>
=======
<RootNamespace>Ziti.Desktop.Edge</RootNamespace>
<AssemblyName>ZitiDesktopEdge</AssemblyName>
>>>>>>> origin/master:DesktopEdge/ZitiDekstopEdge.csproj
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<SupportUrl>https://support.netfoundry.io</SupportUrl>
<TargetCulture>en-US</TargetCulture>
<ProductName>Ziti Desktop Edge</ProductName>
<PublisherName>NetFoundry</PublisherName>
<SuiteName>Ziti</SuiteName>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>189AAD422A106DC81E8E79C7E0D2118CEB2E6321</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Releases|AnyCPU'">
<OutputPath>bin\Releases\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ziti.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Management.Automation.dll.10.0.10586.0\lib\net40\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Management.Instrumentation" />
<Reference Include="System.Net" />
<Reference Include="System.Net.NetworkInformation, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.NetworkInformation.4.3.0\lib\net46\System.Net.NetworkInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ControllerScreen.xaml.cs">
<DependentUpon>ControllerScreen.xaml</DependentUpon>
</Compile>
<Compile Include="IdentityDetails.xaml.cs">
<DependentUpon>IdentityDetails.xaml</DependentUpon>
</Compile>
<Compile Include="MainMenu.xaml.cs">
<DependentUpon>MainMenu.xaml</DependentUpon>
</Compile>
<Compile Include="Models\UILog.cs" />
<Compile Include="Models\UIModel.cs" />
<Compile Include="ServiceInfo.xaml.cs">
<DependentUpon>ServiceInfo.xaml</DependentUpon>
</Compile>
<Compile Include="MenuEditItem.xaml.cs">
<DependentUpon>MenuEditItem.xaml</DependentUpon>
</Compile>
<Compile Include="ServiceClient\DataStructures.cs" />
<Compile Include="ServiceClient\ClientImpl.cs" />
<Compile Include="RegistrationScreen.xaml.cs">
<DependentUpon>RegistrationScreen.xaml</DependentUpon>
</Compile>
<Compile Include="SubMenuItem.xaml.cs">
<DependentUpon>SubMenuItem.xaml</DependentUpon>
</Compile>
<Compile Include="MenuItem.xaml.cs">
<DependentUpon>MenuItem.xaml</DependentUpon>
</Compile>
<Compile Include="Models\ZitiIdentity.cs" />
<Compile Include="Models\ZitiService.cs" />
<Compile Include="Toggler.xaml.cs">
<DependentUpon>Toggler.xaml</DependentUpon>
</Compile>
<Page Include="ControllerScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="IdentityDetails.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="IdentityItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainMenu.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="IdentityItem.xaml.cs">
<DependentUpon>IdentityItem.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="ServiceInfo.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MenuEditItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="RegistrationScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SubMenuItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MenuItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Toggler.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="ZitiDesktopEdge_TemporaryKey.pfx" />
<Resource Include="Assets\Fonts\open_sans.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Fonts\russo_one.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<None Include="..\.editorconfig">
<Link>.editorconfig</Link>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\icon.ico" />
<Resource Include="Assets\Images\icon.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\identity.png" />
<Resource Include="Assets\Images\jwt.png" />
<Resource Include="Assets\Images\loading.png" />
<Resource Include="Assets\Images\logo.png" />
<Resource Include="Assets\Images\next.png" />
<Resource Include="Assets\Images\off.png" />
<Resource Include="Assets\Images\offline.png" />
<Resource Include="Assets\Images\on.png" />
<Resource Include="Assets\Images\online.png" />
<Resource Include="Assets\Images\open.png" />
<Resource Include="Assets\Images\privacy.png" />
<Resource Include="Assets\Images\qr.png" />
<Resource Include="Assets\Images\select.png" />
<Resource Include="Assets\Images\support.png" />
<Resource Include="Assets\Images\up.png" />
<Resource Include="Assets\Images\z.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\about.png" />
<Resource Include="Assets\Images\advanced.png" />
<Resource Include="Assets\Images\appicon.png" />
<Resource Include="Assets\Images\back.png" />
<Resource Include="Assets\Images\background.png" />
<Resource Include="Assets\Images\bubble.png" />
<Resource Include="Assets\Images\card.png" />
<Resource Include="Assets\Images\close.png" />
<Resource Include="Assets\Images\closer.png" />
<Resource Include="Assets\Images\connect.png" />
<Resource Include="Assets\Images\connected.png" />
<Resource Include="Assets\Images\dashboard.png" />
<Resource Include="Assets\Images\down.png" />
<Resource Include="Assets\Images\feedback.png" />
<Resource Include="Assets\Images\globe.png" />
<Resource Include="Assets\Images\hamburger.png" />
<Resource Include="Assets\Images\header.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\x.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\nextArrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\lastArrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\logs.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\wrench.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\detach.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\ziti-green.ico" />
<Resource Include="Assets\Images\Ziti-Green.png" />
<Resource Include="Assets\Images\ziti-red.ico" />
<Resource Include="Assets\Images\Ziti-Red.png" />
<Resource Include="Assets\Images\ziti-white.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\Ziti-White.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="ziti.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\server.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Views\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+71
View File
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<!--requestedExecutionLevel level="requireAdministrator" uiAccess="false" /-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet ID="Custom" SameSite="site" Unrestricted="true" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
<package id="System.Management.Automation.dll" version="10.0.10586.0" targetFramework="net48" />
<package id="System.Net.NetworkInformation" version="4.3.0" targetFramework="net48" />
</packages>
Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB