首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
@@ -0,0 +1,77 @@
<Window x:Class="Sicentury.Core.Dialogs.PresetGroupSaveDialog"
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"
mc:Ignorable="d"
d:Height="200" d:Width="400"
WindowStyle="None"
WindowStartupLocation="CenterScreen"
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent">
<Grid Height="140" Width="330">
<Grid.Effect>
<DropShadowEffect BlurRadius="40" ShadowDepth="10" Opacity="0.7" />
</Grid.Effect>
<Border
Background="{DynamicResource Tab_BG}"
BorderBrush="Gray"
BorderThickness="3">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Border
Background="{DynamicResource Table_BG_Content_Highlight}"
BorderBrush="{DynamicResource Table_BD}"
BorderThickness="1">
<Canvas>
<TextBlock
Canvas.Left="10"
Canvas.Top="22"
FontFamily="Arial"
FontSize="12"
Foreground="{DynamicResource FG_Black}"
Text="Group Name" />
<TextBox
x:Name="txtGroupName"
Canvas.Left="100"
Canvas.Top="16"
Width="200"
Height="28"
MaxLength="30" />
<TextBlock
x:Name="txtErrors"
Canvas.Left="100"
Canvas.Top="47"
Text="" Foreground="Red"/>
</Canvas>
</Border>
<StackPanel
Grid.Row="1"
Margin="0 10 0 0"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button x:Name="btnOk"
Width="90"
Height="30"
Content="OK"
Click="BtnOk_OnClick">
</Button>
<Button x:Name="btnCancel"
Width="90"
Height="30"
Margin="10,0,0,0"
Content="Cancel"
Click="BtnCancel_OnClick">
</Button>
</StackPanel>
</Grid>
</Border>
</Grid>
</Window>
@@ -0,0 +1,91 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
namespace Sicentury.Core.Dialogs
{
/// <summary>
/// Interaction logic for PresetGroupSaveDialog.xaml
/// </summary>
public partial class PresetGroupSaveDialog
{
#region Variables
private readonly IEnumerable<string> _existFileNames;
#endregion
#region Constructors
public PresetGroupSaveDialog(string title, IEnumerable<string> existFileNames, string defaultGroupName = "")
{
InitializeComponent();
Title = title;
_existFileNames = existFileNames;
if (!string.IsNullOrEmpty(defaultGroupName))
txtGroupName.Text = defaultGroupName;
}
#endregion
#region Properties
public string GroupName => txtGroupName.Text;
#endregion
#region Methods
protected override void OnActivated(System.EventArgs e)
{
txtGroupName.SelectAll();
txtGroupName.Focus();
}
#endregion
#region Events
private void BtnOk_OnClick(object sender, RoutedEventArgs e)
{
// 检查文件明是否为空
if (string.IsNullOrEmpty(GroupName))
{
txtErrors.Text = "Group Name is Empty";
txtGroupName.SelectAll();
txtGroupName.Focus();
return;
}
// 检查文件名是否包含非法字符
if (GroupName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
txtErrors.Text = "illegal char(s) in Group Name";
txtGroupName.SelectAll();
txtGroupName.Focus();
return;
}
if (_existFileNames != null && _existFileNames.Contains(GroupName))
{
txtErrors.Text = "Group Name has existed";
txtGroupName.SelectAll();
txtGroupName.Focus();
return;
}
this.DialogResult = true;
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
#endregion
}
}