Fix Switch and sizing of elements in identity list

This commit is contained in:
Jeremy Tellier - ROG
2020-10-29 01:01:32 +01:00
parent 53e512c8a5
commit c3dc034e2f
6 changed files with 14 additions and 17 deletions
+1
View File
@@ -99,6 +99,7 @@ namespace ZitiDesktopEdge {
}
private void IdToggle(bool on) {
MessageBox.Show("Swicthing to " + on);
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
client.IdentityOnOff(_identity.Fingerprint, on);
SelectedIdentity.ToggleSwitch.Enabled = on;
+1 -1
View File
@@ -387,8 +387,8 @@ namespace ZitiDesktopEdge {
id.Identity = ids[i];
//id.OnClick += OpenIdentity;
IdList.Children.Add(id);
IdList.Height += 60;
}
IdList.Height = (double)(ids.Length * 60);
if (this._isAttached&&repaint) Placement();
}
@@ -26,10 +26,10 @@
</Grid.RowDefinitions>
<local:Toggler x:Name="ToggleSwitch" Grid.Column="0" Grid.Row="0" Margin="0,10,0,0"></local:Toggler>
<Label Name="ToggleStatus" Cursor="Hand" 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" Cursor="Hand" MouseUp="OpenDetails" MaxWidth="180" Grid.Column="1" Margin="0,6,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" FontSize="18" Foreground="White" HorizontalAlignment="Left">
<Label Name="IdName" Cursor="Hand" MouseUp="OpenDetails" MaxWidth="230" 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" Cursor="Hand" MouseUp="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">
<Label Name="IdUrl" Cursor="Hand" MouseUp="OpenDetails" MaxWidth="180" MinWidth="230" 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" MouseUp="OpenDetails" Cursor="Hand">
@@ -49,23 +49,19 @@ namespace ZitiDesktopEdge {
}
private void ToggleIdentity(bool on) {
// Jeremy - make the messagebox pretty or something
try
{
try {
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
ServiceClient.Identity id = client.IdentityOnOff(_identity.Fingerprint, on);
this.Identity.IsEnabled = 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);
} catch (ServiceClient.ServiceException se) {
MessageBox.Show(se.AdditionalInfo, se.Message);
} catch (Exception ex) {
MessageBox.Show("Unexpected error 5 the toggle needs to be rolled back!!! jeremy!", ex.Message);
MessageBox.Show("Error", ex.Message);
}
}
@@ -80,8 +76,8 @@ namespace ZitiDesktopEdge {
private void OpenDetails(object sender, MouseButtonEventArgs e) {
IdentityDetails deets = ((MainWindow)Application.Current.MainWindow).IdentityMenu;
deets.SelectedIdentity = this;
deets.IdDetailToggle.Enabled = this.Identity.IsEnabled;
deets.Identity = this.Identity;
this.ToggleSwitch.IsEnabled = this.Identity.IsEnabled;
}
}
}
@@ -13,8 +13,8 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBox Name="MainLabel" MaxWidth="150" Height="39" FontWeight="Bold" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Padding="12,12,12,0" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<TextBox Name="MainEdit" GotFocus="MainEdit_GotFocus" Height="39" MaxWidth="140" Grid.Column="1" HorizontalAlignment="Right" BorderThickness="0" Background="White" TextAlignment="Right" Padding="12,12,12,0" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" ></TextBox>
<TextBox Name="MainLabel" Height="39" FontWeight="Bold" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Padding="12,12,12,0" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<TextBox Name="MainEdit" GotFocus="MainEdit_GotFocus" Height="39" Grid.Column="1" HorizontalAlignment="Right" BorderThickness="0" Background="White" TextAlignment="Right" Padding="12,12,12,0" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" ></TextBox>
</Grid>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
</StackPanel>
@@ -11,11 +11,11 @@
<Grid Height="35">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition x:Name="WarningColumn" Width="0"/>
</Grid.ColumnDefinitions>
<TextBox Name="MainLabel" Padding="12,0,12,0" BorderThickness="0" MinWidth="100" MaxWidth="140" 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" Padding="12,0,12,0" TextAlignment="Right" BorderThickness="0" MinWidth="100" MaxWidth="160" Background="White" ClipToBounds="True" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
<TextBox Name="MainLabel" Padding="12,0,12,0" BorderThickness="0" MinWidth="100" 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" Padding="12,0,12,0" TextAlignment="Right" BorderThickness="0" MinWidth="100" 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>