mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-05-09 09:56:32 +03:00
make error title customizable
This commit is contained in:
@@ -37,24 +37,24 @@ public partial class LockedRepositoryViewModel : ViewModelBase
|
|||||||
if (e.Message == PassStoreFileException.ContentHMACMismatch.Message ||
|
if (e.Message == PassStoreFileException.ContentHMACMismatch.Message ||
|
||||||
e.Message == PassStoreFileException.InvalidBeginMarker.Message)
|
e.Message == PassStoreFileException.InvalidBeginMarker.Message)
|
||||||
{
|
{
|
||||||
await parent.ShowErrorPopup("Incorrect password or corrupted file");
|
await parent.ShowErrorPopup("Incorrect password or corrupted file", "Check password");
|
||||||
} else if (e.Message == PassStoreFileException.UnexpectedEndOfFile.Message ||
|
} else if (e.Message == PassStoreFileException.UnexpectedEndOfFile.Message ||
|
||||||
e.Message == PassStoreFileException.IncorrectMagicNumber.Message ||
|
e.Message == PassStoreFileException.IncorrectMagicNumber.Message ||
|
||||||
e.Message == PassStoreFileException.InvalidCryptoHeader.Message ||
|
e.Message == PassStoreFileException.InvalidCryptoHeader.Message ||
|
||||||
e.Message == PassStoreFileException.InvalidPassStoreEntry.Message)
|
e.Message == PassStoreFileException.InvalidPassStoreEntry.Message)
|
||||||
{
|
{
|
||||||
await parent.ShowErrorPopup("Corrupted file");
|
await parent.ShowErrorPopup("Corrupted file", "Password store error");
|
||||||
} else if (e.Message == PassStoreFileException.UnsupportedVersion.Message)
|
} else if (e.Message == PassStoreFileException.UnsupportedVersion.Message)
|
||||||
{
|
{
|
||||||
await parent.ShowErrorPopup("Unsupported store file version");
|
await parent.ShowErrorPopup("Unsupported store file version", "Password store error");
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
await parent.ShowErrorPopup("Unknown password store unlock error");
|
await parent.ShowErrorPopup("Unknown unlock error", "Password store error");
|
||||||
}
|
}
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
await parent.ShowErrorPopup("Cannot open the password store file");
|
await parent.ShowErrorPopup("Cannot open the password store file", "Password store error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ public partial class RepositoryWindowViewModel : ViewModelBase
|
|||||||
private DateTime _timerStart;
|
private DateTime _timerStart;
|
||||||
private string _lockTimerDisplay = string.Empty;
|
private string _lockTimerDisplay = string.Empty;
|
||||||
|
|
||||||
public Func<string, Task> ShowErrorPopup;
|
public Func<string, string, Task> ShowErrorPopup;
|
||||||
|
|
||||||
public object CurrentPage
|
public object CurrentPage
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
Stretch="Uniform" />
|
Stretch="Uniform" />
|
||||||
|
|
||||||
<StackPanel VerticalAlignment="Center" Width="280">
|
<StackPanel VerticalAlignment="Center" Width="280">
|
||||||
<TextBlock Text="Oops! Something went wrong"
|
<TextBlock x:Name="MessageTitle"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
Foreground="#333"
|
Foreground="#333"
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ namespace KeyKeeper.Views;
|
|||||||
|
|
||||||
public partial class ErrorDialog : Window
|
public partial class ErrorDialog : Window
|
||||||
{
|
{
|
||||||
public ErrorDialog(string message)
|
public ErrorDialog(string message, string title = "Oops! Something went wrong")
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
MessageText.Text = message;
|
MessageText.Text = message;
|
||||||
|
MessageTitle.Text = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Ok_Click(object? sender, RoutedEventArgs e)
|
private void Ok_Click(object? sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ public partial class RepositoryWindow : Window
|
|||||||
MinHeight = 500;
|
MinHeight = 500;
|
||||||
|
|
||||||
DataContext = model;
|
DataContext = model;
|
||||||
model.ShowErrorPopup = async (string message) =>
|
model.ShowErrorPopup = async (string message, string title) =>
|
||||||
{
|
{
|
||||||
await new ErrorDialog(message).ShowDialog(this);
|
await new ErrorDialog(message, title).ShowDialog(this);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user