Skip to content

Commit

Permalink
Merge pull request #113 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 1.8.0.2308
  • Loading branch information
lpeyr authored Aug 9, 2023
2 parents c2cfdf2 + 5a00997 commit 9ec4552
Show file tree
Hide file tree
Showing 25 changed files with 625 additions and 29 deletions.
4 changes: 2 additions & 2 deletions Datalya.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 "Datalya"
#define MyAppVersion "1.7.0.2211"
#define MyAppFullVersion "1.7.0.2211"
#define MyAppVersion "1.8.0.2308"
#define MyAppFullVersion "1.8.0.2308"
#define MyAppPublisher "Léo Corporation"
#define MyAppURL "https://leocorporation.dev/"
#define MyAppExeName "Datalya.exe"
Expand Down
1 change: 1 addition & 0 deletions Datalya/Classes/Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace Datalya.Classes;
[XmlInclude(typeof(SingleChoiceBlock))]
[XmlInclude(typeof(SelectorBlock))]
[XmlInclude(typeof(DateBlock))]
[XmlInclude(typeof(NumberBlock))]
[Serializable]
public class Block
{
Expand Down
2 changes: 1 addition & 1 deletion Datalya/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static class Global
/// <summary>
/// Datalya's version.
/// </summary>
public static string Version => "1.7.0.2211";
public static string Version => "1.8.0.2308";

/// <summary>
/// Last version of Datalya.
Expand Down
47 changes: 47 additions & 0 deletions Datalya/Classes/NumberBlock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
MIT License
Copyright (c) Léo Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using System;

namespace Datalya.Classes;

[Serializable]
public class NumberBlock : Block
{
public bool UseRange { get; set; }

public bool UseComboBox { get; set; }

public (int, int)? Range { get; set; }

public string BlockValue { get; set; }

public NumberBlock()
{
BlockType = Enums.BlockType.Number;
}

public void ChangeName(string name) => Name = name;

public override string ToString() => BlockValue;
}
9 changes: 7 additions & 2 deletions Datalya/Classes/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,14 @@ public class Settings
public bool? DisplayDeleteBlockMessage { get; set; }

/// <summary>
/// The efault tab that sould be selected when opening Datalya.
/// The default tab that sould be selected when opening Datalya.
/// </summary>
public DatabaseMenuTabs? DefaultMenuTab { get; set; }

/// <summary>
/// The default size that should be used when launching the app.
/// </summary>
public (double, double)? MainWindowSize { get; set; }
}

public static class SettingsManager
Expand All @@ -96,7 +101,7 @@ public static void Load()
StreamReader streamReader = new(path); // Where the file is going to be read

Global.Settings = (Settings)xmlSerializer.Deserialize(streamReader); // Read

Global.Settings.MainWindowSize ??= (650, 1100);
streamReader.Dispose();
}
else
Expand Down
10 changes: 5 additions & 5 deletions Datalya/Datalya.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Datalya.ico</ApplicationIcon>
<Version>1.7.0.2211</Version>
<Version>1.8.0.2308</Version>
<Authors>Léo Corporation</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Leo-Corporation/Datalya</PackageProjectUrl>
<RepositoryUrl>https://github.com/Leo-Corporation/Datalya</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Copyright2022</Copyright>
<Copyright2023</Copyright>
</PropertyGroup>

<ItemGroup>
Expand All @@ -27,8 +27,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ClosedXML" Version="0.97.0" />
<PackageReference Include="PeyrSharp" Version="1.0.0.2211" />
<PackageReference Include="ClosedXML" Version="0.102.0" />
<PackageReference Include="PeyrSharp" Version="1.8.0.2308" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion Datalya/Enums/BlockType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ public enum BlockType
/// <summary>
/// A date field.
/// </summary>
Date
Date,

/// <summary>
/// A number field.
/// </summary>
Number
}
2 changes: 1 addition & 1 deletion Datalya/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@


<Border Name="WindowBorder" Margin="10" BorderThickness="0" Background="{Binding Source={StaticResource Background1}}" CornerRadius="5">
<Grid VerticalAlignment="Top">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
Expand Down
18 changes: 15 additions & 3 deletions Datalya/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,23 @@ private void InitUI()
StateChanged += (o, e) => RefreshState();
Loaded += (o, e) => RefreshState();
LocationChanged += (o, e) => RefreshState();
SizeChanged += (o, e) =>
{
Global.Settings.MainWindowSize = (ActualWidth, ActualHeight);
};

