Skip to content

Commit

Permalink
Merge pull request #425 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 6.4.0.2407
  • Loading branch information
lpeyr authored Jul 25, 2024
2 parents 130396c + 2aa0ebf commit 3a1ba71
Show file tree
Hide file tree
Showing 17 changed files with 452 additions and 46 deletions.
4 changes: 2 additions & 2 deletions ColorPicker.Setup/Setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "ColorPicker Max"
#define MyAppVersion "6.3.0.2405"
#define MyAppFullVersion "6.3.0.2405"
#define MyAppVersion "6.4.0.2407"
#define MyAppFullVersion "6.4.0.2407"
#define MyAppPublisher "Léo Corporation"
#define MyAppURL "https://leocorporation.dev/"
#define MyAppExeName "ColorPicker.exe"
Expand Down
6 changes: 3 additions & 3 deletions ColorPicker/Classes/Bookmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ public class ColorCollection
public string Name { get; set; }
public List<string> Colors { get; set; }

public ColorCollection()
{
public ColorCollection()
{
Colors = [];
Name = "";
}
}

public ColorCollection(string name)
{
Expand Down
2 changes: 1 addition & 1 deletion ColorPicker/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static class Global
internal static string SettingsPath => $@"{FileSys.AppDataPath}\Léo Corporation\ColorPicker Max\Settings.xml";
public static string LastVersionLink => "https://raw.githubusercontent.com/Leo-Corporation/LeoCorp-Docs/master/Liens/Update%20System/ColorPicker/5.0/Version.txt";

public static string Version => "6.3.0.2405";
public static string Version => "6.4.0.2407";

public static string HiSentence
{
Expand Down
2 changes: 1 addition & 1 deletion ColorPicker/ColorPicker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Title>ColorPicker</Title>
<Description>Maximize your creativity.</Description>
<RepositoryUrl>https://github.com/Leo-Corporation/ColorPicker</RepositoryUrl>
<Version>6.3.0.2405</Version>
<Version>6.4.0.2407</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>logo.png</PackageIcon>
<ApplicationIcon>CPM.ico</ApplicationIcon>
Expand Down
99 changes: 69 additions & 30 deletions ColorPicker/Pages/BookmarksPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,39 +195,78 @@
</Grid>
</Button>
</StackPanel>
<Button
x:Name="EmptyHistoryBtn"
<StackPanel
Grid.Row="1"
Grid.Column="1"
Margin="10 2 0 2"
Padding="5"
VerticalAlignment="Center"
HorizontalContentAlignment="Stretch"
Background="Transparent"
BorderThickness="0"
Click="EmptyHistoryBtn_Click"
Foreground="{DynamicResource Red}"
Style="{DynamicResource StandardButton}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
VerticalAlignment="Center"
FontFamily="/Fonts/#FluentSystemIcons-Regular"
FontSize="14"
Text="&#xFBF6;" />
<TextBlock
Grid.Column="1"
Margin="5 0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="11"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.EmptyBookmarks}" />
</Grid>
</Button>
Orientation="Horizontal">
<Button
x:Name="EmptyHistoryBtn"
Padding="5"
VerticalAlignment="Center"
HorizontalContentAlignment="Stretch"
Background="Transparent"
BorderThickness="0"
Click="EmptyHistoryBtn_Click"
Foreground="{DynamicResource Red}"
Style="{DynamicResource StandardButton}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
VerticalAlignment="Center"
FontFamily="/Fonts/#FluentSystemIcons-Regular"
FontSize="14"
Text="&#xFBF6;" />
<TextBlock
Grid.Column="1"
Margin="5 0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="11"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.EmptyBookmarks}" />
</Grid>
</Button>
<Button
x:Name="ImportBtn"
Margin="5 0"
Padding="5"
VerticalAlignment="Center"
Background="Transparent"
Click="ImportBtn_Click"
Content="&#xF151;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource PrimaryButton}">
<Button.ToolTip>
<ToolTip
Background="{DynamicResource Background1}"
Content="{x:Static lang:Resources.Import}"
Foreground="{DynamicResource Foreground1}" />
</Button.ToolTip>
</Button>
<Button
x:Name="ExportBtn"
Margin="0 0 10 0"
Padding="5"
VerticalAlignment="Center"
Background="Transparent"
Click="ExportBtn_Click"
Content="&#xF1A5;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource PrimaryButton}">
<Button.ToolTip>
<ToolTip
Background="{DynamicResource Background1}"
Content="{x:Static lang:Resources.Export}"
Foreground="{DynamicResource Foreground1}" />
</Button.ToolTip>
</Button>
</StackPanel>
<Grid
x:Name="HistoryGrid"
Grid.Row="2"
Expand Down
38 changes: 38 additions & 0 deletions ColorPicker/Pages/BookmarksPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
using ColorPicker.Classes;
using ColorPicker.UserControls;
using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
Expand Down Expand Up @@ -182,4 +186,38 @@ private void AddCollectionBtn_Click(object sender, RoutedEventArgs e)

InitUI();
}

private void ImportBtn_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new()
{
Filter = "XML|*.xml",
Title = Properties.Resources.Import
}; // Create file dialog

if (openFileDialog.ShowDialog() ?? true)
{
Global.Bookmarks = XmlSerializerManager.LoadFromXml<Bookmarks>(openFileDialog.FileName); // Import
XmlSerializerManager.SaveToXml(Global.Bookmarks , Global.BookmarksPath);
MessageBox.Show(Properties.Resources.ImportBookmarksSucess, Properties.Resources.ColorPickerMax, MessageBoxButton.OK, MessageBoxImage.Information); // Show error message

InitUI();
}
}

