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 ec05821 commit 2b0bd74
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Portal/Sucrose.Portal/Views/Controls/ThemeDelete.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ui:ContentDialog.Resources>

<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Orientation="Vertical" MinWidth="400">
<ui:Image x:Name="ThemeThumbnail" Stretch="UniformToFill" CornerRadius="25" Width="Auto" Height="300" Margin="0 0 0 10" />
<ui:Image x:Name="ThemeThumbnail" Stretch="UniformToFill" CornerRadius="25" Width="Auto" Height="300" Margin="0 0 0 12" />

<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}" />
Expand Down
10 changes: 5 additions & 5 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeEdit.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Orientation="Vertical" MinWidth="400">
<ui:Image x:Name="ThemeThumbnail" Stretch="UniformToFill" CornerRadius="25" Width="Auto" Height="300" />

<TextBlock Text="{DynamicResource Portal.ThemeEdit.ThemeTitle}" Margin="0 10 0 0" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock Text="{DynamicResource Portal.ThemeEdit.ThemeTitle}" Margin="0 12 0 0" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<ui:TextBox x:Name="ThemeTitle" Margin="0 3 0 0" MaxLength="50" AcceptsReturn="False" AcceptsTab="False" />

<TextBlock Text="{DynamicResource Portal.ThemeEdit.ThemeDescription}" Margin="0 10 0 0" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<TextBlock Text="{DynamicResource Portal.ThemeEdit.ThemeDescription}" Margin="0 12 0 0" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<ui:TextBox x:Name="ThemeDescription" Margin="0 3 0 0" MaxLength="500" MaxLines="10" TextWrapping="WrapWithOverflow" MinLines="5" AcceptsReturn="True" AcceptsTab="False" />

<TextBlock Text="{DynamicResource Portal.ThemeEdit.ThemeAuthor}" Margin="0 10 0 0" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock Text="{DynamicResource Portal.ThemeEdit.ThemeAuthor}" Margin="0 12 0 0" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<ui:TextBox x:Name="ThemeAuthor" Margin="0 3 0 0" MaxLength="50" AcceptsReturn="False" AcceptsTab="False" />

<TextBlock Text="{DynamicResource Portal.ThemeEdit.ThemeContact}" Margin="0 10 0 0" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock Text="{DynamicResource Portal.ThemeEdit.ThemeContact}" Margin="0 12 0 0" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<ui:TextBox x:Name="ThemeContact" Margin="0 3 0 0" MaxLength="250" AcceptsReturn="False" AcceptsTab="False" Cursor="IBeam" />

<StackPanel x:Name="Arguments">
<TextBlock Margin="0 10 0 0" Text="{DynamicResource Portal.ThemeEdit.ThemeArguments}" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock Margin="0 12 0 0" Text="{DynamicResource Portal.ThemeEdit.ThemeArguments}" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<ui:TextBox x:Name="ThemeArguments" Margin="0 3 0 0" MaxLength="250" AcceptsReturn="False" AcceptsTab="False" />
</StackPanel>
</StackPanel>
Expand Down
2 changes: 2 additions & 0 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeEdit.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using SPEIL = Sucrose.Portal.Extension.ImageLoader;
using SPMI = Sucrose.Portal.Manage.Internal;
using SSDEWT = Sucrose.Shared.Dependency.Enum.WallpaperType;
using SSSHV = Sucrose.Shared.Space.Helper.Versionly;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;

namespace Sucrose.Portal.Views.Controls
Expand Down Expand Up @@ -87,6 +88,7 @@ protected override void OnButtonClick(ContentDialogButton Button)
Info.Author = ThemeAuthor.Text;
Info.Contact = ThemeContact.Text;
Info.Description = ThemeDescription.Text;
Info.Version = SSSHV.Increment(Info.Version);