// UI
WindowContent.Content = Global.DatabasePage; // Set content
CheckButton(DatabaseBtn); // Check
DataBaseNameTxt.Text = Global.CurrentDataBase.DataBaseInfo.Name; // Set text
EditNameTextBox.Text = Global.CurrentDataBase.DataBaseInfo.Name; // Set text

// Restore the previous size
if (!Global.Settings.IsMaximized)
{
Width = Global.Settings.MainWindowSize?.Item1 ?? 1100;
Height = Global.Settings.MainWindowSize?.Item2 ?? 600;
}
}

private void MinimizeBtn_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -122,7 +133,8 @@ private void RefreshState()
MaximizeToolTip.Content = WindowState == WindowState.Maximized ? Properties.Resources.Restore : Properties.Resources.Maximize; // Set
DefineMaximumSize(); // Avoid taskbar overflow

WindowBorder.Margin = WindowState == WindowState.Maximized ? new(10, 10, 0, 0) : new(10); // Set
WindowBorder.CornerRadius = WindowState == WindowState.Maximized ? new(0) : new(5);
WindowBorder.Margin = WindowState == WindowState.Maximized ? new(5, 5, 0, 0) : new(10); // Set
}

private void TabEnter(object sender, MouseEventArgs e)
Expand Down Expand Up @@ -216,8 +228,8 @@ private void DefineMaximumSize()

double factor = scaling / 100d; // Calculate factor

MaxHeight = currentScreen.WorkingArea.Height / factor + 5; // Set max size
MaxWidth = currentScreen.WorkingArea.Width / factor + 5; // Set max size
MaxHeight = currentScreen.WorkingArea.Height / factor + 7; // Set max size
MaxWidth = currentScreen.WorkingArea.Width / factor + 7; // Set max size
}

internal void SettingsBtn_Click(object sender, RoutedEventArgs e)
Expand Down
39 changes: 31 additions & 8 deletions Datalya/Pages/CreatorPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,39 @@
</Button.ToolTip>
</Button>

<Button Foreground="{Binding Source={StaticResource Foreground1}}" x:Name="DateBlockBtn" Click="DateBlockBtn_Click" Padding="5" Margin="5" Style="{DynamicResource RegularButtonStyle}" Background="{Binding Source={StaticResource LightBackground}}" Cursor="Hand" BorderThickness="0" FontSize="18">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xF22B;" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Margin="0,0,5,0" VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.Date}" FontSize="13" VerticalAlignment="Center" />
</StackPanel>

<Button Foreground="{Binding Source={StaticResource Foreground1}}" x:Name="MoreBtn" Click="MoreBtn_Click" Content="&#xFC2E;" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Padding="5" Margin="5" Style="{DynamicResource RegularButtonStyle}" Background="{Binding Source={StaticResource LightBackground}}" Cursor="Hand" BorderThickness="0" FontSize="18">
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.Date}" Background="{Binding Source={StaticResource Background1}}" Foreground="{Binding Source={StaticResource Foreground1}}" />
<ToolTip Content="{x:Static lang:Resources.ImportTemplate}" Background="{Binding Source={StaticResource Background1}}" Foreground="{Binding Source={StaticResource Foreground1}}" />
</Button.ToolTip>
</Button>

<Popup PopupAnimation="Slide" x:Name="MorePopup" StaysOpen="False" AllowsTransparency="True" Placement="Bottom" PlacementTarget="{Binding ElementName=MoreBtn}">
<Border Margin="10" Background="{Binding Source={StaticResource Background3}}" CornerRadius="5">
<Border.Effect>
<DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="20" Opacity="0.2" RenderingBias="Quality" />
</Border.Effect>
<StackPanel>
<Button HorizontalContentAlignment="Left" Foreground="{Binding Source={StaticResource Foreground1}}" x:Name="DateBlockBtn" Click="DateBlockBtn_Click" Padding="5" Margin="5 5 5 0" Style="{DynamicResource RegularButtonStyle}" Background="{Binding Source={StaticResource LightBackground}}" Cursor="Hand" BorderThickness="0" FontSize="18">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="&#xF22B;" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Margin="0,0,5,0" VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.Date}" FontSize="13" VerticalAlignment="Center" />
</StackPanel>
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.Date}" Background="{Binding Source={StaticResource Background1}}" Foreground="{Binding Source={StaticResource Foreground1}}" />
</Button.ToolTip>
</Button>
<Button Foreground="{Binding Source={StaticResource Foreground1}}" x:Name="NumberBlockBtn" Click="NumberBlockBtn_Click" Padding="5" Margin="5 0 5 5" Style="{DynamicResource RegularButtonStyle}" Background="{Binding Source={StaticResource LightBackground}}" Cursor="Hand" BorderThickness="0" FontSize="18">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="&#xF57E;" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Margin="0,0,5,0" VerticalAlignment="Center" />
<TextBlock Text="{x:Static lang:Resources.NumberInput}" FontSize="13" VerticalAlignment="Center" />
</StackPanel>
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.NumberInput}" Background="{Binding Source={StaticResource Background1}}" Foreground="{Binding Source={StaticResource Foreground1}}" />
</Button.ToolTip>
</Button>
</StackPanel>
</Border>
</Popup>
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="5,7,5,7" Background="{Binding Source={StaticResource Background2}}" />

