From 137497c2eefc92be7273de3b7480e031da51a267 Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Wed, 16 Nov 2016 00:40:36 +0100 Subject: [PATCH] Fixed changelog not hiding --- Artemis/Artemis/Dialogs/MarkdownDialog.xaml | 2 +- .../Artemis/Dialogs/MarkdownDialog.xaml.cs | 23 ++++++++++++++++--- .../Artemis/Services/MetroDialogService.cs | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Artemis/Artemis/Dialogs/MarkdownDialog.xaml b/Artemis/Artemis/Dialogs/MarkdownDialog.xaml index 8a9587fe5..1147a616a 100644 --- a/Artemis/Artemis/Dialogs/MarkdownDialog.xaml +++ b/Artemis/Artemis/Dialogs/MarkdownDialog.xaml @@ -47,7 +47,7 @@ MinWidth="80" Margin="0 0 5 0" Content="Alrighty, let's go!" - Style="{DynamicResource AccentedDialogSquareButton}" /> + Style="{DynamicResource AccentedDialogSquareButton}" Click="PART_AffirmativeButton_Click" /> \ No newline at end of file diff --git a/Artemis/Artemis/Dialogs/MarkdownDialog.xaml.cs b/Artemis/Artemis/Dialogs/MarkdownDialog.xaml.cs index 8c31b6ec9..3d6b1d7e6 100644 --- a/Artemis/Artemis/Dialogs/MarkdownDialog.xaml.cs +++ b/Artemis/Artemis/Dialogs/MarkdownDialog.xaml.cs @@ -1,28 +1,45 @@ -using System.Windows; +using System.Threading.Tasks; +using System.Windows; using System.Windows.Input; +using MahApps.Metro.Controls; +using MahApps.Metro.Controls.Dialogs; namespace Artemis.Dialogs { /// /// Interaction logic for MarkdownDialog.xaml /// - public partial class MarkdownDialog + public partial class MarkdownDialog : CustomDialog { + public MetroWindow ParentWindow { get; set; } + public static readonly DependencyProperty MarkdownProperty = DependencyProperty.Register("Markdown", typeof(string), typeof(MarkdownDialog), new PropertyMetadata(default(string))); - public MarkdownDialog() + + + public MarkdownDialog(MetroWindow parentWindow) { + ParentWindow = parentWindow; InitializeComponent(); + Tcs = new TaskCompletionSource(); + CommandBindings.Add(new CommandBinding(NavigationCommands.GoToPage, (sender, e) => System.Diagnostics.Process.Start((string) e.Parameter))); } + public TaskCompletionSource Tcs { get; set; } + public string Markdown { get { return (string) GetValue(MarkdownProperty); } set { SetValue(MarkdownProperty, value); } } + + private void PART_AffirmativeButton_Click(object sender, RoutedEventArgs e) + { + ParentWindow.HideMetroDialogAsync(this); + } } } \ No newline at end of file diff --git a/Artemis/Artemis/Services/MetroDialogService.cs b/Artemis/Artemis/Services/MetroDialogService.cs index dc52e96dd..55aa8d9bb 100644 --- a/Artemis/Artemis/Services/MetroDialogService.cs +++ b/Artemis/Artemis/Services/MetroDialogService.cs @@ -60,7 +60,7 @@ namespace Artemis.Services if (GetActiveWindow() == null) return; - var dialog = new MarkdownDialog + var dialog = new MarkdownDialog(GetActiveWindow()) { Markdown = markdown, Title = title