sunhonglei 7 months ago
commit 72574cfa83
  1. 10
      Language/zh_CN.xaml
  2. 146
      LoginWindow.xaml
  3. 31
      LoginWindow.xaml.cs
  4. 6
      MainWindow.xaml.cs
  5. 81
      Model/Helper/RegistryHelper.cs
  6. BIN
      Resource/Images/UIResource/08-2.png
  7. BIN
      Resource/Images/UIResource/08-3.png
  8. BIN
      Resource/Images/UIResource/08-4.png
  9. BIN
      Resource/Images/UIResource/08-5.jpg
  10. 8
      SparkClient.csproj
  11. 2
      Views/BaseWindow/BaseControl.xaml
  12. 57
      Views/Configuration/AlgorithmConfigPage.xaml
  13. 45
      Views/Configuration/ConfigMenuPage.xaml
  14. 211
      Views/Configuration/LevelConfigPage.xaml
  15. 3
      Views/Configuration/SettingPageBase.xaml

@ -162,4 +162,14 @@
<sys:String x:Key="ViewportSaveSucceed">保存成功</sys:String>
<sys:String x:Key="ViewportSaveFail">保存失败</sys:String>
<sys:String x:Key="ViewportSelectPath">选择路径</sys:String>
<!-- 登录页 -->
<sys:String x:Key="LoginWindowTitle">星辉钻石检测系统</sys:String>
<sys:String x:Key="LoginWindowAccount">账号</sys:String>
<sys:String x:Key="LoginWindowPassword">密码</sys:String>
<sys:String x:Key="LoginWindowRemember">记住密码</sys:String>
<sys:String x:Key="LoginWindowLogin">登 录</sys:String>
<sys:String x:Key="LoginWindowExit">退 出 系 统</sys:String>
<sys:String x:Key="LoginWindowForgot">如果忘记密码,请联系我们</sys:String>
</ResourceDictionary>

@ -0,0 +1,146 @@
<Window x:Class="SparkClient.LoginWindow"
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:SparkClient"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
ResizeMode="NoResize"
Title="LoginWindow" Height="450" Width="450">
<Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown">
<Border CornerRadius="20"
BorderThickness="1"
BorderBrush="LightGray"
Background="White">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="80"/>
<RowDefinition Height="20"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 标题 -->
<Grid Grid.Row="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="/Resource/Images/icon_200.png" Width="70"/>
<TextBlock Grid.Column="1" Text="{StaticResource LoginWindowTitle}"
FontSize="32" FontWeight="Bold" VerticalAlignment="Center">
<TextBlock.Foreground>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#58b9e3" Offset="0"/>
<GradientStop Color="#349ad0" Offset="1"/>
</LinearGradientBrush>
</TextBlock.Foreground>
</TextBlock>
</Grid>
</Grid>
<!-- 账号输入 -->
<Grid Grid.Row="3" >
<Border Height="40" CornerRadius="20" BorderBrush="#ebeef5"
BorderThickness="1" Background="#ebeef5"
Margin="40 10" Padding="20 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Width="25" Height="25" Source="Resource/Images/UIResource/08-2.png" />
<hc:TextBox Grid.Column="1" Grid.ColumnSpan="2" BorderThickness="0" FontSize="18" HorizontalAlignment="Stretch"
Background="Transparent" Padding="5 0" hc:InfoElement.ShowClearButton="True"
VerticalAlignment="Stretch" TextAlignment="Left" x:Name="AccountTextBox"
hc:InfoElement.Placeholder="{StaticResource LoginWindowAccount}"
/>
<!-- <Image Grid.Column="2" Width="25" Height="25" Source="Resource/Images/UIResource/08-4.png" MouseLeftButtonDown="UIElement_OnMouseLeftButtonDown" /> -->
</Grid>
</Border>
</Grid>
<!-- 密码输入 -->
<Grid Grid.Row="4" >
<Border Height="40" CornerRadius="20" BorderBrush="#ebeef5"
BorderThickness="1" Background="#ebeef5"
Margin="40 10" Padding="20 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Width="25" Height="25" Source="Resource/Images/UIResource/08-3.png" />
<hc:PasswordBox Grid.Column="1" Grid.ColumnSpan="2" ShowEyeButton="True" BorderThickness="0"
FontSize="18" HorizontalAlignment="Stretch" hc:InfoElement.Necessary="True" Background="Transparent"
hc:InfoElement.Placeholder="{StaticResource LoginWindowPassword}"/>
</Grid>
</Border>
</Grid>
<!-- 记住密码 -->
<CheckBox Grid.Row="5" Content="{StaticResource LoginWindowRemember}"
Background="#8ea4c9" IsChecked="True" Foreground="#8c8c8c" FontSize="16"
Margin="45 5"/>
<!-- 登录按钮 -->
<Button x:Name="ConfirmButton" Grid.Row="6" Padding="0" Margin="0 10 0 10" Height="50"
Width="360 "
BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}">
<Border
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="360"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#61bde2" Offset="0"/>
<GradientStop Color="#53abd9" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock FontSize="18" Text="{StaticResource LoginWindowLogin}" TextAlignment="Center" Foreground="#ffffff"></TextBlock>
</Border>
</Button>
<Button x:Name="CloseButton" Grid.Row="7" Padding="0" Margin="0 0 0 20" Height="50"
Width="360 " Click="CloseButton_OnClick"
BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}">
<Border
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="360"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#e3687d" Offset="0"/>
<GradientStop Color="#d95464" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock FontSize="18" Text="{StaticResource LoginWindowExit}" TextAlignment="Center" Foreground="#ffffff"></TextBlock>
</Border>
</Button>
<!-- 联系我们 -->
<TextBlock Grid.Row="8" Text="{StaticResource LoginWindowForgot}" TextAlignment="Center"
Margin="20,0" FontSize="14" Foreground="#8e8e8e" Padding="0 10 0 0" VerticalAlignment="Bottom"/>
</Grid>
</Border>
</Grid>
</Window>

