mirror of
https://github.com/openziti/desktop-edge-win.git
synced 2026-10-20 03:11:59 +00:00
Merge pull request #72 from openziti/merge-clint
merging latest ui to release branch
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -32,7 +32,7 @@
|
||||
<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>
|
||||
<Image Grid.Column="2" Cursor="Hand" Source="/Assets/Images/x.png" Width="20" Height="20" Margin="0,0,0,0" HorizontalAlignment="Right" MouseUp="HideMenu"></Image>
|
||||
</Grid>
|
||||
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
|
||||
<Grid>
|
||||
@@ -44,8 +44,8 @@
|
||||
<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>
|
||||
<Label Name="ForgetIdentityButton" Margin="0,10,0,10" Content="Forget This Identity" Cursor="Hand" Foreground="#F4044D" HorizontalAlignment="Center" Mouse.MouseUp="ForgetIdentity"></Label>
|
||||
<Image Source="/Assets/Images/identity.png" Height="100" Width="100" Opacity="0.3" HorizontalAlignment="Stretch"></Image>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace ZitiDesktopEdge {
|
||||
ServiceInfo editor = new ServiceInfo();
|
||||
editor.Label = _identity.Services[i].Name;
|
||||
editor.Value = _identity.Services[i].Url;
|
||||
editor.Warning = _identity.Services[i].Warning;
|
||||
editor.IsLocked = true;
|
||||
ServiceList.Children.Add(editor);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<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>
|
||||
<Image Grid.Column="2" Cursor="Hand" Source="/Assets/Images/x.png" Height="20" Margin="50,4,0,5" MouseUp="HideMenu"></Image>
|
||||
</Grid>
|
||||
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
|
||||
<StackPanel Name="MainItems" Orientation="Vertical" HorizontalAlignment="Stretch">
|
||||
@@ -71,7 +71,7 @@
|
||||
<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>
|
||||
<Label Name="MainItemsButton" Margin="0,30,0,0" Foreground="#F4044D" FontWeight="SemiBold" Content="Quit Ziti Desktop Edge" Cursor="Hand" MouseUp="CloseApp" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -6,6 +6,10 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Management.Automation;
|
||||
using ZitiDesktopEdge.Models;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Net.Mail;
|
||||
using System.IO;
|
||||
|
||||
namespace ZitiDesktopEdge
|
||||
{
|
||||
@@ -18,7 +22,7 @@ namespace ZitiDesktopEdge
|
||||
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 string licenseData = "it's open source.";
|
||||
|
||||
public MainMenu() {
|
||||
InitializeComponent();
|
||||
@@ -92,7 +96,6 @@ namespace ZitiDesktopEdge
|
||||
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;
|
||||
@@ -130,7 +133,47 @@ namespace ZitiDesktopEdge
|
||||
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 });
|
||||
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
|
||||
var mailMessage = new MailMessage();
|
||||
mailMessage.From = new MailAddress("ziti-support@netfoundry.io");
|
||||
mailMessage.Subject = "Ziti Support";
|
||||
mailMessage.IsBodyHtml = true;
|
||||
mailMessage.Body = "";
|
||||
|
||||
string serviceLogTempFile = Path.Combine(Path.GetTempPath(), "Ziti-Service.log");
|
||||
using (StreamWriter sw = new StreamWriter(serviceLogTempFile)) {
|
||||
sw.WriteLine(client.GetLogs());
|
||||
}
|
||||
|
||||
string uiLogTempFile = Path.Combine(Path.GetTempPath(), "Ziti-Application.log");
|
||||
using (StreamWriter sw = new StreamWriter(uiLogTempFile)) {
|
||||
sw.WriteLine(UILog.GetLogs());
|
||||
}
|
||||
|
||||
mailMessage.Attachments.Add(new Attachment(serviceLogTempFile));
|
||||
mailMessage.Attachments.Add(new Attachment(uiLogTempFile));
|
||||
|
||||
string emlFile = Path.Combine(Path.GetTempPath(), "ziti.eml");
|
||||
|
||||
using (var filestream = File.Open(emlFile, FileMode.Create)) {
|
||||
var binaryWriter = new BinaryWriter(filestream);
|
||||
binaryWriter.Write(System.Text.Encoding.UTF8.GetBytes("X-Unsent: 1" + Environment.NewLine));
|
||||
var assembly = typeof(SmtpClient).Assembly;
|
||||
var mailWriterType = assembly.GetType("System.Net.Mail.MailWriter");
|
||||
var mailWriterContructor = mailWriterType.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(Stream) }, null);
|
||||
var mailWriter = mailWriterContructor.Invoke(new object[] { filestream });
|
||||
var sendMethod = typeof(MailMessage).GetMethod("Send", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
sendMethod.Invoke(mailMessage, BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { mailWriter, true, true }, null);
|
||||
var closeMethod = mailWriter.GetType().GetMethod("Close", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
closeMethod.Invoke(mailWriter, BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { }, null);
|
||||
}
|
||||
|
||||
Process.Start(emlFile);
|
||||
|
||||
|
||||
|
||||
//string body = HttpUtility.UrlEncode("\n\nService Logs\n\n" + client.GetLogs());// + "\n\nApplication Logs\n\n" + UILog.GetLogs());
|
||||
//Process.Start(new ProcessStartInfo("mailto:ziti-support@netfoundry.io?subject=Ziti%20Support&body="+body) { UseShellExecute = true });
|
||||
}
|
||||
private void ShowSupport(object sender, MouseButtonEventArgs e) {
|
||||
Process.Start(new ProcessStartInfo("https://openziti.discourse.group/") { UseShellExecute = true });
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
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">
|
||||
WindowStyle="None" Loaded="MainWindow_Loaded" Background="#000F0F23">
|
||||
<Window.Resources>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality" />
|
||||
@@ -136,7 +136,7 @@
|
||||
</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>
|
||||
<Label Content="Tap to Connect" MouseDoubleClick="Label_MouseDoubleClick" 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>
|
||||
@@ -146,7 +146,11 @@
|
||||
</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.ColumnDefinitions>
|
||||
<ColumnDefinition Width="221*"/>
|
||||
<ColumnDefinition Width="129*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Source="/Assets/Images/connect.png" Height="140" HorizontalAlignment="Center" Grid.ColumnSpan="2" Margin="105,0" />
|
||||
</Grid>
|
||||
</Canvas>
|
||||
<Canvas Name="DisconnectButton" Width="350" Height="160" MouseDown="Disconnect" Visibility="Collapsed">
|
||||
@@ -216,8 +220,8 @@
|
||||
<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 x:Name="ErrorMsg" Foreground="White" Content="Service Not Started" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"/>
|
||||
<Label x:Name="ErrorMsgDetail" 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>
|
||||
|
||||
@@ -17,6 +17,8 @@ using System.Windows.Controls;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace ZitiDesktopEdge {
|
||||
|
||||
@@ -80,13 +82,15 @@ namespace ZitiDesktopEdge {
|
||||
|
||||
private void MainWindow_Activated(object sender, EventArgs e) {
|
||||
this.Visibility = Visibility.Visible;
|
||||
Debug.WriteLine("Activation");
|
||||
Placement();
|
||||
}
|
||||
|
||||
private void MainWindow_Deactivated(object sender, EventArgs e) {
|
||||
#if DEBUG
|
||||
Debug.WriteLine("debug is enabled - not minimizing window");
|
||||
Debug.WriteLine("debug is enabled - windows pinned");
|
||||
#else
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -95,34 +99,28 @@ namespace ZitiDesktopEdge {
|
||||
notifyIcon.Icon.Dispose();
|
||||
notifyIcon.Dispose();
|
||||
}
|
||||
|
||||
private void SetCantDisplay() {
|
||||
|
||||
private void SetCantDisplay(string msg, string detailMessage) {
|
||||
NoServiceView.Visibility = Visibility.Visible;
|
||||
ErrorMsg.Content = msg;
|
||||
ErrorMsgDetail.Content = detailMessage;
|
||||
SetNotifyIcon("red");
|
||||
}
|
||||
|
||||
private void SetCanDisplay() {
|
||||
NoServiceView.Visibility = Visibility.Collapsed;
|
||||
SetNotifyIcon("green");
|
||||
private void SetCantDisplay() {
|
||||
SetCantDisplay("Service Not Started", "Start the Ziti Tunnel Service to get started");
|
||||
}
|
||||
|
||||
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;
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e) {
|
||||
Placement();
|
||||
// add a new service client
|
||||
serviceClient = new Client();
|
||||
serviceClient.OnClientConnected += ServiceClient_OnClientConnected;
|
||||
@@ -144,7 +142,7 @@ namespace ZitiDesktopEdge {
|
||||
} catch /*ignored for now (Exception ex) */{
|
||||
SetCantDisplay();
|
||||
}
|
||||
LoadIdentities();
|
||||
Debug.WriteLine("App Loaded");
|
||||
IdentityMenu.OnForgot += IdentityForgotten;
|
||||
}
|
||||
|
||||
@@ -157,6 +155,7 @@ namespace ZitiDesktopEdge {
|
||||
//e is _ALWAYS_ null at this time use this to display something if you want
|
||||
NoServiceView.Visibility = Visibility.Collapsed;
|
||||
SetNotifyIcon("white");
|
||||
LoadIdentities(true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -177,6 +176,7 @@ namespace ZitiDesktopEdge {
|
||||
var found = identities.Find(i => i.Fingerprint == e.Id.FingerPrint);
|
||||
if (found == null) {
|
||||
identities.Add(zid);
|
||||
LoadIdentities(true);
|
||||
} else {
|
||||
//if we get here exit out so that LoadIdentities() doesn't get called
|
||||
found.IsEnabled = true;
|
||||
@@ -185,7 +185,6 @@ namespace ZitiDesktopEdge {
|
||||
} else {
|
||||
IdentityForgotten(ZitiIdentity.FromClient(e.Id));
|
||||
}
|
||||
LoadIdentities();
|
||||
});
|
||||
Debug.WriteLine($"IDENTITY EVENT. Action: {e.Action} fingerprint: {zid.Fingerprint}");
|
||||
}
|
||||
@@ -195,7 +194,7 @@ namespace ZitiDesktopEdge {
|
||||
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}");
|
||||
//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;
|
||||
@@ -231,7 +230,7 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
|
||||
if (e.Action == "added") {
|
||||
ZitiService zs = new ZitiService(e.Service.Name, e.Service.HostName, e.Service.Port);
|
||||
ZitiService zs = new ZitiService(e.Service.Name, e.Service.HostName, e.Service.Port, ""); // CLINT: Gimme an error
|
||||
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.");
|
||||
@@ -239,18 +238,23 @@ namespace ZitiDesktopEdge {
|
||||
Debug.WriteLine("removing the service named: " + e.Service.Name);
|
||||
found.Services.RemoveAll(s => s.Name == e.Service.Name);
|
||||
}
|
||||
LoadIdentities();
|
||||
LoadIdentities(false);
|
||||
});
|
||||
}
|
||||
|
||||
private void ServiceClient_OnTunnelStatusEvent(object sender, TunnelStatusEvent e)
|
||||
{
|
||||
private void ServiceClient_OnTunnelStatusEvent(object sender, TunnelStatusEvent e) {
|
||||
if (e == null) return; //just skip it for now...
|
||||
Debug.WriteLine($"==== TunnelStatusEvent: ");
|
||||
this.Dispatcher.Invoke(() => {
|
||||
/* coming soon
|
||||
if(e.ApiVersion != Client.EXPECTED_API_VERSION) {
|
||||
SetCantDisplay("Version mismatch!", "The version of the Service is not compatible");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
InitializeTimer((int)e.Status.Duration);
|
||||
LoadStatusFromService(e.Status);
|
||||
LoadIdentities();
|
||||
LoadIdentities(false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -263,22 +267,17 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
}
|
||||
identities.Remove(idToRemove);
|
||||
LoadIdentities();
|
||||
LoadIdentities(false);
|
||||
}
|
||||
|
||||
private void AttachmentChanged(bool attached) {
|
||||
_isAttached = attached;
|
||||
if (_isAttached) {
|
||||
Arrow.Visibility = Visibility.Visible;
|
||||
if (!_isAttached) {
|
||||
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;
|
||||
this.Left = desktopWorkingArea.Right - this.Width - 75;
|
||||
this.Top = desktopWorkingArea.Bottom - this.Height - 75;
|
||||
}
|
||||
Placement();
|
||||
MainMenu.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
@@ -314,7 +313,8 @@ namespace ZitiDesktopEdge {
|
||||
foreach (var id in status.Identities) {
|
||||
updateViewWithIdentity(id);
|
||||
}
|
||||
LoadIdentities();
|
||||
Debug.WriteLine("Load From Service");
|
||||
LoadIdentities(true);
|
||||
} else {
|
||||
SetCantDisplay();
|
||||
}
|
||||
@@ -329,7 +329,6 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
}
|
||||
identities.Add(zid);
|
||||
LoadIdentities();
|
||||
}
|
||||
private void SetNotifyIcon(string iconPrefix) {
|
||||
var iconUri = new Uri("pack://application:,,/Assets/Images/ziti-" + iconPrefix + ".ico");
|
||||
@@ -339,13 +338,15 @@ namespace ZitiDesktopEdge {
|
||||
Application.Current.MainWindow.Icon = System.Windows.Media.Imaging.BitmapFrame.Create(iconUri);
|
||||
}
|
||||
|
||||
private void LoadIdentities() {
|
||||
private void LoadIdentities(Boolean repaint) {
|
||||
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;
|
||||
double height = 460 + (ids.Length * 60);
|
||||
if (height > _maxHeight) height = _maxHeight;
|
||||
Debug.WriteLine("Set Height: " + height);
|
||||
this.Height = height;
|
||||
IdentityMenu.SetHeight(this.Height-160);
|
||||
for (int i=0; i<ids.Length; i++) {
|
||||
IdentityItem id = new IdentityItem();
|
||||
@@ -359,11 +360,21 @@ namespace ZitiDesktopEdge {
|
||||
IdList.Children.Add(id);
|
||||
IdList.Height += 60;
|
||||
}
|
||||
Debug.WriteLine("Ids Loaded "+ ids.Length);
|
||||
if (this._isAttached&&repaint) Placement();
|
||||
}
|
||||
|
||||
public void Placement() {
|
||||
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
|
||||
if (this._isAttached) {
|
||||
if (_isAttached) {
|
||||
Arrow.Visibility = Visibility.Visible;
|
||||
this.Left = desktopWorkingArea.Right - this.Width - _right;
|
||||
this.Top = desktopWorkingArea.Bottom - this.Height - _bottom;
|
||||
} else {
|
||||
Arrow.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
Debug.WriteLine("Placement: " + this.Left + " " + desktopWorkingArea.Right + " " + this.Width + " " + _right);
|
||||
Debug.WriteLine("Place: " + this.Top + " " + desktopWorkingArea.Bottom + " " + this.Height + " " + _bottom);
|
||||
}
|
||||
|
||||
private void OpenIdentity(ZitiIdentity identity) {
|
||||
@@ -391,7 +402,7 @@ namespace ZitiDesktopEdge {
|
||||
client.IdentityOnOff(createdId.FingerPrint, true);
|
||||
if (createdId != null) {
|
||||
identities.Add(ZitiIdentity.FromClient(createdId));
|
||||
LoadIdentities();
|
||||
LoadIdentities(true);
|
||||
} else {
|
||||
ShowError("Identity Error", "Identity Id was null, please try again");
|
||||
}
|
||||
@@ -400,7 +411,6 @@ namespace ZitiDesktopEdge {
|
||||
} catch (Exception ex) {
|
||||
ShowError("Unexpected Error", "Code 2:" + ex.Message);
|
||||
}
|
||||
LoadIdentities();
|
||||
HideLoad();
|
||||
}
|
||||
}
|
||||
@@ -518,18 +528,17 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
|
||||
private void MainUI_Deactivated(object sender, EventArgs e) {
|
||||
if (UIModel.HideOnLostFocus)
|
||||
{
|
||||
if (UIModel.HideOnLostFocus) {
|
||||
#if DEBUG
|
||||
Debug.WriteLine("debug is enabled - not minimizing window");
|
||||
Debug.WriteLine("debug is enabled - windows pinned");
|
||||
#else
|
||||
this.WindowState = WindowState.Minimized;
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private void MainUI_Activated(object sender, EventArgs e) {
|
||||
this.WindowState = WindowState.Normal;
|
||||
private void Label_MouseDoubleClick(object sender, MouseButtonEventArgs e) {
|
||||
Placement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,9 @@ namespace ZitiDesktopEdge.Models {
|
||||
Status = id.Status,
|
||||
};
|
||||
|
||||
if (id.Services != null)
|
||||
{
|
||||
foreach (var svc in id.Services)
|
||||
{
|
||||
var zsvc = new ZitiService(svc.Name, svc.HostName, svc.Port);
|
||||
if (id.Services != null) {
|
||||
foreach (var svc in id.Services) {
|
||||
var zsvc = new ZitiService(svc.Name, svc.HostName, svc.Port, ""); // CLINT: Warning needed
|
||||
zid.Services.Add(zsvc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@ namespace ZitiDesktopEdge.Models {
|
||||
public class ZitiService {
|
||||
public string Name { get; set; }
|
||||
public string Url { get; set; }
|
||||
public ZitiService(string Name, string hostname, int port) {
|
||||
public string Warning { get; set; }
|
||||
public ZitiService(string Name, string hostname, int port, string warning) {
|
||||
this.Name = Name;
|
||||
this.Url = hostname + ":" + port;
|
||||
this.Warning = warning;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition x:Name="WarningColumn" Width="0"/>
|
||||
</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>
|
||||
<Image x:Name="WarnIcon" Visibility="Collapsed" Source="/Assets/Images/Warning.png" Grid.Column="2" Width="20" Height="20"/>
|
||||
</Grid>
|
||||
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
|
||||
</StackPanel>
|
||||
@@ -20,6 +20,21 @@ namespace ZitiDesktopEdge {
|
||||
public partial class ServiceInfo: UserControl {
|
||||
|
||||
private string _label = "";
|
||||
private string _warning = "";
|
||||
|
||||
public string Warning {
|
||||
get {
|
||||
return _warning;
|
||||
}
|
||||
set {
|
||||
_warning = value;
|
||||
if (_warning.Length>0) {
|
||||
WarnIcon.ToolTip = _warning;
|
||||
WarnIcon.Visibility = Visibility.Visible;
|
||||
WarningColumn.Width = new GridLength(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Label {
|
||||
get {
|
||||
@@ -104,6 +104,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -134,10 +135,10 @@
|
||||
</Compile>
|
||||
<Compile Include="Models\UILog.cs" />
|
||||
<Compile Include="Models\UIModel.cs" />
|
||||
<Compile Include="ServiceInfo.xaml.cs">
|
||||
<Compile Include="Views\ItemRenderers\ServiceInfo.xaml.cs">
|
||||
<DependentUpon>ServiceInfo.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MenuEditItem.xaml.cs">
|
||||
<Compile Include="Views\ItemRenderers\MenuEditItem.xaml.cs">
|
||||
<DependentUpon>MenuEditItem.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ServiceClient\DataStructures.cs" />
|
||||
@@ -145,10 +146,10 @@
|
||||
<Compile Include="RegistrationScreen.xaml.cs">
|
||||
<DependentUpon>RegistrationScreen.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SubMenuItem.xaml.cs">
|
||||
<Compile Include="Views\ItemRenderers\SubMenuItem.xaml.cs">
|
||||
<DependentUpon>SubMenuItem.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MenuItem.xaml.cs">
|
||||
<Compile Include="Views\ItemRenderers\MenuItem.xaml.cs">
|
||||
<DependentUpon>MenuItem.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\ZitiIdentity.cs" />
|
||||
@@ -164,7 +165,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="IdentityItem.xaml">
|
||||
<Page Include="Views\ItemRenderers\IdentityItem.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@@ -180,18 +181,18 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IdentityItem.xaml.cs">
|
||||
<Compile Include="Views\ItemRenderers\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">
|
||||
<Page Include="Views\ItemRenderers\ServiceInfo.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MenuEditItem.xaml">
|
||||
<Page Include="Views\ItemRenderers\MenuEditItem.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -199,11 +200,11 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="SubMenuItem.xaml">
|
||||
<Page Include="Views\ItemRenderers\SubMenuItem.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MenuItem.xaml">
|
||||
<Page Include="Views\ItemRenderers\MenuItem.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@@ -342,7 +343,11 @@
|
||||
<Resource Include="Assets\Images\server.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\" />
|
||||
<Folder Include="Views\Controls\" />
|
||||
<Folder Include="Views\Screens\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\Images\Warning.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user