<Button Foreground="{Binding Source={StaticResource Foreground1}}" x:Name="ImportBlockBtn" Click="ImportBlockBtn_Click" Content="&#xF151;" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Padding="5" Margin="5" Style="{DynamicResource RegularButtonStyle}" Background="{Binding Source={StaticResource LightBackground}}" Cursor="Hand" BorderThickness="0" FontSize="18">
Expand Down Expand Up @@ -126,7 +149,7 @@
</StackPanel>
</Button>

<Border Grid.Column="1" Width="310" Padding="10" Grid.Row="1" Grid.RowSpan="3" Background="{Binding Source={StaticResource Background3}}" Margin="10,0,0,0">
<Border Grid.Column="1" Width="310" Padding="10" Grid.Row="1" Grid.RowSpan="3" Background="{Binding Source={StaticResource Background3}}" Margin="10,0,0,0" CornerRadius="10 0 0 0">
<Border.Effect>
<DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="20" Opacity="0.2" RenderingBias="Quality" />
</Border.Effect>
Expand Down
27 changes: 27 additions & 0 deletions Datalya/Pages/CreatorPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ internal void InitUI()
{
BlockDisplayer.Children.Add(new DateBlockCreatorUI(dateBlock));
}
else if (Global.CurrentDataBase.Blocks[i] is NumberBlock numberBlock)
{
BlockDisplayer.Children.Add(new NumberBlockCreatorUI(numberBlock));
}
}
}

Expand Down Expand Up @@ -165,6 +169,13 @@ internal void SaveChanges()
blocks.Add(dateBlockCreatorUI.DateBlock); // Add item
}
}
else if (uIElement is NumberBlockCreatorUI numberBlockCreatorUI)
{
if (numberBlockCreatorUI.NumberBlock is not null)
{
blocks.Add(numberBlockCreatorUI.NumberBlock); // Add item
}
}
}
Global.CurrentDataBase.Blocks = blocks;
Global.IsModified = true;
Expand Down Expand Up @@ -228,4 +239,20 @@ private void UseTemplateBtn_Click(object sender, RoutedEventArgs e)
new TemplateWindow(true).Show(); // Open template window
ImportPopup.IsOpen = false; // Close the popup so that other interactions aren't "blocked"
}

private void MoreBtn_Click(object sender, RoutedEventArgs e)
{
MorePopup.IsOpen = !MorePopup.IsOpen;
}

private void NumberBlockBtn_Click(object sender, RoutedEventArgs e)
{

BlockDisplayer.Children.Add(new NumberBlockCreatorUI()); // Add block
for (int i = 0; i < Global.CurrentDataBase.ItemsContent.Count; i++)
{
Global.CurrentDataBase.ItemsContent[i].Add("");
}
SaveChanges(); // Save
}
}
4 changes: 2 additions & 2 deletions Datalya/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ private void SeeLicensesLink_Click(object sender, RoutedEventArgs e)
MessageBox.Show($"{Properties.Resources.Licenses}\n\n" +
"Fluent System Icons - MIT License - © 2020 Microsoft Corporation\n" +
"ClosedXML - MIT License - © 2016 ClosedXML\n" +
"LeoCorpLibrary - MIT License - © 2020-2022 Léo Corporation\n" +
"Datalya - MIT License - © 2021-2022 Léo Corporation", Properties.Resources.Datalya, MessageBoxButton.OK, MessageBoxImage.Information);
"PeyrSharp - MIT License - © 2022-2023 Devyus\n" +
"Datalya - MIT License - © 2021-2023 Léo Corporation", Properties.Resources.Datalya, MessageBoxButton.OK, MessageBoxImage.Information);
}

private void DefaultTabComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand Down
Loading

0 comments on commit 9ec4552

Please sign in to comment.