private void ExportBtn_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog saveFileDialog = new()
{
FileName = "Bookmarks.xml",
Filter = "XML|*.xml",
Title = Properties.Resources.Export
}; // Create file dialog

if (saveFileDialog.ShowDialog() ?? true)
{
XmlSerializerManager.SaveToXml(Global.Bookmarks, saveFileDialog.FileName); // Export games
MessageBox.Show(Properties.Resources.ExportBookmarksSuccess, Properties.Resources.ColorPickerMax, MessageBoxButton.OK, MessageBoxImage.Information); // Show message
}
}
}
64 changes: 64 additions & 0 deletions ColorPicker/Pages/ContrastPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,18 @@
Foreground="{DynamicResource AccentColor}"
GroupName="ScoreToggles"
Style="{DynamicResource DefaultToggleButton}" />
<RadioButton
x:Name="CustomToggle"
Margin="2 0"
Padding="3"
Background="Transparent"
Checked="CustomToggle_Checked"
Click="CustomToggle_Checked"
Content="{x:Static lang:Resources.Custom}"
FontWeight="Bold"
Foreground="{DynamicResource AccentColor}"
GroupName="ScoreToggles"
Style="{DynamicResource DefaultToggleButton}" />
<CheckBox
x:Name="ShowHighlight"
VerticalContentAlignment="Center"
Expand Down Expand Up @@ -470,5 +482,57 @@
<RowDefinition Height="60" />
</Grid.RowDefinitions>
</Grid>
<Popup
x:Name="CustomContrastPopup"
AllowsTransparency="True"
Placement="Top"
PlacementTarget="{Binding ElementName=CustomToggle}"
StaysOpen="False">
<Border
Margin="10"
Padding="5"
Background="{DynamicResource CardBackground}"
CornerRadius="10">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{DynamicResource Accent}" />
</Border.Effect>

<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0 0 10 0"
VerticalAlignment="Center"
Text="{x:Static lang:Resources.Minimum}" />
<Border
Width="50"
HorizontalAlignment="Center"
Background="{DynamicResource CardBackground}"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{DynamicResource Accent}" />
</Border.Effect>
<TextBox
x:Name="MinContrastTxt"
Margin="3"
Padding="3"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{DynamicResource DarkGray}"
PreviewTextInput="MinContrastTxt_PreviewTextInput"
Text="0"
TextAlignment="Center"
TextChanged="MinContrastTxt_TextChanged" />
</Border>
</StackPanel>
</Border>
</Popup>
</Grid>
</Page>
24 changes: 23 additions & 1 deletion ColorPicker/Pages/ContrastPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using Synethia;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
Expand Down Expand Up @@ -435,7 +436,7 @@ internal void InitGrid(double limit)
Panel.SetZIndex(RowBorder, 10);

ContrastGrid.Children.Add(ColBorder);
ContrastGrid.Children.Add(RowBorder);
ContrastGrid.Children.Add(RowBorder);
}

// Load the bookmark icon
Expand Down Expand Up @@ -471,4 +472,25 @@ private void ShowHighlight_Checked(object sender, RoutedEventArgs e)
{
InitGrid(contrastLimit);
}

private void CustomToggle_Checked(object sender, RoutedEventArgs e)
{
CustomContrastPopup.IsOpen = true;
}

private void MinContrastTxt_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
Regex regex = new("[^0-9]+");
e.Handled = regex.IsMatch(e.Text);
}

private void MinContrastTxt_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
bool parsed = int.TryParse(MinContrastTxt.Text, out int contrast);
InitGrid(parsed ? contrast : 0);
}
catch { }
}
}
Loading

0 comments on commit 3a1ba71

Please sign in to comment.