Plugin prerequisites - Added UI for installing/removing prerequisites

Plugin settings - Added button to reload plugin from disk
Confirm dialogs - Made cancel text optional so you can hide the button
This commit is contained in:
Robert committed 2021-04-28 00:33:56 +02:00
1 parent f1874d9fe3
commit 0cfddcbbaf
25 files changed
+741 -158

No files matched your search

@@ -1,14 +1,18 @@
<UserControl x:ClassModifier="internal"
x:Class="Artemis.UI.Shared.Screens.Dialogs.ConfirmDialogView"
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:dialogs="clr-namespace:Artemis.UI.Shared.Screens.Dialogs"
xmlns:Shared="clr-namespace:Artemis.UI.Shared" x:ClassModifier="internal"
x:Class="Artemis.UI.Shared.Screens.Dialogs.ConfirmDialogView"
mc:Ignorable="d"
d:DesignHeight="163.274" d:DesignWidth="254.425"
d:DataContext="{d:DesignInstance dialogs:ConfirmDialogViewModel}">
d:DataContext="{d:DesignInstance {x:Type dialogs:ConfirmDialogViewModel}}">
<UserControl.Resources>
<Shared:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
</UserControl.Resources>
<StackPanel Margin="16">
<TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}" Text="{Binding Header}" TextWrapping="Wrap" />
<TextBlock Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
@@ -22,7 +26,8 @@
Focusable="False"
IsCancel="True"
Command="{s:Action Cancel}"
Content="{Binding CancelText}" />
Content="{Binding CancelText}"
Visibility="{Binding CancelText, Converter={StaticResource NullToVisibilityConverter}, Mode=OneWay}" />
<Button x:Name="ConfirmButton"
Style="{StaticResource MaterialDesignFlatButton}"
IsDefault="True"
@@ -61,28 +61,30 @@ namespace Artemis.UI.Shared.Services
return await ShowDialog(identifier, GetBestKernel().Get<T>(parameters));
}
public async Task<bool> ShowConfirmDialog(string header, string text, string confirmText = "Confirm", string cancelText = "Cancel")
public async Task<bool> ShowConfirmDialog(string header, string text, string confirmText = "Confirm", string? cancelText = "Cancel")
{
if (confirmText == null) throw new ArgumentNullException(nameof(confirmText));
IParameter[] arguments =
{
new ConstructorArgument("header", header),
new ConstructorArgument("text", text),
new ConstructorArgument("confirmText", confirmText.ToUpper()),
new ConstructorArgument("cancelText", cancelText.ToUpper())
new ConstructorArgument("cancelText", cancelText?.ToUpper())
};
object? result = await ShowDialog<ConfirmDialogViewModel>(arguments);
return result is bool booleanResult && booleanResult;
}
public async Task<bool> ShowConfirmDialogAt(string identifier, string header, string text, string confirmText = "Confirm", string cancelText = "Cancel")
public async Task<bool> ShowConfirmDialogAt(string identifier, string header, string text, string confirmText = "Confirm", string? cancelText = "Cancel")
{
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
if (confirmText == null) throw new ArgumentNullException(nameof(confirmText));
IParameter[] arguments =
{
new ConstructorArgument("header", header),
new ConstructorArgument("text", text),
new ConstructorArgument("confirmText", confirmText.ToUpper()),
new ConstructorArgument("cancelText", cancelText.ToUpper())
new ConstructorArgument("cancelText", cancelText?.ToUpper())
};
object? result = await ShowDialogAt<ConfirmDialogViewModel>(identifier, arguments);
return result is bool booleanResult && booleanResult;