@ -0,0 +1,31 @@
using System.Windows;
using System.Windows.Input;
namespace SparkClient;
public partial class LoginWindow : Window
{
public LoginWindow()
{
InitializeComponent();
WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.ButtonState == MouseButtonState.Pressed)
{
this.DragMove();
}
}
private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
AccountTextBox.Text = string.Empty;
}
private void CloseButton_OnClick(object sender, RoutedEventArgs e)
{
this.Close();
Environment.Exit(0);
}
}

@ -13,6 +13,7 @@ using SparkClient.Model.Helper;
using SparkClient.ViewModel;
using SparkClient.ViewModel.BaseWindow;
using SparkClient.Views.BaseWindow;
using MessageBox = SparkClient.Views.Dialog.MessageBox;
using Window = System.Windows.Window;
namespace SparkClient;
@ -138,9 +139,10 @@ public partial class MainWindow
var message = MultilingualHelper.getString("ExitAsk");
var title = MultilingualHelper.getString("ExitAskTitle");
MessageBoxResult result = HandyControl.Controls.MessageBox.Show( message, title, MessageBoxButton.YesNo, MessageBoxImage.Question );
// MessageBoxResult result = HandyControl.Controls.MessageBox.Show( message, title, MessageBoxButton.YesNo, MessageBoxImage.Question );
MessageBoxResult result = new MessageBox().ShowAsk(message);
if (result == MessageBoxResult.Yes)
if (result == MessageBoxResult.OK)
{
DataBaseHelper.CloseConnection();
// this.Close();

@ -0,0 +1,81 @@
using Microsoft.Win32;
namespace SparkClient.Model.Helper;
public static class RegistryHelper
{
private const string BaseRegistryKey = @"SOFTWARE\Dayu\Spark";
/// <summary>
/// 向注册表写入字符串类型值
/// </summary>
/// <param name="keyName">存储的键名</param>
/// <param name="value">要写入的字符串值</param>
public static void WriteString(string keyName, string value)
{
using (var key = Registry.CurrentUser.CreateSubKey(BaseRegistryKey))
{
key?.SetValue(keyName, value, RegistryValueKind.String);
}
}
/// <summary>
/// 从注册表读取字符串类型值
/// </summary>
/// <param name="keyName">存储的键名</param>
/// <returns>读取到的字符串值,若不存在则返回 null</returns>
public static string ReadString(string keyName)
{
using (var key = Registry.CurrentUser.OpenSubKey(BaseRegistryKey))
{
if (key == null) return null;
return key.GetValue(keyName) as string;
}
}
/// <summary>
/// 向注册表写入布尔类型值(以 0/1 方式)
/// </summary>
public static void WriteBool(string keyName, bool value)
{
using (var key = Registry.CurrentUser.CreateSubKey(BaseRegistryKey))
{
key?.SetValue(keyName, value ? 1 : 0, RegistryValueKind.DWord);
}
}
/// <summary>
/// 从注册表读取布尔类型值(从 0/1 转换)
/// </summary>
public static bool ReadBool(string keyName, bool defaultValue = false)
{
using (var key = Registry.CurrentUser.OpenSubKey(BaseRegistryKey))
{
if (key == null) return defaultValue;
object regValue = key.GetValue(keyName);
if (regValue == null) return defaultValue;
int intVal;
if (int.TryParse(regValue.ToString(), out intVal))
{
return intVal != 0; // 1->true, 0->false
}
return defaultValue;
}
}
/// <summary>
/// 删除某个键值
/// </summary>
/// <param name="keyName">要删除的键名</param>
public static void DeleteKey(string keyName)
{
using (var key = Registry.CurrentUser.OpenSubKey(BaseRegistryKey, writable: true))
{
if (key != null)
{
key.DeleteValue(keyName, throwOnMissingValue: false);
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -154,6 +154,14 @@
<Resource Include="Resource\Images\UserControl\03-8-2.png" />
<None Remove="Resource\Images\UserControl\03-14-1.png" />
<Resource Include="Resource\Images\UserControl\03-14-1.png" />
<None Remove="Resource\Images\UIResource\08-2.png" />
<Resource Include="Resource\Images\UIResource\08-2.png" />
<None Remove="Resource\Images\UIResource\08-3.png" />
<Resource Include="Resource\Images\UIResource\08-3.png" />
<None Remove="Resource\Images\UIResource\08-4.png" />
<Resource Include="Resource\Images\UIResource\08-4.png" />
<None Remove="Resource\Images\UIResource\08-5.jpg" />
<Resource Include="Resource\Images\UIResource\08-5.jpg" />
</ItemGroup>
<ItemGroup>

@ -134,7 +134,7 @@
</Button>
</Border>
</Grid>
<Border Grid.Row="1" Grid.Column="0" Background="#ffffff" Padding="10" Margin="20 10" CornerRadius="15">
<Border Grid.Row="1" Grid.Column="0" Padding="10" Margin="20 10" CornerRadius="15">
<ContentControl Name="ContentMain" Content="{Binding Content}" />
</Border>

@ -22,9 +22,60 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Grid.Column="0" Grid.Row="0" Content="{ DynamicResource Save}" Width="80" Margin="10 5 " Command="{Binding SaveAlgorithmDataCommand}"/>
<Button Grid.Column="1" Grid.Row="0" Content="{DynamicResource BeautifyJson}" Width="80" Margin="10 5 " Command="{Binding BeautifyJsonCommand}"/>
<Button Grid.Column="2" Grid.Row="0" Content="{DynamicResource UglifyJson}" Width="80" Margin="10 5 " Command="{Binding UglifyJsonCommand}"/>
<Button Grid.Column="0" Grid.Row="0" Width="100" Margin="0 5 " Padding="0" Height="50"
BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding SaveAlgorithmDataCommand}">
<Border HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="100"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#61bde2" Offset="0"/>
<GradientStop Color="#53abd9" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock Text="{ DynamicResource Save}" TextAlignment="Center" Foreground="#ffffff" FontSize="16"></TextBlock>
</Border>
</Button>
<Button Grid.Column="1" Grid.Row="0" Width="100" Margin="10 5 " Padding="0" Height="50"
BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding BeautifyJsonCommand}">
<Border HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="100"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#61bde2" Offset="0"/>
<GradientStop Color="#53abd9" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock Text="{ DynamicResource BeautifyJson}" TextAlignment="Center" Foreground="#ffffff" FontSize="16"></TextBlock>
</Border>
</Button>
<Button Grid.Column="2" Grid.Row="0" Width="100" Margin="0 5 " Padding="0" Height="50"
BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding UglifyJsonCommand}">
<Border HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="100"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#61bde2" Offset="0"/>
<GradientStop Color="#53abd9" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock Text="{ DynamicResource UglifyJson}" TextAlignment="Center" Foreground="#ffffff" FontSize="16"></TextBlock>
</Border>
</Button>
<!-- <TextBox Grid.Column="3" Grid.Row="0" Text="{Binding AlgorithmConfigJson}"></TextBox> -->

@ -7,28 +7,47 @@
Loaded="ConfigMenuPage_OnLoaded"
mc:Ignorable="d" >
<Border.Resources>
<!-- 定义一个平移转换,用于让按钮整体向上移动 -->
<TranslateTransform x:Key="ButtonTranslateTransform" X="0" Y="0" x:Shared="False" />
<!-- 定义一个缩放变换,用于按钮的放大缩小 -->
<ScaleTransform x:Key="ButtonScaleTransform" ScaleX="1" ScaleY="1" x:Shared="False" />
<!-- 鼠标移入的动画:Y从0移动到 -20 像素(向上) -->
<!-- 鼠标移入的放大动画 -->
<Storyboard x:Key="MouseEnterStoryboard">
<!-- 放大ScaleX -->
<DoubleAnimation
From="0" To="-20"
From="1" To="1.1"
Duration="0:0:0.3"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
<!-- 使用三次方缓动函数,EaseOut 表示前快后慢 -->
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<!-- 放大ScaleY -->
<DoubleAnimation
From="1" To="1.1"
Duration="0:0:0.3"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
<!-- 鼠标移出时的动画:Y从 -20 返回到 0 -->
<!-- 鼠标移出的缩小动画 -->
<Storyboard x:Key="MouseLeaveStoryboard">
<!-- 缩回ScaleX -->
<DoubleAnimation
From="1.1" To="1"
Duration="0:0:0.3"
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<!-- 缩回ScaleY -->
<DoubleAnimation
From="-20" To="0"
From="1.1" To="1"
Duration="0:0:0.3"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
@ -172,7 +191,7 @@
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Padding="0" Width="250" Height="250" BorderBrush="Transparent"
RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource ButtonTranslateTransform}"
RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource ButtonScaleTransform}"
Command="{Binding LevelConfigCommand}">
<Button.Background>
<ImageBrush ImageSource="../../Resource/Images/UIResource/02-4.png"></ImageBrush>
@ -190,7 +209,7 @@
Text="{StaticResource LevelConfig}"/>
</Button>
<Button Grid.Column="2" Padding="0" Width="250" Height="250" BorderBrush="Transparent"
RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource ButtonTranslateTransform}"
RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource ButtonScaleTransform}"
Command="{Binding AlgorithmConfigCommand}">
<Button.Background>
<ImageBrush ImageSource="../../Resource/Images/UIResource/02-5.png"></ImageBrush>
@ -208,7 +227,7 @@
Text="{StaticResource AlgorithmConfig}"/>
</Button>
<Button Grid.Column="4" Padding="0" Width="250" Height="250" BorderBrush="Transparent"
RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource ButtonTranslateTransform}"
RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource ButtonScaleTransform}"
Command="{Binding CutConfigCommand}">
<Button.Background>
<ImageBrush ImageSource="../../Resource/Images/UIResource/02-6.png"></ImageBrush>
@ -226,7 +245,7 @@
Text="{StaticResource CutConfig}"/>
</Button>
<Button Grid.Column="6" Padding="0" Width="250" Height="250" BorderBrush="Transparent"
RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource ButtonTranslateTransform}"
RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource ButtonScaleTransform}"
Command="{Binding SettingConfigCommand}">
<Button.Background>
<ImageBrush ImageSource="../../Resource/Images/UIResource/02-7.png"></ImageBrush>

