-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb27cf6
commit d2e36ca
Showing
2 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<UserControl x:Class="Datalya.UserControls.DateBlockCreatorUI" | ||
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:Datalya.UserControls" | ||
xmlns:lang="clr-namespace:Datalya.Properties" | ||
mc:Ignorable="d" | ||
Width="400" Height="125"> | ||
<Border CornerRadius="10" Margin="5" Padding="5" Background="{Binding Source={StaticResource Background1}}" VerticalAlignment="Stretch"> | ||
<StackPanel VerticalAlignment="Center"> | ||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center"> | ||
<TextBlock Text="" FontFamily="..\Fonts\#FluentSystemIcons-Regular" FontSize="28" VerticalAlignment="Center" Margin="0,0,0,5" HorizontalAlignment="Center"/> | ||
<TextBlock x:Name="NameTxt" Text="{x:Static lang:Resources.Date}" FontWeight="Normal" VerticalAlignment="Center" FontSize="20"/> | ||
</StackPanel> | ||
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | ||
<Button Foreground="{Binding Source={StaticResource Foreground1}}" x:Name="ConfigureBtn" Click="ConfigureBtn_Click" Padding="10 5 10 5" Margin="10,10,10,0" BorderThickness="0" Style="{DynamicResource RegularButtonStyle}" Background="{Binding Source={StaticResource Background2}}" HorizontalAlignment="Center" Cursor="Hand"> | ||
<StackPanel Orientation="Horizontal"> | ||
<TextBlock Text="" FontFamily="..\Fonts\#FluentSystemIcons-Regular" FontSize="16" VerticalAlignment="Center" Margin="0,0,5,0"/> | ||
<TextBlock Text="{x:Static lang:Resources.Configure}" VerticalAlignment="Center"/> | ||
</StackPanel> | ||
</Button> | ||
<Button Foreground="{Binding Source={StaticResource Foreground1}}" x:Name="DeleteBtn" Click="DeleteBtn_Click" Padding="10 5 10 5" Margin="0,10,10,0" BorderThickness="0" Style="{DynamicResource RegularButtonStyle}" Background="{Binding Source={StaticResource Background2}}" HorizontalAlignment="Center" Cursor="Hand" Content="" FontFamily="..\Fonts\#FluentSystemIcons-Regular" FontSize="16"/> | ||
</StackPanel> | ||
</StackPanel> | ||
</Border> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
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 Datalya.Classes; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace Datalya.UserControls; | ||
/// <summary> | ||
/// Interaction logic for DateBlockCreatorUI.xaml | ||
/// </summary> | ||
public partial class DateBlockCreatorUI : UserControl | ||
{ | ||
DateBlockPropertiesUI DateBlockPropertiesUI { get; init; } | ||
internal DateBlock DateBlock { get; set; } | ||
public DateBlockCreatorUI(DateBlock dateBlock = null) | ||
{ | ||
InitializeComponent(); | ||
DateBlock = dateBlock; // Set | ||
DateBlockPropertiesUI = new(this, DateBlock); // Create new property UI | ||
|
||
if (dateBlock is not null) | ||
{ | ||
NameTxt.Text = dateBlock.Name; // Set text | ||
} | ||
} | ||
|
||
private void ConfigureBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Global.CreatorPage.PropertyDisplayer.Content = DateBlockPropertiesUI; // Set frame's content | ||
} | ||
|
||
private void DeleteBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
try | ||
{ | ||
if (Global.Settings.DisplayDeleteBlockMessage.Value) | ||
{ | ||
if (MessageBox.Show(Properties.Resources.ConfirmDeleteBlockMsg, Properties.Resources.DatalyaCreator, MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes) | ||
{ | ||
return; // Cancel | ||
} | ||
} | ||
|
||
int index = Global.CreatorPage.BlockDisplayer.Children.IndexOf(this); // Get index | ||
|
||
if (Global.CreatorPage.PropertyDisplayer.Content == DateBlockPropertiesUI) | ||
{ | ||
Global.CreatorPage.PropertyDisplayer.Content = Global.EmptyPropertyUI; // Set content | ||
} | ||
|
||
if (Global.CurrentDataBase.ItemsContent.Count > 0) | ||
{ | ||
for (int i = 0; i < Global.CurrentDataBase.ItemsContent.Count; i++) // For each item | ||
{ | ||
Global.CurrentDataBase.ItemsContent[i].RemoveAt(index); // Remove item | ||
} | ||
} | ||
|
||
if (Global.CurrentDataBase.Blocks.Count > index) | ||
{ | ||
Global.CurrentDataBase.Blocks.RemoveAt(index); // Remove item | ||
} | ||
|
||
Global.CreatorPage.BlockDisplayer.Children.Remove(this); // Remove current block | ||
} | ||
catch { } | ||
} | ||
} |