Skip to content

Commit

Permalink
Fix unexpected confirmation message on Key Store publish/diff cancell…
Browse files Browse the repository at this point in the history
…ation

Fix some margins on SAM AV tools
  • Loading branch information
Maxhy committed Apr 2, 2024
1 parent e694bb1 commit 637d400
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<local:LLAReaderControl Grid.Row="0" Grid.ColumnSpan="2" ReaderProvider="{Binding RFIDReaderProvider}" ReaderUnit="{Binding RFIDReaderUnit}" />
<wpfappctrls:NumericUpDownControl Grid.Row="1" Grid.Column="0" MinValue="0" MaxValue="255"
<wpfappctrls:NumericUpDownControl Grid.Row="1" Grid.Column="0" MinValue="0" MaxValue="255" Margin="5"
CurrentValue="{Binding SAMDESFireKeyId, Mode=TwoWay}"
HelperText="{x:Static properties:Resources.KeyEntryIdentifierHelper}"
Hint="{x:Static properties:Resources.KeyEntryIdentifier}"/>
<wpfappctrls:NumericUpDownControl Grid.Row="1" Grid.Column="1" MinValue="0" MaxValue="255"
<wpfappctrls:NumericUpDownControl Grid.Row="1" Grid.Column="1" MinValue="0" MaxValue="255" Margin="5"
CurrentValue="{Binding SAMDESFireKeyVersion, Mode=TwoWay}"
HelperText="{x:Static properties:Resources.KeyVersionHelper}"
Hint="{x:Static properties:Resources.KeyVersion}"/>
<TextBox Grid.Row="2" Grid.Column="0" Text="{Binding DESFireAID, Mode=TwoWay, Converter={StaticResource ByteArrayToStringConverter}}"
materialDesign:HintAssist.HelperText="{x:Static properties:Resources.DESFireAIDHelper}"
materialDesign:HintAssist.Hint="{x:Static properties:Resources.DESFireAID}" Margin="5,5,5,10"/>
<wpfappctrls:NumericUpDownControl Grid.Row="2" Grid.Column="1" MinValue="0" MaxValue="255"
<wpfappctrls:NumericUpDownControl Grid.Row="2" Grid.Column="1" MinValue="0" MaxValue="255" Margin="5"
CurrentValue="{Binding DESFireKeyNum, Mode=TwoWay}"
HelperText="{x:Static properties:Resources.DESFireKeyNumberHelper}"
Hint="{x:Static properties:Resources.DESFireKeyNumber}"/>
Expand All @@ -108,7 +108,7 @@
<ToggleButton IsChecked="{Binding DESFireReadFile}" Style="{StaticResource MaterialDesignSwitchLightToggleButton}" />
<TextBlock Text="{x:Static properties:Resources.ReadFile}" Padding="3" />
</StackPanel>
<wpfappctrls:NumericUpDownControl Grid.Row="4" Grid.Column="1" MinValue="0" MaxValue="255"
<wpfappctrls:NumericUpDownControl Grid.Row="4" Grid.Column="1" MinValue="0" MaxValue="255" Margin="5"
CurrentValue="{Binding DESFireFileNo, Mode=TwoWay}"
HelperText="{x:Static properties:Resources.DESFireFileNoHelper}"
Hint="{x:Static properties:Resources.DESFireFileNo}"/>
Expand Down
18 changes: 13 additions & 5 deletions KeyManager/Domain/EditKeyStoreControlViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public static async Task<bool> AskForKeyStoreSecretIfRequired(KeyStore ks)
return (ret != null);
}

public async Task RunOnKeyStore(UserControl dialog, Func<KeyStore, Func<string, KeyStore?>, Func<KeyStore, Task<bool>>?, KeyEntryClass, IEnumerable<KeyEntryId>?, Action<KeyStore, KeyEntryClass, int>?, Task> action)
public async Task<bool> RunOnKeyStore(UserControl dialog, Func<KeyStore, Func<string, KeyStore?>, Func<KeyStore, Task<bool>>?, KeyEntryClass, IEnumerable<KeyEntryId>?, Action<KeyStore, KeyEntryClass, int>?, Task> action)
{
var model = new PublishKeyStoreDialogViewModel();
dialog.DataContext = model;
Expand Down Expand Up @@ -323,9 +323,13 @@ public async Task RunOnKeyStore(UserControl dialog, Func<KeyStore, Func<string,
{
ShowProgress = false;
}

return true;
}
}
}

return false;
}

public async Task Publish()
Expand All @@ -334,8 +338,10 @@ public async Task Publish()
{
try
{
await RunOnKeyStore(new PublishKeyStoreDialog(), KeyStore.Publish);
SnackbarHelper.EnqueueMessage(_snackbarMessageQueue, "Key Entries have been successfully published.");
if (await RunOnKeyStore(new PublishKeyStoreDialog(), KeyStore.Publish))
{
SnackbarHelper.EnqueueMessage(_snackbarMessageQueue, "Key Entries have been successfully published.");
}
}
catch (KeyStoreException ex)
{
Expand All @@ -355,8 +361,10 @@ public async Task Diff()
{
try
{
await RunOnKeyStore(new DiffKeyStoreDialog(), KeyStore.Diff);
SnackbarHelper.EnqueueMessage(_snackbarMessageQueue, "No differences found.");
if (await RunOnKeyStore(new DiffKeyStoreDialog(), KeyStore.Diff))
{
SnackbarHelper.EnqueueMessage(_snackbarMessageQueue, "No differences found.");
}
}
catch (KeyStoreException ex)
{
Expand Down

0 comments on commit 637d400

Please sign in to comment.