From 8a6f55cca0f3a7950a94fd6769e5fd62987ef93f Mon Sep 17 00:00:00 2001 From: Taiizor <41683699+Taiizor@users.noreply.github.com> Date: Sun, 22 Oct 2023 01:06:20 +0300 Subject: [PATCH] Preparing Theme Create Dialog --- .../ViewModels/Windows/MainWindowViewModel.cs | 7 ++++- .../Views/Controls/ThemeCreate.xaml | 1 + .../Views/Controls/ThemeCreate.xaml.cs | 27 ++++++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs b/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs index 06ba564be..72f9893c7 100644 --- a/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs +++ b/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs @@ -220,7 +220,12 @@ private async Task OnOtherAbout() { SPVCOA OtherAbout = new(); - await OtherAbout.ShowAsync(); + ContentDialogResult Result = await OtherAbout.ShowAsync(); + + if (Result == ContentDialogResult.Primary) + { + //TODO: eğer kullanıcı library sayfasında ise kütüphane yenilenmeli + } OtherAbout.Dispose(); } diff --git a/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml b/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml index 47c87a3b6..77143709d 100644 --- a/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml +++ b/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml @@ -10,6 +10,7 @@ PrimaryButtonText="{DynamicResource Portal.ThemeCreate.Create}" CloseButtonText="{DynamicResource Portal.ThemeCreate.Close}" Title="{DynamicResource Portal.ThemeCreate.Title}" + PreviewKeyDown="ContentDialog_PreviewKeyDown" IsPrimaryButtonEnabled="False" Loaded="ContentDialog_Loaded" DialogMaxWidth="750" diff --git a/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs b/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs index e1a7a22ad..ac5e81873 100644 --- a/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs +++ b/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs @@ -1,4 +1,5 @@ using System.Windows; +using System.Windows.Input; using Wpf.Ui.Controls; using SPMI = Sucrose.Portal.Manage.Internal; @@ -61,6 +62,12 @@ private void YouTubeCreate_Click(object sender, RoutedEventArgs e) CreateCard.Visibility = Visibility.Collapsed; } + private void ContentDialog_Loaded(object sender, RoutedEventArgs e) + { + //tema oluşturma türü seçildiyse aktif edilecek + //IsPrimaryButtonEnabled = true; + } + private void ApplicationCreate_Click(object sender, RoutedEventArgs e) { IsPrimaryButtonEnabled = true; @@ -68,10 +75,24 @@ private void ApplicationCreate_Click(object sender, RoutedEventArgs e) CreateCard.Visibility = Visibility.Collapsed; } - private void ContentDialog_Loaded(object sender, RoutedEventArgs e) + private void ContentDialog_PreviewKeyDown(object sender, KeyEventArgs e) { - //tema oluşturma türü seçildiyse aktif edilecek - //IsPrimaryButtonEnabled = true; + if ((e.Key == Key.Enter || e.Key == Key.Escape) && true) + { + e.Handled = true; + } + } + + protected override void OnButtonClick(ContentDialogButton Button) + { + if (Button == ContentDialogButton.Primary) + { + //ilgili tema ekleme kontrolü burada yapılacak + //ThemeTitle.Focus(); + //return; + } + + base.OnButtonClick(Button); } public void Dispose()