@ -6,58 +6,177 @@
xmlns:local="clr-namespace:SparkClient.Views"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d">
<Border.Resources>
<Style x:Key="BorderRowStyle" TargetType="Border">
<Setter Property="CornerRadius" Value="15" />
<Setter Property="Background" Value="#ffffff" />
<Setter Property="Padding" Value="5 10" />
<Setter Property="Margin" Value="2 3" />
</Style>
<!-- 自定义 DataGrid 样式 -->
<Style TargetType="DataGrid" x:Key="CustomDataGridStyle">
<!-- 整体设置 -->
<Setter Property="Background" Value="Transparent"/> <!-- DataGrid 背景透明 -->
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="GridLinesVisibility" Value="None"/> <!-- 去掉网格线 -->
<Setter Property="IsReadOnly" Value="True"/> <!-- 不可编辑 -->
<Setter Property="ColumnWidth" Value="*"/> <!-- 列铺满剩余空间 -->
<Setter Property="HeadersVisibility" Value="Column"/> <!-- 显示标题行 -->
<Setter Property="AutoGenerateColumns" Value="False"/> <!-- 根据需要,可开启或关闭 -->
<Setter Property="RowStyle">
<Setter.Value>
<Style TargetType="DataGridRow">
<!-- 行背景色, 包括选中、鼠标悬浮等情况下也都能看到基本色 -->
<Setter Property="Background" Value="#f0f1f6"/>
<Setter Property="Height" Value="50"/>
<!-- 行下方留 2 像素空隙,相当于“行间距” -->
<Setter Property="Margin" Value="0,3,0,3"/>
<!-- 如果你想去掉选中/悬浮的高亮色,可进一步设置 SelectionUnit、Triggers 等 -->
</Style>
</Setter.Value>
</Setter>
<!-- 标题行样式 -->
<Setter Property="ColumnHeaderStyle">
<Setter.Value>
<Style TargetType="DataGridColumnHeader">
<!-- 标题背景色 -->
<Setter Property="Background" Value="#f0f1f6"/>
<!-- 标题内容居中 -->
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Height" Value="50"/>
<!-- <Setter Property="ClipToBounds" Value="True"/> -->
<!-- 如果想去掉边框,可设置 BorderThickness、BorderBrush 等 -->
</Style>
</Setter.Value>
</Setter>
<!-- 单元格样式:让单元格内容水平/垂直居中 -->
<Setter Property="CellStyle">
<Setter.Value>
<Style TargetType="DataGridCell">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<!-- 同样可以在此修改单元格的边框、前景色等 -->
</Style>
</Setter.Value>
</Setter>
</Style>
</Border.Resources>
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin=" 0 10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" Width="140" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0"
ItemsSource="{Binding Institutes}" Margin="10 0" DisplayMemberPath="{DynamicResource RULE_NAME}" SelectedValuePath="RULE_ID"
SelectedValue="{Binding InstituteId, Mode=TwoWay}"
SelectionChanged="ChangeInstitutes"
IsEnabled="{Binding InstitutesEnabled,Mode=TwoWay}"/>
<ComboBox Grid.Column="1" Width="140" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0"
ItemsSource="{Binding Shapes}" Margin="10 0" DisplayMemberPath="{DynamicResource SHAPE_NAME}" SelectedValuePath="SHAPE_ID"
SelectedValue="{Binding ShapeId, Mode=TwoWay}"
SelectionChanged="ChangeShapes"
IsEnabled="{Binding ShapesEnabled,Mode=TwoWay}"/>
<Button Grid.Column="2" Content="{DynamicResource Save}" Margin="10 0" Command="{Binding SaveLevelConfigCommand}"/>
<!--<Button Grid.Column="3" Content="{DynamicResource DeleteConfig}" Margin="10 0" Command="{Binding DelLevelConfigCommand}"/>-->
<Button Grid.Column="5" Content="{DynamicResource ImportConfig}" Margin="10 0" HorizontalAlignment="Right" Command="{Binding LoadLevelConfigCommand}"
/>
</Grid>
<Border Grid.Row="0" Style="{DynamicResource BorderRowStyle}">
<Grid Margin=" 0 10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="#e0e2ee" CornerRadius="20" Height="40" Width="210" Margin="10 0 0 0">
<ComboBox Width="180" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0"
ItemsSource="{Binding Institutes}" Margin="10 0" DisplayMemberPath="{DynamicResource RULE_NAME}" SelectedValuePath="RULE_ID"
SelectedValue="{Binding InstituteId, Mode=TwoWay}"
SelectionChanged="ChangeInstitutes"
IsEnabled="{Binding InstitutesEnabled,Mode=TwoWay}"
FontSize="16" Background="Transparent" BorderThickness="0" BorderBrush="Black"
>
</ComboBox>
</Border>
<Border Grid.Column="1" Background="#e0e2ee" CornerRadius="20" Height="40" Width="210" Margin="10 0 0 0">
<ComboBox Width="180" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0"
ItemsSource="{Binding Shapes}" Margin="10 0" DisplayMemberPath="{DynamicResource SHAPE_NAME}" SelectedValuePath="SHAPE_ID"
SelectedValue="{Binding ShapeId, Mode=TwoWay}"
SelectionChanged="ChangeShapes" FontSize="16" Background="Transparent" BorderThickness="0"
IsEnabled="{Binding ShapesEnabled,Mode=TwoWay}" BorderBrush="Black"/>
</Border>
<Button Grid.Column="2" Grid.Row="0" Width="100" Margin="10 5 " Padding="0" Height="50"
BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding SaveLevelConfigCommand}">
<Border HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="100"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#29c4ba" Offset="0"/>
<GradientStop Color="#13b1a8" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock Text="{ DynamicResource Save}" TextAlignment="Center" Foreground="#ffffff" FontSize="16"></TextBlock>
</Border>
</Button>
<!-- <Button Grid.Column="2" Content="{DynamicResource Save}" Margin="10 0" Command="{Binding SaveLevelConfigCommand}"/> -->
<!--<Button Grid.Column="3" Content="{DynamicResource DeleteConfig}" Margin="10 0" Command="{Binding DelLevelConfigCommand}"/>-->
<!-- <Button Grid.Column="5" Content="{DynamicResource ImportConfig}" Margin="10 0" HorizontalAlignment="Right" Command="{Binding LoadLevelConfigCommand}"/> -->
<Button Grid.Column="5" Grid.Row="0" Width="100" Margin="10 5 10 5" Padding="0" Height="50"
BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding LoadLevelConfigCommand}">
<Border HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="100"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#36adff" Offset="0"/>
<GradientStop Color="#3c9ce6" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock Text="{ DynamicResource ImportConfig}" TextAlignment="Center" Foreground="#ffffff" FontSize="16"></TextBlock>
</Border>
</Button>
</Grid>
</Border>
<DataGrid Grid.Row="1" x:Name="DataGrid1" HeadersVisibility="Column" RowHeaderWidth="60" AutoGenerateColumns="False" IsReadOnly="True"
ItemsSource="{Binding StandardList}" CanUserResizeColumns="False" CanUserResizeRows="False">
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="MinWidth" Value="150"/>
<Setter Property="BorderThickness" Value="1,1,1,1"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="1,1,1,1"/>
<Setter Property="BorderBrush" Value="Gray"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
<Border Grid.Row="1" Style="{DynamicResource BorderRowStyle}">
<!-- <DataGrid Grid.Row="1" x:Name="DataGrid1" HeadersVisibility="Column" RowHeaderWidth="60" AutoGenerateColumns="False" IsReadOnly="True" -->
<!-- ItemsSource="{Binding StandardList}" CanUserResizeColumns="False" CanUserResizeRows="False"> -->
<!-- <DataGrid.ColumnHeaderStyle> -->
<!-- <Style TargetType="DataGridColumnHeader"> -->
<!-- <Setter Property="MinWidth" Value="150"/> -->
<!-- <Setter Property="BorderThickness" Value="1,1,1,1"/> -->
<!-- <Setter Property="BorderBrush" Value="Gray"/> -->
<!-- <Setter Property="HorizontalContentAlignment" Value="Center"/> -->
<!-- </Style> -->
<!-- </DataGrid.ColumnHeaderStyle> -->
<!-- <DataGrid.CellStyle> -->
<!-- <Style TargetType="DataGridCell"> -->
<!-- <Setter Property="BorderThickness" Value="1,1,1,1"/> -->
<!-- <Setter Property="BorderBrush" Value="Gray"/> -->
<!-- </Style> -->
<!-- </DataGrid.CellStyle> -->
<!-- <DataGrid.RowStyle> -->
<!-- <Style TargetType="DataGridRow"> -->
<!-- <Setter Property="HorizontalContentAlignment" Value="Center"/> -->
<!-- </Style> -->
<!-- </DataGrid.RowStyle> -->
<!-- </DataGrid> -->
<DataGrid Style="{StaticResource CustomDataGridStyle}"
ItemsSource="{Binding StandardList}" x:Name="DataGrid1">
<!-- 自定义列示例(AutoGenerateColumns=false 时需要手动定义) -->
<!-- <DataGrid.Columns> -->
<!-- <DataGridTextColumn Header="列一" Binding="{Binding Prop1}" /> -->
<!-- <DataGridTextColumn Header="列二" Binding="{Binding Prop2}" /> -->
<!-- ~1~ ... @1@ -->
<!-- </DataGrid.Columns> -->
</DataGrid>
</Border>
</Grid>
</Border>

@ -5,7 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:SparkClient.Views.Configuration"
mc:Ignorable="d"
mc:Ignorable="d" CornerRadius="15"
Background="#ffffff"
d:DesignHeight="300" d:DesignWidth="500">
<Border.Resources>
<!-- 渐变背景色,用于选项卡的不同状态 -->

Loading…
Cancel
Save