if (string.IsNullOrEmpty(ThemeArguments.Text))
{
Expand Down
2 changes: 2 additions & 0 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeReview.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
</ui:ContentDialog.Resources>

<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Orientation="Vertical" MinWidth="400">
<ui:Image x:Name="ThemeThumbnail" Stretch="UniformToFill" CornerRadius="25" Width="Auto" Height="300" Margin="0 0 0 12" />

<TextBlock x:Name="ThemeTitle" Text="{DynamicResource Portal.ThemeReview.ThemeTitle}" TextWrapping="WrapWithOverflow" FontSize="16" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<TextBlock x:Name="ThemeDescription" Text="{DynamicResource Portal.ThemeReview.ThemeDescription}" TextWrapping="WrapWithOverflow" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

Expand Down
9 changes: 9 additions & 0 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeReview.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using SEST = Skylark.Enum.StorageType;
using SHC = Skylark.Helper.Culture;
using SHN = Skylark.Helper.Numeric;
using SPEIL = Sucrose.Portal.Extension.ImageLoader;
using SPMI = Sucrose.Portal.Manage.Internal;
using SSESSE = Skylark.Standard.Extension.Storage.StorageExtension;
using SSSHS = Sucrose.Shared.Space.Helper.Size;
Expand All @@ -20,6 +21,7 @@ namespace Sucrose.Portal.Views.Controls
/// </summary>
public partial class ThemeReview : ContentDialog, IDisposable
{
private readonly SPEIL Loader = new();
internal string Theme = string.Empty;
internal SSTHI Info = new();

Expand Down Expand Up @@ -65,6 +67,13 @@ private void ContentDialog_Loaded(object sender, RoutedEventArgs e)

ThemeContact.NavigateUri = Info.Contact;
}

string ImagePath = Path.Combine(Theme, Info.Thumbnail);

if (File.Exists(ImagePath))
{
ThemeThumbnail.Source = Loader.LoadOptimal(ImagePath);
}
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
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.Title">Thema Löschen</system:String>
<system:String x:Key="Portal.ThemeDelete.Delete">Löschen</system:String>
<system:String x:Key="Portal.ThemeDelete.Close">Schließen</system:String>

<system:String x:Key="Portal.ThemeDelete.ThemeTitle">Titel</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
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.Title">Delete Theme</system:String>
<system:String x:Key="Portal.ThemeDelete.Delete">Delete</system:String>
<system:String x:Key="Portal.ThemeDelete.Close">Close</system:String>

<system:String x:Key="Portal.ThemeDelete.ThemeTitle">Title</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
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.Title">Eliminar Tema</system:String>
<system:String x:Key="Portal.ThemeDelete.Delete">Eliminar</system:String>
<system:String x:Key="Portal.ThemeDelete.Close">Cerrar</system:String>

<system:String x:Key="Portal.ThemeDelete.ThemeTitle">Título</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
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">Critique du Thème</system:String>
<system:String x:Key="Portal.ThemeDelete.Title">Supprimer le Thème</system:String>
<system:String x:Key="Portal.ThemeDelete.Delete">Supprimer</system:String>
<system:String x:Key="Portal.ThemeDelete.Close">Fermer</system:String>

<system:String x:Key="Portal.ThemeDelete.ThemeTitle">Titre</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
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">Recenzja Tematu</system:String>
<system:String x:Key="Portal.ThemeDelete.Title">Usuń Temat</system:String>
<system:String x:Key="Portal.ThemeDelete.Delete">Usuń</system:String>
<system:String x:Key="Portal.ThemeDelete.Close">Zamknij</system:String>

<system:String x:Key="Portal.ThemeDelete.ThemeTitle">Tytuł</system:String>
Expand Down
75 changes: 75 additions & 0 deletions src/Shared/Sucrose.Shared.Space/Helper/Versionly.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
namespace Sucrose.Shared.Space.Helper
{
internal static class Versionly
{
public static Version Increment(Version Version)
{
try
{
int Major = Version.Major;
int Minor = Version.Minor;
int Build = Version.Build;
int Revision = Version.Revision + 1;

if (Revision > 9)
{
Revision = 0;
Build++;
}

if (Build > 9)
{
Build = 0;
Minor++;
}

if (Minor > 9)
{
Minor = 0;
Major++;
}

return new Version(Major, Minor, Build, Revision);
}
catch
{
return new Version(0, 0, 0, 0);
}
}

public static Version Decrement(Version Version)
{
try
{
int Major = Version.Major;
int Minor = Version.Minor;
int Build = Version.Build;
int Revision = Version.Revision - 1;

if (Revision < 0)
{
Revision = 9;
Build--;
}

if (Build < 0)
{
Build = 9;
Minor--;
}

if (Minor < 0)
{
Minor = 9;
Major--;
}

return new Version(Major, Minor, Build, Revision);
}
catch
{
return new Version(0, 0, 0, 0);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Helper\Reset.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Graphic.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Management.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Versionly.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Virtual.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Remote.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Network.cs" />
Expand Down

0 comments on commit 2b0bd74

Please sign in to comment.