Skip to content

Commit

Permalink
Preparing Theme Delete Dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 4, 2023
1 parent 562520a commit 2e4fb26
Show file tree
Hide file tree
Showing 23 changed files with 273 additions and 18 deletions.
21 changes: 12 additions & 9 deletions src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using SPVCTE = Sucrose.Portal.Views.Controls.ThemeEdit;
using SPVCTR = Sucrose.Portal.Views.Controls.ThemeReview;
using SPVCTS = Sucrose.Portal.Views.Controls.ThemeShare;
using SPVCTD = Sucrose.Portal.Views.Controls.ThemeDelete;
using SSLHK = Sucrose.Shared.Live.Helper.Kill;
using SSLHR = Sucrose.Shared.Live.Helper.Run;
using SSRER = Sucrose.Shared.Resources.Extension.Resources;
Expand Down Expand Up @@ -142,7 +143,17 @@ private async void MenuReview_Click(object sender, RoutedEventArgs e)

private async void MenuDelete_Click(object sender, RoutedEventArgs e)
{
if (Delete || !SMMM.LibraryConfirm)
SPVCTD ThemeDelete = new()
{
Info = Info,
Theme = Theme
};

ContentDialogResult Result = await ThemeDelete.ShowAsync();

ThemeDelete.Dispose();

if (!SMMM.LibraryConfirm || Result == ContentDialogResult.Primary)
{
Dispose();

Expand All @@ -157,14 +168,6 @@ private async void MenuDelete_Click(object sender, RoutedEventArgs e)

await Task.Run(() => Directory.Delete(Theme, true));
}
else
{
Delete = true;

await Task.Delay(250);

MenuDelete.Header = SSRER.GetValue("Portal", "LibraryCard", "MenuDelete", "Approve");
}
}

private void ThemeMore_Click(object sender, RoutedEventArgs e)
Expand Down
39 changes: 39 additions & 0 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeDelete.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<ui:ContentDialog
x:Class="Sucrose.Portal.Views.Controls.ThemeDelete"
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:local="clr-namespace:Sucrose.Portal.Views.Controls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
PrimaryButtonText="{DynamicResource Portal.ThemeDelete.Delete}"
CloseButtonText="{DynamicResource Portal.ThemeDelete.Close}"
Title="{DynamicResource Portal.ThemeDelete.Title}"
Loaded="ContentDialog_Loaded"
DialogMaxWidth="750"
mc:Ignorable="d">

<ui:ContentDialog.Resources>
<Style BasedOn="{StaticResource {x:Type ui:ContentDialog}}" TargetType="{x:Type local:ThemeDelete}" />
</ui:ContentDialog.Resources>

<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Orientation="Vertical" MinWidth="400">
<TextBlock x:Name="ThemeTitle" Text="{DynamicResource Portal.ThemeDelete.ThemeTitle}" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock x:Name="ThemeDescription" Text="{DynamicResource Portal.ThemeDelete.ThemeDescription}" TextWrapping="WrapWithOverflow" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

<TextBlock x:Name="ThemeType" Text="{DynamicResource Portal.ThemeDelete.ThemeType}" TextWrapping="WrapWithOverflow" FontSize="16" Margin="0 12 0 0" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock x:Name="ThemeTypeName" Text="{DynamicResource Portal.ThemeDelete.ThemeTypeName}" TextWrapping="WrapWithOverflow" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

<TextBlock x:Name="ThemeAuthor" Text="{DynamicResource Portal.ThemeDelete.ThemeAuthor}" TextWrapping="WrapWithOverflow" FontSize="16" Margin="0 12 0 0" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock x:Name="ThemeAuthorName" Text="{DynamicResource Portal.ThemeDelete.ThemeAuthorName}" TextWrapping="WrapWithOverflow" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

<TextBlock x:Name="ThemeSize" Text="{DynamicResource Portal.ThemeDelete.ThemeSize}" TextWrapping="WrapWithOverflow" FontSize="16" Margin="0 12 0 0" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock x:Name="ThemeSizeTotal" Text="{DynamicResource Portal.ThemeDelete.ThemeSizeTotal}" TextWrapping="WrapWithOverflow" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

<TextBlock x:Name="ThemeVersion" Text="{DynamicResource Portal.ThemeDelete.ThemeVersion}" TextWrapping="WrapWithOverflow" FontSize="16" Margin="0 12 0 0" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock x:Name="ThemeVersionText" Text="{DynamicResource Portal.ThemeDelete.ThemeVersionText}" TextWrapping="WrapWithOverflow" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

<TextBlock x:Name="ThemeCreate" Text="{DynamicResource Portal.ThemeDelete.ThemeCreate}" TextWrapping="WrapWithOverflow" FontSize="16" Margin="0 12 0 0" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock x:Name="ThemeCreateDate" Text="{DynamicResource Portal.ThemeDelete.ThemeCreateDate}" TextWrapping="WrapWithOverflow" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
</StackPanel>
</ui:ContentDialog>
62 changes: 62 additions & 0 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeDelete.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System.IO;
using System.Windows;
using Wpf.Ui.Controls;
using SECNT = Skylark.Enum.ClearNumericType;
using SEMST = Skylark.Enum.ModeStorageType;
using SEST = Skylark.Enum.StorageType;
using SHC = Skylark.Helper.Culture;
using SHN = Skylark.Helper.Numeric;
using SPMI = Sucrose.Portal.Manage.Internal;
using SSESSE = Skylark.Standard.Extension.Storage.StorageExtension;
using SSSHS = Sucrose.Shared.Space.Helper.Size;
using SSSSS = Skylark.Struct.Storage.StorageStruct;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;
using SSTHV = Sucrose.Shared.Theme.Helper.Various;

namespace Sucrose.Portal.Views.Controls
{
/// <summary>
/// ThemeDelete.xaml etkileşim mantığı
/// </summary>
public partial class ThemeDelete : ContentDialog, IDisposable
{
internal string Theme = string.Empty;
internal SSTHI Info = new();

public ThemeDelete() : base(SPMI.ContentDialogService.GetContentPresenter())
{
InitializeComponent();
}

private string Size(string Path)
{
SSSSS Data = SSESSE.AutoConvert(SSSHS.Calc(Path), SEST.Byte, SEMST.Palila);

return $"{SHN.Numeral(Data.Value, true, true, 1, '0', SECNT.None)} {Data.Short}";
}

private void ContentDialog_Loaded(object sender, RoutedEventArgs e)
{
ThemeTitle.Text = Info.Title;
ThemeDescription.Text = Info.Description;

ThemeTypeName.Text = Info.Type.ToString();

ThemeAuthorName.Text = Info.Author;

ThemeSizeTotal.Text = Size(Theme);

ThemeVersionText.Text = $"{Info.Version} ({Info.AppVersion})";

DateTime CreationTime = Directory.GetCreationTime(Theme);

ThemeCreateDate.Text = CreationTime.ToString(SHC.CurrentUI);
}

public void Dispose()
{
GC.Collect();
GC.SuppressFinalize(this);
}
}
}
6 changes: 3 additions & 3 deletions src/Portal/Sucrose.Portal/Views/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Wpf.Ui.Controls;
using Button = Wpf.Ui.Controls.Button;
using SEWTT = Skylark.Enum.WindowsThemeType;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SPMI = Sucrose.Portal.Manage.Internal;
using SPMM = Sucrose.Portal.Manage.Manager;
using SPSCIW = Sucrose.Portal.Services.Contracts.IWindow;
Expand All @@ -13,11 +15,9 @@
using SPVPSGSP = Sucrose.Portal.Views.Pages.Setting.GeneralSettingPage;
using SPVPSSSP = Sucrose.Portal.Views.Pages.Setting.SystemSettingPage;
using SSDEACT = Sucrose.Shared.Dependency.Enum.ArgumentCommandsType;
using SWHWT = Skylark.Wing.Helper.WindowsTheme;
using WUAAT = Wpf.Ui.Appearance.ApplicationTheme;
using WUAT = Wpf.Ui.Appearance.ApplicationThemeManager;
using SWHWT = Skylark.Wing.Helper.WindowsTheme;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMC = Sucrose.Memory.Constant;

namespace Sucrose.Portal.Views.Windows
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<system:String x:Key="Portal.LibraryCard.MenuFind">Finden</system:String>
<system:String x:Key="Portal.LibraryCard.MenuShare">Teilen</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete">Löschen</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete.Approve">Löschen (Bestätigen)</system:String>
<system:String x:Key="Portal.LibraryCard.MenuEdit">Bearbeiten</system:String>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
<system:String x:Key="Portal.LibraryCard.MenuFind">Find</system:String>
<system:String x:Key="Portal.LibraryCard.MenuShare">Share</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete">Delete</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete.Approve">Delete (Confirm)</system:String>
<system:String x:Key="Portal.LibraryCard.MenuEdit">Edit</system:String>
</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
<system:String x:Key="Portal.LibraryCard.MenuFind">Buscar</system:String>
<system:String x:Key="Portal.LibraryCard.MenuShare">Compartir</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete">Eliminar</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete.Approve">Eliminar (Confirmar)</system:String>
<system:String x:Key="Portal.LibraryCard.MenuEdit">Editar</system:String>
</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<system:String x:Key="Portal.LibraryCard.MenuFind">Trouver</system:String>
<system:String x:Key="Portal.LibraryCard.MenuShare">Partager</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete">Supprimer</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete.Approve">Supprimer (Confirmer)</system:String>
<system:String x:Key="Portal.LibraryCard.MenuEdit">Modifier</system:String>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<system:String x:Key="Portal.LibraryCard.MenuFind">Znajdź</system:String>
<system:String x:Key="Portal.LibraryCard.MenuShare">Udostępnij</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete">Usuń</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete.Approve">Usuń (Potwierdź)</system:String>
<system:String x:Key="Portal.LibraryCard.MenuEdit">Edytuj</system:String>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
<system:String x:Key="Portal.LibraryCard.MenuFind">Bul</system:String>
<system:String x:Key="Portal.LibraryCard.MenuShare">Paylaş</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete">Sil</system:String>
<system:String x:Key="Portal.LibraryCard.MenuDelete.Approve">Sil (Onayla)</system:String>
<system:String x:Key="Portal.LibraryCard.MenuEdit">Düzenle</system:String>
</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ResourceDictionary Source="Pagination/Portal.Pagination.DE.xaml" />
<ResourceDictionary Source="ThemeShare/Portal.ThemeShare.DE.xaml" />
<ResourceDictionary Source="LibraryCard/Portal.LibraryCard.DE.xaml" />
<ResourceDictionary Source="ThemeDelete/Portal.ThemeDelete.DE.xaml" />
<ResourceDictionary Source="ThemeReview/Portal.ThemeReview.DE.xaml" />
<ResourceDictionary Source="ExpanderCard/Portal.ExpanderCard.DE.xaml" />
<ResourceDictionary Source="DisplayPreferences/Portal.DisplayPreferences.DE.xaml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ResourceDictionary Source="Pagination/Portal.Pagination.EN.xaml" />
<ResourceDictionary Source="ThemeShare/Portal.ThemeShare.EN.xaml" />
<ResourceDictionary Source="LibraryCard/Portal.LibraryCard.EN.xaml" />
<ResourceDictionary Source="ThemeDelete/Portal.ThemeDelete.EN.xaml" />
<ResourceDictionary Source="ThemeReview/Portal.ThemeReview.EN.xaml" />
<ResourceDictionary Source="ExpanderCard/Portal.ExpanderCard.EN.xaml" />
<ResourceDictionary Source="DisplayPreferences/Portal.DisplayPreferences.EN.xaml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ResourceDictionary Source="Pagination/Portal.Pagination.ES.xaml" />
<ResourceDictionary Source="ThemeShare/Portal.ThemeShare.ES.xaml" />
<ResourceDictionary Source="LibraryCard/Portal.LibraryCard.ES.xaml" />
<ResourceDictionary Source="ThemeDelete/Portal.ThemeDelete.ES.xaml" />
<ResourceDictionary Source="ThemeReview/Portal.ThemeReview.ES.xaml" />
<ResourceDictionary Source="ExpanderCard/Portal.ExpanderCard.ES.xaml" />
<ResourceDictionary Source="DisplayPreferences/Portal.DisplayPreferences.ES.xaml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ResourceDictionary Source="Pagination/Portal.Pagination.FR.xaml" />
<ResourceDictionary Source="ThemeShare/Portal.ThemeShare.FR.xaml" />
<ResourceDictionary Source="LibraryCard/Portal.LibraryCard.FR.xaml" />
<ResourceDictionary Source="ThemeDelete/Portal.ThemeDelete.FR.xaml" />
<ResourceDictionary Source="ThemeReview/Portal.ThemeReview.FR.xaml" />
<ResourceDictionary Source="ExpanderCard/Portal.ExpanderCard.FR.xaml" />
<ResourceDictionary Source="DisplayPreferences/Portal.DisplayPreferences.FR.xaml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ResourceDictionary Source="Pagination/Portal.Pagination.PL.xaml" />
<ResourceDictionary Source="ThemeShare/Portal.ThemeShare.PL.xaml" />
<ResourceDictionary Source="LibraryCard/Portal.LibraryCard.PL.xaml" />
<ResourceDictionary Source="ThemeDelete/Portal.ThemeDelete.PL.xaml" />
<ResourceDictionary Source="ThemeReview/Portal.ThemeReview.PL.xaml" />
<ResourceDictionary Source="ExpanderCard/Portal.ExpanderCard.PL.xaml" />
<ResourceDictionary Source="DisplayPreferences/Portal.DisplayPreferences.PL.xaml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ResourceDictionary Source="Pagination/Portal.Pagination.TR.xaml" />
<ResourceDictionary Source="ThemeShare/Portal.ThemeShare.TR.xaml" />
<ResourceDictionary Source="LibraryCard/Portal.LibraryCard.TR.xaml" />
<ResourceDictionary Source="ThemeDelete/Portal.ThemeDelete.TR.xaml" />
<ResourceDictionary Source="ThemeReview/Portal.ThemeReview.TR.xaml" />
<ResourceDictionary Source="ExpanderCard/Portal.ExpanderCard.TR.xaml" />
<ResourceDictionary Source="DisplayPreferences/Portal.DisplayPreferences.TR.xaml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<ResourceDictionary
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
>
<system:String x:Key="Portal.ThemeDelete.Title">Themenbewertung</system:String>
<system:String x:Key="Portal.ThemeDelete.Close">Schließen</system:String>

<system:String x:Key="Portal.ThemeDelete.ThemeTitle">Titel</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeDescription">Beschreibung</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeType">Typ</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeTypeName">Gif</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeAuthor">Autor</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeAuthorName">Taiizor</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeSize">Größe</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeSizeTotal">0 b</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeVersion">Version</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeVersionText">0.0.0.0 (0.0.0.0)</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeCreate">Erstellt</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeCreateDate">Unbekannt</system:String>
</ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<ResourceDictionary
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
>
<system:String x:Key="Portal.ThemeDelete.Title">Theme Review</system:String>
<system:String x:Key="Portal.ThemeDelete.Close">Close</system:String>

<system:String x:Key="Portal.ThemeDelete.ThemeTitle">Title</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeDescription">Description</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeType">Type</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeTypeName">Gif</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeAuthor">Author</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeAuthorName">Taiizor</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeSize">Size</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeSizeTotal">0 b</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeVersion">Version</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeVersionText">0.0.0.0 (0.0.0.0)</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeCreate">Creation</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeCreateDate">Unknown</system:String>
</ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<ResourceDictionary
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
>
<system:String x:Key="Portal.ThemeDelete.Title">Reseña del Tema</system:String>
<system:String x:Key="Portal.ThemeDelete.Close">Cerrar</system:String>

<system:String x:Key="Portal.ThemeDelete.ThemeTitle">Título</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeDescription">Descripción</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeType">Tipo</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeTypeName">Gif</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeAuthor">Autor</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeAuthorName">Taiizor</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeSize">Tamaño</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeSizeTotal">0 b</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeVersion">Versión</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeVersionText">0.0.0.0 (0.0.0.0)</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeCreate">Creación</system:String>
<system:String x:Key="Portal.ThemeDelete.ThemeCreateDate">Desconocido</system:String>
</ResourceDictionary>
Loading

0 comments on commit 2e4fb26

Please sign in to comment.