diff --git a/ZitiTunneler/IdentityDetails.xaml b/ZitiTunneler/IdentityDetails.xaml
index 221138df..c51593bc 100644
--- a/ZitiTunneler/IdentityDetails.xaml
+++ b/ZitiTunneler/IdentityDetails.xaml
@@ -42,7 +42,7 @@
-
+
diff --git a/ZitiTunneler/IdentityDetails.xaml.cs b/ZitiTunneler/IdentityDetails.xaml.cs
index 685a0ba1..7a7f8f87 100644
--- a/ZitiTunneler/IdentityDetails.xaml.cs
+++ b/ZitiTunneler/IdentityDetails.xaml.cs
@@ -21,6 +21,8 @@ namespace ZitiTunneler {
public partial class IdentityDetails:UserControl {
private bool _isAttached = true;
+ public delegate void Forgot(ZitiIdentity forgotten);
+ public event Forgot OnForgot;
private List identities {
get {
@@ -63,7 +65,7 @@ namespace ZitiTunneler {
IdentityStatus.Value = _identity.Status;
ServiceList.Children.Clear();
for (int i=0; i<_identity.Services.Count; i++) {
- MenuEditItem editor = new MenuEditItem();
+ ServiceInfo editor = new ServiceInfo();
editor.Label = _identity.Services[i].Name;
editor.Value = _identity.Services[i].Url;
editor.IsLocked = true;
@@ -86,21 +88,30 @@ namespace ZitiTunneler {
private void ForgetIdentity(object sender, MouseButtonEventArgs e) {
// Jeremy - this works now as long as you pass a fingerprint that's valid!
- this.Visibility = Visibility.Collapsed;
- ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
- try {
- client.RemoveIdentity(_identity.Fingerprint);
+ MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure you want to forget this identity?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);
+ if (messageBoxResult == MessageBoxResult.Yes) {
+ this.Visibility = Visibility.Collapsed;
+ ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
+ try {
+ client.RemoveIdentity(_identity.Fingerprint);
- foreach (var id in identities) {
- if (id.Fingerprint == _identity.Fingerprint) {
- identities.Remove(id);
- break;
+ 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) {
+ MessageBox.Show(se.AdditionalInfo, se.Message);
+ } catch (Exception ex) {
+ MessageBox.Show("Unexpected error 1", ex.Message);
}
- } catch (ServiceClient.ServiceException se) {
- MessageBox.Show(se.AdditionalInfo, se.Message);
- } catch (Exception ex) {
- MessageBox.Show("Unexpected error 1", ex.Message);
}
}
}
diff --git a/ZitiTunneler/MainMenu.xaml b/ZitiTunneler/MainMenu.xaml
index 452164b3..c8d1dbb2 100644
--- a/ZitiTunneler/MainMenu.xaml
+++ b/ZitiTunneler/MainMenu.xaml
@@ -27,7 +27,7 @@
-
+
@@ -78,9 +78,9 @@
-
-
-
+
+
+
diff --git a/ZitiTunneler/MainWindow.xaml.cs b/ZitiTunneler/MainWindow.xaml.cs
index f4dcb6ee..be53804b 100644
--- a/ZitiTunneler/MainWindow.xaml.cs
+++ b/ZitiTunneler/MainWindow.xaml.cs
@@ -20,6 +20,8 @@ namespace ZitiTunneler {
private System.Windows.Forms.Timer _timer;
private Client serviceClient = null;
private bool _isAttached = true;
+ private int _right = 75;
+ private int _bottom = -10;
private List identities {
get {
@@ -64,8 +66,8 @@ namespace ZitiTunneler {
private void MainWindow1_Loaded(object sender, RoutedEventArgs e) {
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
- this.Left = desktopWorkingArea.Right-this.Width-25;
- this.Top = desktopWorkingArea.Bottom-this.Height-50;
+ this.Left = desktopWorkingArea.Right-this.Width-_right;
+ this.Top = desktopWorkingArea.Bottom-this.Height-_bottom;
// add a new service client
serviceClient = new Client();
@@ -80,6 +82,17 @@ namespace ZitiTunneler {
// MessageBox.Show("oh my goodness - problem with the service. Almost certainly means the service is NOT RUNNING... Jeremy make this pretty.\n" + ex.Message);
}
LoadIdentities();
+ IdentityMenu.OnForgot += IdentityForgotten;
+ }
+
+ private void IdentityForgotten(ZitiIdentity forgotten) {
+ ZitiTunnelStatus status = serviceClient.GetStatus();
+ identities.Clear();
+ foreach (var id in status.Identities) {
+ var zid = ZitiIdentity.FromClient(id);
+ identities.Add(zid);
+ }
+ LoadIdentities();
}
private void AttachmentChanged(bool attached) {
@@ -87,8 +100,8 @@ namespace ZitiTunneler {
if (_isAttached) {
Arrow.Visibility = Visibility.Visible;
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
- this.Left = desktopWorkingArea.Right-this.Width-25;
- this.Top = desktopWorkingArea.Bottom-this.Height-50;
+ 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;
@@ -144,8 +157,8 @@ namespace ZitiTunneler {
IdList.Children.Add(id);
}
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
- this.Left = desktopWorkingArea.Right-this.Width-25;
- this.Top = desktopWorkingArea.Bottom-this.Height-50;
+ this.Left = desktopWorkingArea.Right-this.Width-_right;
+ this.Top = desktopWorkingArea.Bottom-this.Height-_bottom;
}
private void OpenIdentity(ZitiIdentity identity) {
@@ -165,10 +178,13 @@ namespace ZitiTunneler {
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));
- MessageBox.Show("New identity added with fingerprint: " + createdId.FingerPrint);
- updateViewWithIdentity(createdId);
+ LoadIdentities();
+ //MessageBox.Show("New identity added with fingerprint: " + createdId.FingerPrint);
+ //updateViewWithIdentity(createdId);
} else {
// Jeremy buddy - error popup here
MessageBox.Show("created id was null - wtf jeremy. your fault, um nope your fault clint, or probably Andrews");
diff --git a/ZitiTunneler/ServiceInfo.xaml b/ZitiTunneler/ServiceInfo.xaml
new file mode 100644
index 00000000..ffa3cd81
--- /dev/null
+++ b/ZitiTunneler/ServiceInfo.xaml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ZitiTunneler/ServiceInfo.xaml.cs b/ZitiTunneler/ServiceInfo.xaml.cs
new file mode 100644
index 00000000..6653045e
--- /dev/null
+++ b/ZitiTunneler/ServiceInfo.xaml.cs
@@ -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 ZitiTunneler {
+ ///
+ /// Interaction logic for MenuItem.xaml
+ ///
+ 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();
+ }
+ }
+}
diff --git a/ZitiTunneler/ZitiTunneler.csproj b/ZitiTunneler/ZitiTunneler.csproj
index a6362ee8..fc72f4cb 100644
--- a/ZitiTunneler/ZitiTunneler.csproj
+++ b/ZitiTunneler/ZitiTunneler.csproj
@@ -70,6 +70,9 @@
MainMenu.xaml
+
+ ServiceInfo.xaml
+
MenuEditItem.xaml
@@ -120,6 +123,10 @@
MainWindow.xaml
Code
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer