添加 MX-PD-盘古 项目文件

将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
This commit is contained in:
Shi.Ji
2026-05-18 11:43:09 +08:00
parent 03632a379d
commit e31d3560bb
739 changed files with 99783 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace MainShell.Resources.CustomControl
{
public partial class AxisMoveControl : UserControl
{
public static readonly DependencyProperty IsAllShowProperty =
DependencyProperty.Register(nameof(IsAllShow), typeof(bool), typeof(AxisMoveControl), new PropertyMetadata(true));
public static readonly DependencyProperty IsReadOnlyProperty =
DependencyProperty.Register(nameof(IsReadOnly), typeof(bool), typeof(AxisMoveControl), new PropertyMetadata(false));
public static readonly DependencyProperty LableContent1Property =
DependencyProperty.Register(nameof(LableContent1), typeof(string), typeof(AxisMoveControl), new PropertyMetadata());
public static readonly DependencyProperty Value1Property =
DependencyProperty.Register(nameof(Value1), typeof(double), typeof(AxisMoveControl), new PropertyMetadata(0.0));
public static readonly DependencyProperty Min1Property =
DependencyProperty.Register(nameof(Min1), typeof(double), typeof(AxisMoveControl), new PropertyMetadata(-1000.0));
public static readonly DependencyProperty Max1Property =
DependencyProperty.Register(nameof(Max1), typeof(double), typeof(AxisMoveControl), new PropertyMetadata(1000.0));
public static readonly DependencyProperty LableContent2Property =
DependencyProperty.Register(nameof(LableContent2), typeof(string), typeof(AxisMoveControl), new PropertyMetadata());
public static readonly DependencyProperty Value2Property =
DependencyProperty.Register(nameof(Value2), typeof(double), typeof(AxisMoveControl), new PropertyMetadata(0.0));
public static readonly DependencyProperty Min2Property =
DependencyProperty.Register(nameof(Min2), typeof(double), typeof(AxisMoveControl), new PropertyMetadata(-1000.0));
public static readonly DependencyProperty Max2Property =
DependencyProperty.Register(nameof(Max2), typeof(double), typeof(AxisMoveControl), new PropertyMetadata(1000.0));
public static readonly DependencyProperty LableWidthProperty =
DependencyProperty.Register(nameof(LableWidth), typeof(int), typeof(AxisMoveControl), new PropertyMetadata(80));
public static readonly DependencyProperty NumberBoxWidthProperty =
DependencyProperty.Register(nameof(NumberBoxWidth), typeof(int), typeof(AxisMoveControl), new PropertyMetadata(80));
public bool IsAllShow { get => (bool)GetValue(IsAllShowProperty); set => SetValue(IsAllShowProperty, value); }
public bool IsReadOnly { get => (bool)GetValue(IsReadOnlyProperty); set => SetValue(IsReadOnlyProperty, value); }
public string LableContent1 { get => (string)GetValue(LableContent1Property); set => SetValue(LableContent1Property, value); }
public int LableWidth { get => (int)GetValue(LableWidthProperty); set => SetValue(LableWidthProperty, value); }
public int NumberBoxWidth { get => (int)GetValue(NumberBoxWidthProperty); set => SetValue(NumberBoxWidthProperty, value); }
public double Value1 { get => (double)GetValue(Value1Property); set => SetValue(Value1Property, value); }
public double Min1 { get => (double)GetValue(Min1Property); set => SetValue(Min1Property, value); }
public double Max1 { get => (double)GetValue(Max1Property); set => SetValue(Max1Property, value); }
public string LableContent2 { get => (string)GetValue(LableContent2Property); set => SetValue(LableContent2Property, value); }
public double Value2 { get => (double)GetValue(Value2Property); set => SetValue(Value2Property, value); }
public double Min2 { get => (double)GetValue(Min2Property); set => SetValue(Min2Property, value); }
public double Max2 { get => (double)GetValue(Max2Property); set => SetValue(Max2Property, value); }
public ICommand MoveCommand
{
get => (ICommand)GetValue(MoveCommandProperty);
set => SetValue(MoveCommandProperty, value);
}
public static readonly DependencyProperty MoveCommandProperty =
DependencyProperty.Register(nameof(MoveCommand), typeof(ICommand), typeof(AxisMoveControl), new PropertyMetadata(null));
public ICommand ReadCommand
{
get => (ICommand)GetValue(ReadCommandProperty);
set => SetValue(ReadCommandProperty, value);
}
public static readonly DependencyProperty ReadCommandProperty =
DependencyProperty.Register(nameof(ReadCommand), typeof(ICommand), typeof(AxisMoveControl), new PropertyMetadata(null));
}
}

View File

@@ -0,0 +1,58 @@
<UserControl x:Class="MainShell.Resources.CustomControl.AxisMoveControl"
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:MainShell.Resources.CustomControl"
xmlns:mw="http://www.maxwell-gp.com/"
mc:Ignorable="d" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Content="{Binding LableContent1, RelativeSource={RelativeSource AncestorType=UserControl}}"
Width="{Binding LableWidth, RelativeSource={RelativeSource AncestorType=UserControl}}"
Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<mw:NumberBox Value="{Binding Value1, RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Minimum="{Binding Min1, RelativeSource={RelativeSource AncestorType=UserControl}}"
Maximum="{Binding Max1, RelativeSource={RelativeSource AncestorType=UserControl}}"
Width="{Binding NumberBoxWidth, RelativeSource={RelativeSource AncestorType=UserControl}}"
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource AncestorType=UserControl}}"
mw:NumericKeypadAttach.IsEnabled="True"
Grid.Column="1" HorizontalAlignment="Left"
Margin="2" Height="35" />
<Label Visibility="{Binding IsAllShow,Converter={StaticResource BoolToVisibleConverter},
RelativeSource={RelativeSource AncestorType=UserControl}}"
Content="{Binding LableContent2,RelativeSource={RelativeSource AncestorType=UserControl}}"
Width="{Binding LableWidth, RelativeSource={RelativeSource AncestorType=UserControl}}"
Grid.Column="2"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
<mw:NumberBox Visibility="{Binding IsAllShow,
Converter={StaticResource BoolToVisibleConverter},RelativeSource={RelativeSource AncestorType=UserControl}}" Value="{Binding Value2,RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Minimum="{Binding Min2, RelativeSource={RelativeSource AncestorType=UserControl}}"
Maximum="{Binding Max2, RelativeSource={RelativeSource AncestorType=UserControl}}"
Width="{Binding NumberBoxWidth, RelativeSource={RelativeSource AncestorType=UserControl}}"
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource AncestorType=UserControl}}"
mw:NumericKeypadAttach.IsEnabled="True"
Grid.Column="3" HorizontalAlignment="Left"
Margin="2" Height="35" />
<UniformGrid Columns="2" Grid.Column="4">
<Button Grid.Column="1"
Style="{StaticResource TeachButtonStyle}"
Content="{DynamicResource PositionTeach}"
Command="{Binding ReadCommand,RelativeSource={RelativeSource AncestorType=UserControl}}"
Width="90" Height="35" HorizontalAlignment="Left" Margin="2" />
<Button Grid.Column="2"
Style="{StaticResource AxisMoveButtonStyle}"
Content="{DynamicResource MoveToPosition}"
Command="{Binding MoveCommand,RelativeSource={RelativeSource AncestorType=UserControl}}"
Width="90" Height="35" HorizontalAlignment="Left" Margin="2" />
</UniformGrid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MainShell.Resources.CustomControl
{
/// <summary>
/// AxisMoveControl.xaml 的交互逻辑
/// </summary>
public partial class AxisMoveControl : UserControl
{
public AxisMoveControl()
{
InitializeComponent();
//DefaultStyleKeyProperty.OverrideMetadata(typeof(AxisMoveControl), new FrameworkPropertyMetadata(typeof(AxisMoveControl)));
}
}
}

View File

@@ -0,0 +1,595 @@
using MainShell.Common;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.ComponentModel;
namespace MainShell.Resources.CustomControl
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>оƬMapͼ<70>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD><D6A7>5-10<31><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>̬״̬<D7B4><CCAC><EFBFBD>£<EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ק<EFBFBD><D7A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public class DieMapControl : FrameworkElement
{
private int _rows;
private int _columns;
private DieState[,] _dieStates;
private Point[,] _dieCoordinates;
private double _minX, _maxX, _minY, _maxY;
private Dictionary<DieState, Brush> _stateBrushes;
// <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>
private DrawingVisual _visual;
private VisualCollection _visuals;
private DispatcherTimer _renderTimer;
private bool _needsRedraw = false;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
private MatrixTransform _transform = new MatrixTransform();
private Point _lastMousePosition;
private Point _mouseDownPosition;
private bool _isDragging;
private bool _isViewChangedByUser;
private Popup _infoPopup;
private TextBlock _infoText;
public static readonly DependencyProperty BackgroundProperty =
DependencyProperty.Register("Background", typeof(Brush), typeof(DieMapControl), new FrameworkPropertyMetadata(Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender));
public Brush Background
{
get { return (Brush)GetValue(BackgroundProperty); }
set { SetValue(BackgroundProperty, value); }
}
public static readonly DependencyProperty MapModelProperty =
DependencyProperty.Register("MapModel", typeof(DieMapModel), typeof(DieMapControl), new PropertyMetadata(null, OnMapModelChanged));
public DieMapModel MapModel
{
get { return (DieMapModel)GetValue(MapModelProperty); }
set { SetValue(MapModelProperty, value); }
}
public static readonly DependencyProperty DieClickedCommandProperty =
DependencyProperty.Register("DieClickedCommand", typeof(ICommand), typeof(DieMapControl), new PropertyMetadata(null));
public ICommand DieClickedCommand
{
get { return (ICommand)GetValue(DieClickedCommandProperty); }
set { SetValue(DieClickedCommandProperty, value); }
}
public event EventHandler<DieClickedEventArgs> DieClicked;
public class DieClickedEventArgs : EventArgs
{
public int Row { get; }
public int Col { get; }
public DieState State { get; }
public DieClickedEventArgs(int row, int col, DieState state)
{
Row = row;
Col = col;
State = state;
}
}
private static void OnMapModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (DieMapControl)d;
if (e.OldValue is DieMapModel oldModel)
{
oldModel.MapInitialized -= control.OnMapInitialized;
oldModel.DieStateChanged -= control.OnDieStateChanged;
oldModel.DieStatesChanged -= control.OnDieStatesChanged;
}
if (e.NewValue is DieMapModel newModel)
{
newModel.MapInitialized += control.OnMapInitialized;
newModel.DieStateChanged += control.OnDieStateChanged;
newModel.DieStatesChanged += control.OnDieStatesChanged;
control.InitializeFromModel(newModel);
}
}
private void OnMapInitialized(object sender, EventArgs e)
{
InitializeFromModel(MapModel);
}
private void OnDieStateChanged(object sender, (int Row, int Col, DieState State) e)
{
_needsRedraw = true;
}
private void OnDieStatesChanged(object sender, IEnumerable<(int Row, int Col, DieState State)> e)
{
_needsRedraw = true;
}
public static readonly DependencyProperty DieSizeProperty =
DependencyProperty.Register("DieSize", typeof(double), typeof(DieMapControl), new FrameworkPropertyMetadata(4.0, FrameworkPropertyMetadataOptions.AffectsRender, OnSizeChanged));
public double DieSize
{
get { return (double)GetValue(DieSizeProperty); }
set { SetValue(DieSizeProperty, value); }
}
public static readonly DependencyProperty SpacingProperty =
DependencyProperty.Register("Spacing", typeof(double), typeof(DieMapControl), new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.AffectsRender, OnSizeChanged));
public double Spacing
{
get { return (double)GetValue(SpacingProperty); }
set { SetValue(SpacingProperty, value); }
}
private static void OnSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = (DieMapControl)d;
control.RedrawAll();
}
public DieMapControl()
{
_visuals = new VisualCollection(this);
_visual = new DrawingVisual();
_visuals.Add(_visual);
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ˢ<EFBFBD>ֵ䣬<D6B5><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
_stateBrushes = new Dictionary<DieState, Brush>
{
{ DieState.Available, CreateFrozenBrush(Color.FromRgb(211, 211, 211)) }, // dz<><C7B3>ɫ
{ DieState.Used, CreateFrozenBrush(Color.FromRgb(50, 205, 50)) }, // <20><>ɫ
{ DieState.Error, CreateFrozenBrush(Color.FromRgb(255, 0, 0)) }, // <20><>ɫ
{ DieState.NotExist, Brushes.Transparent }, // ͸<><CDB8>
{ DieState.Current, CreateFrozenBrush(Color.FromRgb(0, 191, 255)) }, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><>ǰλ<C7B0><CEBB>
{ DieState.Target, CreateFrozenBrush(Color.FromRgb(255, 165, 0)) } // <20><>ɫ - Ŀ<><C4BF>λ<EFBFBD><CEBB>
};
// <20><>ʼ<EFBFBD><CABC>Popup
_infoPopup = new Popup
{
Placement = PlacementMode.Mouse,
StaysOpen = false,
AllowsTransparency = true
};
Border popupBorder = new Border
{
Background = new SolidColorBrush(Color.FromArgb(220, 30, 30, 30)),
BorderBrush = Brushes.Gray,
BorderThickness = new Thickness(1),
CornerRadius = new CornerRadius(4),
Padding = new Thickness(8)
};
_infoText = new TextBlock
{
Foreground = Brushes.White,
FontSize = 12
};
popupBorder.Child = _infoText;
_infoPopup.Child = popupBorder;
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
this.MouseWheel += OnMouseWheel;
this.MouseDown += OnMouseDown;
this.MouseUp += OnMouseUp;
this.MouseMove += OnMouseMove;
this.MouseLeave += OnMouseLeave;
// <20>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
this.ClipToBounds = true;
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>1<EFBFBD><31>3<EFBFBD><33> (Լ333ms)
_renderTimer = new DispatcherTimer(DispatcherPriority.Render);
_renderTimer.Interval = TimeSpan.FromMilliseconds(333);
_renderTimer.Tick += RenderTimer_Tick;
_renderTimer.Start();
}
private void RenderTimer_Tick(object sender, EventArgs e)
{
if (_needsRedraw)
{
RedrawAll();
_needsRedraw = false;
}
}
private SolidColorBrush CreateFrozenBrush(Color color)
{
var brush = new SolidColorBrush(color);
brush.Freeze();
return brush;
}
protected override int VisualChildrenCount => _visuals.Count;
protected override Visual GetVisualChild(int index)
{
if (index < 0 || index >= _visuals.Count)
throw new ArgumentOutOfRangeException();
return _visuals[index];
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (Background != null)
{
drawingContext.DrawRectangle(Background, null, new Rect(0, 0, ActualWidth, ActualHeight));
}
}
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
{
base.OnRenderSizeChanged(sizeInfo);
if (!_isViewChangedByUser && _rows > 0)
{
FitToScreen();
}
}
private void InitializeFromModel(DieMapModel model)
{
if (model == null) return;
_rows = model.Rows;
_columns = model.Columns;
_dieStates = model.States;
_dieCoordinates = model.Coordinates;
if (_dieCoordinates != null)
{
CalculateBounds();
}
// <20><><EFBFBD>ñ任
_transform.Matrix = Matrix.Identity;
// <20>ӳ<EFBFBD>ִ<EFBFBD><D6B4>FitToScreen<65><6E>ȷ<EFBFBD><C8B7><EFBFBD>ؼ<EFBFBD><D8BC>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Dispatcher.BeginInvoke(new Action(() =>
{
if (ActualWidth > 0 && ActualHeight > 0)
{
FitToScreen();
}
else
{
RedrawAll();
}
}), DispatcherPriority.Loaded);
}
private void CalculateBounds()
{
_minX = double.MaxValue;
_maxX = double.MinValue;
_minY = double.MaxValue;
_maxY = double.MinValue;
for (int r = 0; r < _rows; r++)
{
for (int c = 0; c < _columns; c++)
{
var pt = _dieCoordinates[r, c];
if (pt.X < _minX) _minX = pt.X;
if (pt.X > _maxX) _maxX = pt.X;
if (pt.Y < _minY) _minY = pt.Y;
if (pt.Y > _maxY) _maxY = pt.Y;
}
}
}
private void RedrawAll()
{
if (_rows == 0 || _columns == 0 || _dieStates == null) return;
using (DrawingContext dc = _visual.RenderOpen())
{
// Ӧ<>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>ƽ<EFBFBD>Ʊ任
dc.PushTransform(_transform);
double size = DieSize;
double spacing = Spacing;
double physicalWidth = _maxX - _minX;
double physicalHeight = _maxY - _minY;
if (physicalWidth == 0) physicalWidth = 1;
if (physicalHeight == 0) physicalHeight = 1;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>
double baseWidth = _columns * (size + spacing);
double baseHeight = _rows * (size + spacing);
for (int r = 0; r < _rows; r++)
{
for (int c = 0; c < _columns; c++)
{
DieState state = _dieStates[r, c];
if (state == DieState.NotExist) continue;
Brush brush = _stateBrushes.ContainsKey(state) ? _stateBrushes[state] : Brushes.Transparent;
if (brush == Brushes.Transparent) continue;
double x, y;
if (_dieCoordinates != null)
{
var pt = _dieCoordinates[r, c];
x = ((pt.X - _minX) / physicalWidth) * baseWidth;
y = (1.0 - (pt.Y - _minY) / physicalHeight) * baseHeight;
}
else
{
x = c * (size + spacing);
y = r * (size + spacing);
}
dc.DrawRectangle(brush, null, new Rect(x, y, size, size));
}
}
dc.Pop();
}
_needsRedraw = false;
}
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD>)
private void OnMouseWheel(object sender, MouseWheelEventArgs e)
{
Point mousePos = e.GetPosition(this);
double scaleFactor = e.Delta > 0 ? 1.1 : 1 / 1.1;
Matrix matrix = _transform.Matrix;
matrix.ScaleAt(scaleFactor, scaleFactor, mousePos.X, mousePos.Y);
_transform.Matrix = matrix;
_isViewChangedByUser = true;
RedrawAll();
e.Handled = true;
}
private void OnMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Middle)
{
FitToScreen();
}
else if (e.ChangedButton == MouseButton.Left)
{
_mouseDownPosition = e.GetPosition(this);
_lastMousePosition = _mouseDownPosition;
_isDragging = true;
this.CaptureMouse();
_infoPopup.IsOpen = false;
}
}
private void OnMouseUp(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
_isDragging = false;
this.ReleaseMouseCapture();
Point currentPosition = e.GetPosition(this);
if ((currentPosition - _mouseDownPosition).Length < 5)
{
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
{
ShowDieInfo(currentPosition);
}
else
{
HandleDieClick(currentPosition);
}
}
}
}
private void HandleDieClick(Point mousePos)
{
if (_rows == 0 || _columns == 0 || _dieStates == null) return;
if (!_transform.Matrix.HasInverse) return;
Matrix inverse = _transform.Matrix;
inverse.Invert();
Point canvasPos = inverse.Transform(mousePos);
double size = DieSize;
double spacing = Spacing;
double physicalWidth = _maxX - _minX;
double physicalHeight = _maxY - _minY;
if (physicalWidth == 0) physicalWidth = 1;
if (physicalHeight == 0) physicalHeight = 1;
double baseWidth = _columns * (size + spacing);
double baseHeight = _rows * (size + spacing);
int clickedRow = -1;
int clickedCol = -1;
for (int r = 0; r < _rows; r++)
{
for (int c = 0; c < _columns; c++)
{
DieState state = _dieStates[r, c];
if (state == DieState.NotExist) continue;
double x, y;
if (_dieCoordinates != null)
{
var pt = _dieCoordinates[r, c];
x = ((pt.X - _minX) / physicalWidth) * baseWidth;
y = (1.0 - (pt.Y - _minY) / physicalHeight) * baseHeight;
}
else
{
x = c * (size + spacing);
y = r * (size + spacing);
}
if (canvasPos.X >= x && canvasPos.X <= x + size &&
canvasPos.Y >= y && canvasPos.Y <= y + size)
{
clickedRow = r;
clickedCol = c;
break;
}
}
if (clickedRow != -1) break;
}
if (clickedRow != -1)
{
var dieInfo = (Row: clickedRow, Col: clickedCol, State: _dieStates[clickedRow, clickedCol]);
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
DieClicked?.Invoke(this, new DieClickedEventArgs(clickedRow, clickedCol, _dieStates[clickedRow, clickedCol]));
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (DieClickedCommand != null && DieClickedCommand.CanExecute(dieInfo))
{
DieClickedCommand.Execute(dieInfo);
}
}
}
private void OnMouseMove(object sender, MouseEventArgs e)
{
if (_isDragging)
{
Point currentPosition = e.GetPosition(this);
Vector delta = currentPosition - _lastMousePosition;
Matrix matrix = _transform.Matrix;
matrix.Translate(delta.X, delta.Y);
_transform.Matrix = matrix;
_isViewChangedByUser = true;
_lastMousePosition = currentPosition;
RedrawAll();
}
}
private void OnMouseLeave(object sender, MouseEventArgs e)
{
if (_isDragging)
{
_isDragging = false;
this.ReleaseMouseCapture();
}
}
private void FitToScreen()
{
if (_rows == 0 || _columns == 0) return;
double size = DieSize;
double spacing = Spacing;
double baseWidth = _columns * (size + spacing);
double baseHeight = _rows * (size + spacing);
if (baseWidth == 0 || baseHeight == 0 || ActualWidth == 0 || ActualHeight == 0) return;
double scaleX = ActualWidth / baseWidth;
double scaleY = ActualHeight / baseHeight;
double scale = Math.Min(scaleX, scaleY) * 0.9; // 90% to leave some margin
if (scale <= 0) scale = 1;
_transform.Matrix = new Matrix(scale, 0, 0, scale,
(ActualWidth - baseWidth * scale) / 2,
(ActualHeight - baseHeight * scale) / 2);
_isViewChangedByUser = false;
RedrawAll();
}
private void ShowDieInfo(Point mousePos)
{
if (_rows == 0 || _columns == 0 || _dieStates == null) return;
if (!_transform.Matrix.HasInverse) return;
Matrix inverse = _transform.Matrix;
inverse.Invert();
Point canvasPos = inverse.Transform(mousePos);
double size = DieSize;
double spacing = Spacing;
double physicalWidth = _maxX - _minX;
double physicalHeight = _maxY - _minY;
if (physicalWidth == 0) physicalWidth = 1;
if (physicalHeight == 0) physicalHeight = 1;
double baseWidth = _columns * (size + spacing);
double baseHeight = _rows * (size + spacing);
int clickedRow = -1;
int clickedCol = -1;
for (int r = 0; r < _rows; r++)
{
for (int c = 0; c < _columns; c++)
{
DieState state = _dieStates[r, c];
if (state == DieState.NotExist) continue;
double x, y;
if (_dieCoordinates != null)
{
var pt = _dieCoordinates[r, c];
x = ((pt.X - _minX) / physicalWidth) * baseWidth;
y = (1.0 - (pt.Y - _minY) / physicalHeight) * baseHeight;
}
else
{
x = c * (size + spacing);
y = r * (size + spacing);
}
if (canvasPos.X >= x && canvasPos.X <= x + size &&
canvasPos.Y >= y && canvasPos.Y <= y + size)
{
clickedRow = r;
clickedCol = c;
break;
}
}
if (clickedRow != -1) break;
}
if (clickedRow != -1)
{
DieState state = _dieStates[clickedRow, clickedCol];
string info = $"<22><> (Row): {clickedRow}\n<><6E> (Col): {clickedCol}\n״̬: {MainShell.Converter.EnumHelper.GetEnumDescription(state)}";
if (_dieCoordinates != null)
{
var pt = _dieCoordinates[clickedRow, clickedCol];
info += $"\nX: {pt.X:F3}\nY: {pt.Y:F3}";
}
_infoText.Text = info;
_infoPopup.IsOpen = true;
}
else
{
_infoPopup.IsOpen = false;
}
}
#endregion
}
}

View File

@@ -0,0 +1,85 @@
using MainShell.Common;
using System;
using System.Collections.Generic;
using System.Windows;
namespace MainShell.Resources.CustomControl
{
/// <summary>
/// 芯片Map的数据模型用于MVVM绑定
/// </summary>
public class DieMapModel
{
public int Rows { get; private set; }
public int Columns { get; private set; }
public Point[,] Coordinates { get; private set; }
public DieState[,] States { get; private set; }
public event EventHandler MapInitialized;
public event EventHandler<(int Row, int Col, DieState State)> DieStateChanged;
public event EventHandler<IEnumerable<(int Row, int Col, DieState State)>> DieStatesChanged;
/// <summary>
/// 初始化Map图大小和坐标
/// </summary>
public void Initialize(int rows, int columns, Point[,] coordinates = null)
{
Rows = rows;
Columns = columns;
Coordinates = coordinates;
States = new DieState[rows, columns];
// 默认全部设置为NotExist或者根据需要设置
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < columns; c++)
{
States[r, c] = DieState.Available;
}
}
MapInitialized?.Invoke(this, EventArgs.Empty);
}
/// <summary>
/// 更新单个芯片状态
/// </summary>
public void SetDieState(int row, int col, DieState state)
{
if (States != null && row >= 0 && row < Rows && col >= 0 && col < Columns)
{
if (States[row, col] != state)
{
States[row, col] = state;
DieStateChanged?.Invoke(this, (row, col, state));
}
}
}
/// <summary>
/// 批量更新芯片状态
/// </summary>
public void SetDieStates(IEnumerable<(int row, int col, DieState state)> updates)
{
if (States == null) return;
bool changed = false;
foreach (var update in updates)
{
if (update.row >= 0 && update.row < Rows && update.col >= 0 && update.col < Columns)
{
if (States[update.row, update.col] != update.state)
{
States[update.row, update.col] = update.state;
changed = true;
}
}
}
if (changed)
{
DieStatesChanged?.Invoke(this, updates);
}
}
}
}

View File

@@ -0,0 +1,38 @@
<UserControl x:Class="MainShell.Resources.CustomControl.DieMapPanelControl"
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:MainShell.Resources.CustomControl"
x:Name="Root"
mc:Ignorable="d"
d:DesignHeight="220"
d:DesignWidth="260">
<Border BorderBrush="#C7C7C7"
BorderThickness="1"
Background="#F3F4F6">
<Grid>
<local:DieMapControl Background="{Binding MapBackground, ElementName=Root}"
MapModel="{Binding MapModel, ElementName=Root}"
Margin="{Binding MapMargin, ElementName=Root}"
DieSize="{Binding DieSize, ElementName=Root}"
Spacing="{Binding Spacing, ElementName=Root}"
DieClickedCommand="{Binding DieClickedCommand, ElementName=Root}"/>
<Button Width="24"
Height="24"
Margin="0,6,6,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Click="OpenPreviewWindow"
ToolTip="放大查看"
FontSize="12"
FontWeight="Bold"
Content="⛶"/>
<TextBlock Text="{Binding Caption, ElementName=Root}"
Foreground="{Binding CaptionForeground, ElementName=Root}"
VerticalAlignment="Bottom"
HorizontalAlignment="Center"
Margin="{Binding CaptionMargin, ElementName=Root}"/>
</Grid>
</Border>
</UserControl>

View File

@@ -0,0 +1,211 @@
using MainShell.Common;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
namespace MainShell.Resources.CustomControl
{
public partial class DieMapPanelControl : UserControl
{
private DieMapPreviewWindow _previewWindow;
public static readonly DependencyProperty CaptionProperty =
DependencyProperty.Register("Caption", typeof(string), typeof(DieMapPanelControl), new PropertyMetadata(string.Empty));
public static readonly DependencyProperty MapModelProperty =
DependencyProperty.Register("MapModel", typeof(DieMapModel), typeof(DieMapPanelControl), new PropertyMetadata(null));
public static readonly DependencyProperty DieSizeProperty =
DependencyProperty.Register("DieSize", typeof(double), typeof(DieMapPanelControl), new PropertyMetadata(8.0));
public static readonly DependencyProperty SpacingProperty =
DependencyProperty.Register("Spacing", typeof(double), typeof(DieMapPanelControl), new PropertyMetadata(1.0));
public static readonly DependencyProperty MapBackgroundProperty =
DependencyProperty.Register("MapBackground", typeof(Brush), typeof(DieMapPanelControl), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(229, 231, 235))));
public static readonly DependencyProperty CaptionForegroundProperty =
DependencyProperty.Register("CaptionForeground", typeof(Brush), typeof(DieMapPanelControl), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(107, 114, 128))));
public static readonly DependencyProperty MapMarginProperty =
DependencyProperty.Register("MapMargin", typeof(Thickness), typeof(DieMapPanelControl), new PropertyMetadata(new Thickness(8)));
public static readonly DependencyProperty CaptionMarginProperty =
DependencyProperty.Register("CaptionMargin", typeof(Thickness), typeof(DieMapPanelControl), new PropertyMetadata(new Thickness(0, 0, 0, 14)));
public static readonly DependencyProperty DieClickedCommandProperty =
DependencyProperty.Register("DieClickedCommand", typeof(ICommand), typeof(DieMapPanelControl), new PropertyMetadata(null));
public string Caption
{
get
{
return (string)GetValue(CaptionProperty);
}
set
{
SetValue(CaptionProperty, value);
}
}
public DieMapModel MapModel
{
get
{
return (DieMapModel)GetValue(MapModelProperty);
}
set
{
SetValue(MapModelProperty, value);
}
}
public double DieSize
{
get
{
return (double)GetValue(DieSizeProperty);
}
set
{
SetValue(DieSizeProperty, value);
}
}
public double Spacing
{
get
{
return (double)GetValue(SpacingProperty);
}
set
{
SetValue(SpacingProperty, value);
}
}
public Brush MapBackground
{
get
{
return (Brush)GetValue(MapBackgroundProperty);
}
set
{
SetValue(MapBackgroundProperty, value);
}
}
public Brush CaptionForeground
{
get
{
return (Brush)GetValue(CaptionForegroundProperty);
}
set
{
SetValue(CaptionForegroundProperty, value);
}
}
public Thickness MapMargin
{
get
{
return (Thickness)GetValue(MapMarginProperty);
}
set
{
SetValue(MapMarginProperty, value);
}
}
public Thickness CaptionMargin
{
get
{
return (Thickness)GetValue(CaptionMarginProperty);
}
set
{
SetValue(CaptionMarginProperty, value);
}
}
public ICommand DieClickedCommand
{
get
{
return (ICommand)GetValue(DieClickedCommandProperty);
}
set
{
SetValue(DieClickedCommandProperty, value);
}
}
public DieMapPanelControl()
{
InitializeComponent();
}
private void OpenPreviewWindow(object sender, RoutedEventArgs e)
{
if (_previewWindow == null)
{
_previewWindow = CreatePreviewWindow();
_previewWindow.Closed += OnPreviewWindowClosed;
_previewWindow.Show();
return;
}
if (_previewWindow.WindowState == WindowState.Minimized)
{
_previewWindow.WindowState = WindowState.Normal;
}
_previewWindow.Activate();
}
private DieMapPreviewWindow CreatePreviewWindow()
{
DieMapPreviewWindow previewWindow = new DieMapPreviewWindow();
Window owner = Window.GetWindow(this);
if (owner != null && !ReferenceEquals(owner, previewWindow))
{
previewWindow.Owner = owner;
}
BindingOperations.SetBinding(previewWindow, DieMapPreviewWindow.CaptionProperty, CreateBinding(nameof(Caption)));
BindingOperations.SetBinding(previewWindow, DieMapPreviewWindow.MapModelProperty, CreateBinding(nameof(MapModel)));
BindingOperations.SetBinding(previewWindow, DieMapPreviewWindow.MapBackgroundProperty, CreateBinding(nameof(MapBackground)));
BindingOperations.SetBinding(previewWindow, DieMapPreviewWindow.DieSizeProperty, CreateBinding(nameof(DieSize)));
BindingOperations.SetBinding(previewWindow, DieMapPreviewWindow.SpacingProperty, CreateBinding(nameof(Spacing)));
BindingOperations.SetBinding(previewWindow, DieMapPreviewWindow.DieClickedCommandProperty, CreateBinding(nameof(DieClickedCommand)));
return previewWindow;
}
private Binding CreateBinding(string propertyName)
{
return new Binding(propertyName)
{
Source = this,
Mode = BindingMode.OneWay
};
}
private void OnPreviewWindowClosed(object sender, EventArgs e)
{
if (_previewWindow == null)
{
return;
}
_previewWindow.Closed -= OnPreviewWindowClosed;
_previewWindow = null;
}
}
}

View File

@@ -0,0 +1,37 @@
<Window x:Class="MainShell.Resources.CustomControl.DieMapPreviewWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MainShell.Resources.CustomControl"
x:Name="Root"
Title="{Binding Caption, ElementName=Root}"
Width="900"
Height="700"
MinWidth="640"
MinHeight="480"
WindowStartupLocation="CenterOwner"
Background="#F3F4F6"
mc:Ignorable="d"
d:DesignWidth="900"
d:DesignHeight="700">
<Grid Margin="12">
<Border BorderBrush="#C7C7C7"
BorderThickness="1"
Background="#F3F4F6">
<Grid>
<local:DieMapControl Background="{Binding MapBackground, ElementName=Root}"
MapModel="{Binding MapModel, ElementName=Root}"
Margin="12,12,12,36"
DieSize="{Binding DieSize, ElementName=Root}"
Spacing="{Binding Spacing, ElementName=Root}"
DieClickedCommand="{Binding DieClickedCommand, ElementName=Root}"/>
<TextBlock Text="{Binding Caption, ElementName=Root}"
Foreground="#6B7280"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Margin="0,0,0,12"/>
</Grid>
</Border>
</Grid>
</Window>

View File

@@ -0,0 +1,104 @@
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace MainShell.Resources.CustomControl
{
public partial class DieMapPreviewWindow : Window
{
public static readonly DependencyProperty CaptionProperty =
DependencyProperty.Register("Caption", typeof(string), typeof(DieMapPreviewWindow), new PropertyMetadata(string.Empty));
public static readonly DependencyProperty MapModelProperty =
DependencyProperty.Register("MapModel", typeof(DieMapModel), typeof(DieMapPreviewWindow), new PropertyMetadata(null));
public static readonly DependencyProperty DieSizeProperty =
DependencyProperty.Register("DieSize", typeof(double), typeof(DieMapPreviewWindow), new PropertyMetadata(8.0));
public static readonly DependencyProperty SpacingProperty =
DependencyProperty.Register("Spacing", typeof(double), typeof(DieMapPreviewWindow), new PropertyMetadata(1.0));
public static readonly DependencyProperty MapBackgroundProperty =
DependencyProperty.Register("MapBackground", typeof(Brush), typeof(DieMapPreviewWindow), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(229, 231, 235))));
public static readonly DependencyProperty DieClickedCommandProperty =
DependencyProperty.Register("DieClickedCommand", typeof(ICommand), typeof(DieMapPreviewWindow), new PropertyMetadata(null));
public string Caption
{
get
{
return (string)GetValue(CaptionProperty);
}
set
{
SetValue(CaptionProperty, value);
}
}
public DieMapModel MapModel
{
get
{
return (DieMapModel)GetValue(MapModelProperty);
}
set
{
SetValue(MapModelProperty, value);
}
}
public double DieSize
{
get
{
return (double)GetValue(DieSizeProperty);
}
set
{
SetValue(DieSizeProperty, value);
}
}
public double Spacing
{
get
{
return (double)GetValue(SpacingProperty);
}
set
{
SetValue(SpacingProperty, value);
}
}
public Brush MapBackground
{
get
{
return (Brush)GetValue(MapBackgroundProperty);
}
set
{
SetValue(MapBackgroundProperty, value);
}
}
public ICommand DieClickedCommand
{
get
{
return (ICommand)GetValue(DieClickedCommandProperty);
}
set
{
SetValue(DieClickedCommandProperty, value);
}
}
public DieMapPreviewWindow()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,28 @@
<UserControl x:Class="MainShell.Resources.CustomControl.FlowStageDisplayControl"
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:MainShell.Resources.CustomControl"
mc:Ignorable="d"
d:DesignHeight="80" d:DesignWidth="500">
<Grid>
<Border Height="2" Margin="86,0,86,30" Background="#D1D5DB" VerticalAlignment="Bottom"/>
<ItemsControl ItemsSource="{Binding FlowNodes, RelativeSource={RelativeSource AncestorType={x:Type local:FlowStageDisplayControl}}}"
Margin="40,14,40,16" VerticalAlignment="Center">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Center">
<Ellipse Width="12" Height="12" Fill="{Binding Brush}"/>
<TextBlock Text="{Binding DisplayName}" HorizontalAlignment="Center" Margin="0,4,0,0"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</UserControl>

View File

@@ -0,0 +1,23 @@
using System.Collections;
using System.Windows;
using System.Windows.Controls;
namespace MainShell.Resources.CustomControl
{
public partial class FlowStageDisplayControl : UserControl
{
public static readonly DependencyProperty FlowNodesProperty =
DependencyProperty.Register("FlowNodes", typeof(IEnumerable), typeof(FlowStageDisplayControl), new PropertyMetadata(null));
public IEnumerable FlowNodes
{
get { return (IEnumerable)GetValue(FlowNodesProperty); }
set { SetValue(FlowNodesProperty, value); }
}
public FlowStageDisplayControl()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,53 @@
<UserControl x:Class="MainShell.Resources.CustomControl.HeaderDeviceStatusView"
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:DesignHeight="40" d:DesignWidth="290"
Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibleConverter}}">
<Border Width="282"
Height="38"
Background="{Binding BadgeBackgroundBrush}"
BorderBrush="{Binding BadgeBorderBrush}"
BorderThickness="1"
CornerRadius="6"
Padding="14,0,16,0">
<Border.Effect>
<DropShadowEffect BlurRadius="8" ShadowDepth="1" Opacity="0.16"/>
</Border.Effect>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="{Binding LabelText}"
Margin="0,0,10,0"
VerticalAlignment="Center"
Foreground="{Binding LabelForegroundBrush}"
FontSize="12"
FontWeight="SemiBold"/>
<Ellipse Grid.Column="1"
Width="10"
Height="10"
Margin="0,0,10,0"
VerticalAlignment="Center"
Fill="{Binding IndicatorBrush}">
<Ellipse.Effect>
<DropShadowEffect BlurRadius="6" ShadowDepth="0" Color="#FFFFFFFF" Opacity="0.32"/>
</Ellipse.Effect>
</Ellipse>
<TextBlock Grid.Column="2"
Text="{Binding StatusText}"
VerticalAlignment="Center"
Foreground="{Binding StatusForegroundBrush}"
FontSize="15"
FontWeight="Bold"/>
</Grid>
</Border>
</UserControl>

View File

@@ -0,0 +1,12 @@
using System.Windows.Controls;
namespace MainShell.Resources.CustomControl
{
public partial class HeaderDeviceStatusView : UserControl
{
public HeaderDeviceStatusView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,33 @@
<UserControl x:Class="MainShell.Resources.CustomControl.LightControl"
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:MainShell.Resources.CustomControl"
xmlns:mw="http://www.maxwell-gp.com/"
mc:Ignorable="d"
>
<Grid Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<Border BorderThickness="1" Grid.ColumnSpan="3" BorderBrush="{StaticResource BackgroundDeepBrush}"/>
<TextBlock Grid.Column="0" FontWeight="Black" Style="{StaticResource TextBlockStyle}"
Text="{Binding Header, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
<Slider Grid.Column="1"
VerticalAlignment="Center"
Minimum="{Binding Min, RelativeSource={RelativeSource AncestorType=UserControl}}"
Maximum="{Binding Max, RelativeSource={RelativeSource AncestorType=UserControl}}"
TickFrequency="{Binding Tick, RelativeSource={RelativeSource AncestorType=UserControl}}"
IsSnapToTickEnabled="True"
Value="{Binding Value, RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<mw:IntNumberBox Grid.Column="2" HorizontalContentAlignment="Right" Margin="6,0,0,0"
Minimum="{Binding Min, RelativeSource={RelativeSource AncestorType=UserControl}}"
Maximum="{Binding Max, RelativeSource={RelativeSource AncestorType=UserControl}}"
Value="{Binding Value, RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</UserControl>

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MainShell.Resources.CustomControl
{
/// <summary>
/// LightControl.xaml 的交互逻辑
/// </summary>
public partial class LightControl : UserControl
{
public LightControl()
{
InitializeComponent();
}
public static readonly DependencyProperty HeaderProperty =
DependencyProperty.Register(nameof(Header), typeof(string), typeof(LightControl), new FrameworkPropertyMetadata("通道",FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register(nameof(Value), typeof(int), typeof(LightControl), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public static readonly DependencyProperty EnabledProperty =
DependencyProperty.Register(nameof(Enabled), typeof(bool), typeof(LightControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public static readonly DependencyProperty MinProperty =
DependencyProperty.Register(nameof(Min), typeof(int), typeof(LightControl), new PropertyMetadata(0));
public static readonly DependencyProperty MaxProperty =
DependencyProperty.Register(nameof(Max), typeof(int), typeof(LightControl), new PropertyMetadata(255));
public static readonly DependencyProperty TickProperty =
DependencyProperty.Register(nameof(Tick), typeof(double), typeof(LightControl), new PropertyMetadata(1d));
public string Header { get => (string)GetValue(HeaderProperty); set => SetValue(HeaderProperty, value); }
public int Value { get => (int)GetValue(ValueProperty); set => SetValue(ValueProperty, value); }
public bool Enabled { get => (bool)GetValue(EnabledProperty); set => SetValue(EnabledProperty, value); }
public int Min { get => (int)GetValue(MinProperty); set => SetValue(MinProperty, value); }
public int Max { get => (int)GetValue(MaxProperty); set => SetValue(MaxProperty, value); }
public double Tick { get => (double)GetValue(TickProperty); set => SetValue(TickProperty, value); }
}
}

View File

@@ -0,0 +1,67 @@
using MwFramework.Controls.Components;
using Stylet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace MainShell.Resources.CustomControl
{
public class LoadingService : PropertyChangedBase
{
public static LoadingService Instance { get; } = new LoadingService();
private bool _isBusy;
private string _message;
private double _progressValue;
private bool _canCancel;
private bool _isIndeterminate = true;
private CancellationTokenSource _cts;
public bool IsBusy { get => _isBusy; set => SetAndNotify(ref _isBusy, value); }
public string Message { get => _message; set => SetAndNotify(ref _message, value); }
public double ProgressValue { get => _progressValue; set => SetAndNotify(ref _progressValue, value); }
public bool CanCancel { get => _canCancel; set => SetAndNotify(ref _canCancel, value); }
public bool IsIndeterminate { get => _isIndeterminate; set => SetAndNotify(ref _isIndeterminate, value); }
// 暴露给外部算法使用的 Token
public CancellationToken Token => _cts?.Token ?? CancellationToken.None;
// 取消命令
public ICommand CancelCommand { get; }
private LoadingService()
{
CancelCommand = new DelegateCommand(() => {
_cts?.Cancel();
Message = "正在取消...";
});
}
public void Show(string message, bool isIndeterminate, bool canCancel)
{
_cts = new CancellationTokenSource();
Message = message;
IsIndeterminate = isIndeterminate;
CanCancel = canCancel;
ProgressValue = 0;
IsBusy = true;
}
public void Hide()
{
IsBusy = false;
_cts?.Dispose();
_cts = null;
}
public void Report(double value) => Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
ProgressValue = value;
}));
}
}

View File

@@ -0,0 +1,49 @@
<UserControl x:Class="MainShell.Resources.CustomControl.LoadingWaitView"
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:MainShell.Resources.CustomControl"
DataContext="{x:Static local:LoadingService.Instance}"
Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibleConverter}}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Border Background="#44000000" />
<Border Background="White" CornerRadius="8" Padding="30"
VerticalAlignment="Center" HorizontalAlignment="Center" Width="350">
<Border.Effect>
<DropShadowEffect BlurRadius="15" Opacity="0.2"/>
</Border.Effect>
<StackPanel>
<TextBlock Text="{Binding Message}" FontSize="14" Margin="0,0,0,15" TextAlignment="Center" FontWeight="Bold"/>
<ProgressBar Height="12"
Value="{Binding ProgressValue}"
IsIndeterminate="{Binding IsIndeterminate}"
Maximum="100"/>
<TextBlock HorizontalAlignment="Right" Margin="0,5,0,0" FontSize="12" Foreground="Gray">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{Binding ProgressValue, StringFormat={}{0:F0}%}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsIndeterminate}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Button Content="取消操作"
Command="{Binding CancelCommand}"
Style="{StaticResource StopButtonStyle}"
Visibility="{Binding CanCancel, Converter={StaticResource BoolToVisibleConverter}}"
HorizontalAlignment="Center"
Padding="20,5"
Margin="0,10,0,0"
Cursor="Hand"/>
</StackPanel>
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MainShell.Resources.CustomControl
{
/// <summary>
/// LoadingWaitView.xaml 的交互逻辑
/// </summary>
public partial class LoadingWaitView : UserControl
{
public LoadingWaitView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,93 @@
<UserControl x:Class="MainShell.Resources.CustomControl.MagazineMapControl"
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:MainShell.Resources.CustomControl"
mc:Ignorable="d"
d:DesignHeight="520" d:DesignWidth="280">
<Border Background="#07152F" BorderBrush="#2B3E63" BorderThickness="1" CornerRadius="4" Padding="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding MapViewModel.Title, RelativeSource={RelativeSource AncestorType={x:Type local:MagazineMapControl}}}" Foreground="#9FB7E8" FontWeight="Bold" FontStyle="Italic"/>
<TextBlock Grid.Column="1" Text="{Binding MapViewModel.TotalSlots, RelativeSource={RelativeSource AncestorType={x:Type local:MagazineMapControl}}, StringFormat={}{0} SLOTS}" Foreground="#00E5A1" FontWeight="Bold"/>
</Grid>
<Border Grid.Row="1" Margin="0,10,0,10" BorderBrush="#1B2C4F" BorderThickness="1" Padding="6">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding MapViewModel.Slots, RelativeSource={RelativeSource AncestorType={x:Type local:MagazineMapControl}}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Margin="0,1" Padding="6,3" CornerRadius="1" Background="#0D1C3D">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding SlotName}" Foreground="#86A8DA" FontWeight="SemiBold"/>
<TextBlock Grid.Column="1" Text="{Binding StatusText}" Foreground="#506C9A" FontWeight="Bold"/>
</Grid>
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="#0D1C3D"/>
<Style.Triggers>
<DataTrigger Binding="{Binding SlotStatus}" Value="Present">
<Setter Property="Background" Value="#00A77A"/>
</DataTrigger>
<DataTrigger Binding="{Binding SlotStatus}" Value="Processing">
<Setter Property="Background" Value="#F59E0B"/>
</DataTrigger>
<DataTrigger Binding="{Binding SlotStatus}" Value="Completed">
<Setter Property="Background" Value="#2563EB"/>
</DataTrigger>
<DataTrigger Binding="{Binding SlotStatus}" Value="Target">
<Setter Property="Background" Value="#F59E0B"/>
</DataTrigger>
<DataTrigger Binding="{Binding SlotStatus}" Value="Alarm">
<Setter Property="Background" Value="#E53935"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
<UniformGrid Grid.Row="2" Columns="2" Rows="3" Margin="0,2,0,0">
<StackPanel Orientation="Horizontal" Margin="0,2">
<Ellipse Width="10" Height="10" Fill="#00A77A" Margin="0,0,6,0"/>
<TextBlock Text="在位" Foreground="#C7D7F1"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<Ellipse Width="10" Height="10" Fill="#23385E" Margin="0,0,6,0"/>
<TextBlock Text="空层" Foreground="#C7D7F1"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<Ellipse Width="10" Height="10" Fill="#F59E0B" Margin="0,0,6,0"/>
<TextBlock Text="加工中" Foreground="#C7D7F1"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<Ellipse Width="10" Height="10" Fill="#2563EB" Margin="0,0,6,0"/>
<TextBlock Text="加工完成" Foreground="#C7D7F1"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<Ellipse Width="10" Height="10" Fill="#E53935" Margin="0,0,6,0"/>
<TextBlock Text="异常" Foreground="#C7D7F1"/>
</StackPanel>
</UniformGrid>
</Grid>
</Border>
</UserControl>

View File

@@ -0,0 +1,22 @@
using System.Windows;
using System.Windows.Controls;
namespace MainShell.Resources.CustomControl
{
public partial class MagazineMapControl : UserControl
{
public static readonly DependencyProperty MapViewModelProperty =
DependencyProperty.Register(nameof(MapViewModel), typeof(MagazineMapViewModel), typeof(MagazineMapControl), new PropertyMetadata(null));
public MagazineMapViewModel MapViewModel
{
get { return (MagazineMapViewModel)GetValue(MapViewModelProperty); }
set { SetValue(MapViewModelProperty, value); }
}
public MagazineMapControl()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,127 @@
using Stylet;
using System.Collections.ObjectModel;
namespace MainShell.Resources.CustomControl
{
public class MagazineMapViewModel : PropertyChangedBase
{
private string _title = "MAGAZINE MAP";
public string Title
{
get { return _title; }
set { SetAndNotify(ref _title, value); }
}
private int _totalSlots;
public int TotalSlots
{
get { return _totalSlots; }
set { SetAndNotify(ref _totalSlots, value); }
}
public ObservableCollection<MagazineSlotState> Slots { get; } = new ObservableCollection<MagazineSlotState>();
public static MagazineMapViewModel CreateDefault(int slotCount)
{
var vm = new MagazineMapViewModel { TotalSlots = slotCount };
for (var i = slotCount; i >= 1; i--)
{
var status = MagazineSlotStatus.Empty;
if (i <= 11 || i == 18)
{
status = MagazineSlotStatus.Present;
}
if (i == 10 || i == 9)
{
status = MagazineSlotStatus.Processing;
}
if (i == 8 || i == 7)
{
status = MagazineSlotStatus.Completed;
}
vm.Slots.Add(new MagazineSlotState
{
SlotName = $"L{i:D2}",
SlotStatus = status
});
}
return vm;
}
}
public enum MagazineSlotStatus
{
Empty,
Present,
Processing,
Completed,
Target,
Alarm
}
public class MagazineSlotState : PropertyChangedBase
{
private string _slotName;
public string SlotName
{
get { return _slotName; }
set { SetAndNotify(ref _slotName, value); }
}
private bool _isPresent;
public bool IsPresent
{
get { return _isPresent; }
set
{
if (SetAndNotify(ref _isPresent, value))
{
SlotStatus = value ? MagazineSlotStatus.Present : MagazineSlotStatus.Empty;
OnPropertyChanged(nameof(StatusText));
}
}
}
private MagazineSlotStatus _slotStatus = MagazineSlotStatus.Empty;
public MagazineSlotStatus SlotStatus
{
get { return _slotStatus; }
set
{
if (SetAndNotify(ref _slotStatus, value))
{
_isPresent = value == MagazineSlotStatus.Present;
OnPropertyChanged(nameof(IsPresent));
OnPropertyChanged(nameof(StatusText));
}
}
}
public string StatusText
{
get
{
switch (SlotStatus)
{
case MagazineSlotStatus.Present:
return "PRES";
case MagazineSlotStatus.Processing:
return "PROC";
case MagazineSlotStatus.Completed:
return "DONE";
case MagazineSlotStatus.Target:
return "PROC";
case MagazineSlotStatus.Alarm:
return "ALM";
default:
return "---";
}
}
}
}
}

View File

@@ -0,0 +1,311 @@
<UserControl x:Class="MainShell.Resources.CustomControl.PaginationControl"
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:MainShell.Resources.CustomControl"
xmlns:mw="http://www.maxwell-gp.com/"
mc:Ignorable="d"
>
<UserControl.Resources>
<SolidColorBrush x:Key="PaginationPanelBackgroundBrush" Color="#F7F8FB"/>
<SolidColorBrush x:Key="PaginationPanelBorderBrush" Color="#D7DEE8"/>
<SolidColorBrush x:Key="PaginationTextBrush" Color="#2F3A4C"/>
<SolidColorBrush x:Key="PaginationMutedTextBrush" Color="#90A0B5"/>
<SolidColorBrush x:Key="PaginationAccentBrush" Color="#3D7DFF"/>
<LinearGradientBrush x:Key="PaginationPrimaryButtonBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#4B668D" Offset="0"/>
<GradientStop Color="#2E4566" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="PaginationPrimaryButtonHoverBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#57749C" Offset="0"/>
<GradientStop Color="#344D71" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="PaginationPrimaryButtonPressedBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#2C4261" Offset="0"/>
<GradientStop Color="#21344F" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="PaginationButtonBackgroundBrush" Color="#F8FAFD"/>
<SolidColorBrush x:Key="PaginationButtonHoverBrush" Color="#EEF3FA"/>
<SolidColorBrush x:Key="PaginationComboBoxHoverBrush" Color="#F3F7FC"/>
<SolidColorBrush x:Key="PaginationComboBoxDropDownBrush" Color="#7C8DA5"/>
<SolidColorBrush x:Key="PaginationComboBoxPopupBorderBrush" Color="#CDD7E3"/>
<Style x:Key="PaginationTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource PaginationTextBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="PaginationButtonStyle" TargetType="Button">
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Margin" Value="1,0"/>
<Setter Property="Padding" Value="8,0"/>
<Setter Property="Foreground" Value="{StaticResource PaginationTextBrush}"/>
<Setter Property="Background" Value="{StaticResource PaginationButtonBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource PaginationPanelBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="ButtonBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="3">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource PaginationButtonHoverBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource PaginationPanelBorderBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="ButtonBorder" Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PaginationPrimaryButtonStyle" TargetType="Button" BasedOn="{StaticResource PaginationButtonStyle}">
<Setter Property="Width" Value="36"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{StaticResource PaginationPrimaryButtonBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource PaginationPrimaryButtonBrush}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource PaginationPrimaryButtonHoverBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource PaginationPrimaryButtonHoverBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource PaginationPrimaryButtonPressedBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource PaginationPrimaryButtonPressedBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="PaginationComboBoxToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="ToggleBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="22"/>
</Grid.ColumnDefinitions>
<ContentPresenter Grid.Column="0"
Margin="8,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Left"/>
<Border Grid.Column="1"
BorderBrush="{StaticResource PaginationPanelBorderBrush}"
BorderThickness="1,0,0,0"
Background="Transparent">
<Path x:Name="Arrow"
Width="8"
Height="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{StaticResource PaginationComboBoxDropDownBrush}"
Data="M 0 0 L 4 4 L 8 0 Z"/>
</Border>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ToggleBorder" Property="Background" Value="{StaticResource PaginationComboBoxHoverBrush}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="ToggleBorder" Property="Background" Value="{StaticResource PaginationComboBoxHoverBrush}"/>
<Setter TargetName="Arrow" Property="Fill" Value="{StaticResource PaginationAccentBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="ToggleBorder" Property="Opacity" Value="0.6"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PaginationComboBoxItemStyle" TargetType="ComboBoxItem">
<Setter Property="Foreground" Value="{StaticResource PaginationTextBrush}"/>
<Setter Property="Padding" Value="8,4"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="ItemBorder"
Background="Transparent"
CornerRadius="2">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"
Margin="2,0"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="{StaticResource PaginationButtonHoverBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="{StaticResource PaginationComboBoxHoverBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PaginationComboBoxStyle" TargetType="ComboBox">
<Setter Property="Height" Value="24"/>
<Setter Property="Width" Value="64"/>
<Setter Property="Margin" Value="4,0,0,0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Foreground" Value="{StaticResource PaginationTextBrush}"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{StaticResource PaginationPanelBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource PaginationComboBoxItemStyle}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton x:Name="ToggleButton"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Focusable="False"
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press"
Style="{StaticResource PaginationComboBoxToggleButtonStyle}">
<TextBlock Text="{Binding SelectionBoxItem, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}"
FontSize="12"
VerticalAlignment="Center"/>
</ToggleButton>
<Popup x:Name="Popup"
AllowsTransparency="True"
Focusable="False"
IsOpen="{TemplateBinding IsDropDownOpen}"
Placement="Bottom"
PopupAnimation="Slide">
<Border Margin="0,2,0,0"
MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}"
Background="White"
BorderBrush="{StaticResource PaginationComboBoxPopupBorderBrush}"
BorderThickness="1"
CornerRadius="3">
<ScrollViewer CanContentScroll="True"
MaxHeight="180"
Padding="2">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PaginationJumpBoxStyle" TargetType="mw:IntNumberBox">
<Setter Property="Width" Value="42"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Margin" Value="4,0,0,0"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{StaticResource PaginationPanelBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{StaticResource PaginationTextBrush}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</UserControl.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Disabled"
Style="{StaticResource ProcessScrollViewerStyle}"
Padding="0"
Background="Transparent">
<Border Background="{StaticResource PaginationPanelBackgroundBrush}"
BorderBrush="{StaticResource PaginationPanelBorderBrush}"
BorderThickness="1"
CornerRadius="2"
Padding="6,3"
MinWidth="470">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="12"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="14"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="每页:" Style="{StaticResource PaginationTextStyle}" FontSize="12"/>
<ComboBox Style="{StaticResource PaginationComboBoxStyle}"
ItemsSource="{Binding PageSizeOptions}"
SelectedItem="{Binding PageSize}"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
<Button Content="首页" Command="{Binding MoveFirstCommand}" Width="36" Style="{StaticResource PaginationButtonStyle}"/>
<Button Content="&lt;" Command="{Binding MoveBackCommand}" Style="{StaticResource PaginationButtonStyle}"/>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="10,0">
<TextBlock Text="{Binding CurrentPage}"
Foreground="{StaticResource PaginationAccentBrush}"
FontSize="17"
FontWeight="Normal"
VerticalAlignment="Center"/>
<TextBlock Text=" / "
Style="{StaticResource PaginationTextStyle}"
FontSize="15"
Margin="3,0"/>
<TextBlock Text="{Binding TotalPages}"
Style="{StaticResource PaginationTextStyle}"
FontSize="15"
FontWeight="Normal"/>
<TextBlock Text="{Binding TotalItems, StringFormat='(共{0}项)'}"
Foreground="{StaticResource PaginationMutedTextBrush}"
FontSize="10"
Margin="4,4,0,0"
VerticalAlignment="Center"/>
</StackPanel>
<Button Content=">" Command="{Binding MoveNextCommand}" Style="{StaticResource PaginationButtonStyle}"/>
<Button Content="尾页" Command="{Binding MoveLastCommand}" Width="36" Style="{StaticResource PaginationButtonStyle}"/>
</StackPanel>
<Border Grid.Column="4"
Width="1"
Height="16"
Background="{StaticResource PaginationPanelBorderBrush}"
VerticalAlignment="Center"/>
<StackPanel Grid.Column="6" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="跳转:" Style="{StaticResource PaginationTextStyle}" FontSize="12"/>
<mw:IntNumberBox Style="{StaticResource PaginationJumpBoxStyle}"
mw:NumericKeypadAttach.IsEnabled="True"
Value="{Binding JumpPage, UpdateSourceTrigger=PropertyChanged}"/>
<Button Content="Go" Command="{Binding JumpToPageCommand}" Margin="6,0,0,0" Style="{StaticResource PaginationPrimaryButtonStyle}"/>
</StackPanel>
</Grid>
</Border>
</ScrollViewer>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MainShell.Resources.CustomControl
{
/// <summary>
/// PaginationControl.xaml 的交互逻辑
/// </summary>
public partial class PaginationControl : UserControl
{
public PaginationControl()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,102 @@
using MaxwellFramework.Core.Common.Command;
using MwFramework.Controls.Components;
using Stylet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using DelegateCommand = MwFramework.Controls.Components.DelegateCommand;
namespace MainShell.Resources.CustomControl
{
public class PaginationViewModel : PropertyChangedBase
{
private int _currentPage = 1;
private int _pageSize = 20;
private int _totalItems;
private int _jumpPage = 1; // 新增跳转页字段
public List<int> PageSizeOptions { get; } = new List<int> { 20, 50, 100, 200 };
public int CurrentPage
{
get => _currentPage;
set
{
int validated = Math.Max(1, Math.Min(value, TotalPages == 0 ? 1 : TotalPages));
if (SetAndNotify(ref _currentPage, validated))
{
JumpPage = validated; // 页面变更时同步更新跳转输入框数值
PageChanged?.Invoke(this, EventArgs.Empty);
// 关键:通知命令状态刷新
(MoveFirstCommand as DelegateCommand)?.RaiseCanExecuteChanged();
(MoveBackCommand as DelegateCommand)?.RaiseCanExecuteChanged();
(MoveNextCommand as DelegateCommand)?.RaiseCanExecuteChanged();
(MoveLastCommand as DelegateCommand)?.RaiseCanExecuteChanged();
}
}
}
// 新增跳转页属性
public int JumpPage
{
get => _jumpPage;
set
{
if (SetAndNotify(ref _jumpPage, value))
{
// 输入变化时刷新跳转按钮状态
(JumpToPageCommand as DelegateCommand)?.RaiseCanExecuteChanged();
}
}
}
public int PageSize
{
get => _pageSize;
set
{
if (SetAndNotify(ref _pageSize, value))
{
OnPropertyChanged(nameof(TotalPages));
CurrentPage = 1; // 内部会触发 PageChanged
PageChanged?.Invoke(this, EventArgs.Empty);
(JumpToPageCommand as DelegateCommand)?.RaiseCanExecuteChanged();
}
}
}
public int TotalItems
{
get => _totalItems;
set
{
if (SetAndNotify(ref _totalItems, value))
{
OnPropertyChanged(nameof(TotalPages));
// 刷新命令状态,防止数据更新后按钮不可用
(MoveNextCommand as DelegateCommand)?.RaiseCanExecuteChanged();
(MoveLastCommand as DelegateCommand)?.RaiseCanExecuteChanged();
(JumpToPageCommand as DelegateCommand)?.RaiseCanExecuteChanged();
}
}
}
public int TotalPages => (int)Math.Ceiling((double)_totalItems / Math.Max(1, _pageSize));
// 优化后的命令,增加了 CanExecute 判断
public ICommand MoveFirstCommand => new DelegateCommand(() => CurrentPage = 1, () => CurrentPage > 1);
public ICommand MoveBackCommand => new DelegateCommand(() => CurrentPage--, () => CurrentPage > 1);
public ICommand MoveNextCommand => new DelegateCommand(() => CurrentPage++, () => CurrentPage < TotalPages);
public ICommand MoveLastCommand => new DelegateCommand(() => CurrentPage = TotalPages, () => CurrentPage < TotalPages);
// 新增跳转命令
public ICommand JumpToPageCommand => new DelegateCommand(
() => CurrentPage = JumpPage,
() => JumpPage >= 1 && JumpPage <= TotalPages);
public event EventHandler PageChanged;
}
}

View File

@@ -0,0 +1,70 @@
<UserControl x:Class="MainShell.Resources.CustomControl.RegionEditorView"
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:MainShell.Resources.CustomControl"
xmlns:mw="http://www.maxwell-gp.com/"
x:Name="Root"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="550">
<GroupBox Header="{Binding Title, ElementName=Root}" BorderBrush="#DDD" Margin="5">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="起始" VerticalAlignment="Center" FontWeight="Bold" Foreground="#4A90E2"/>
</StackPanel>
<UniformGrid Grid.Row="0" Grid.Column="1" Columns="2">
<StackPanel Margin="2,0">
<TextBlock Text="行 (R)" FontSize="10" Foreground="Gray"/>
<mw:IntNumberBox mw:NumericKeypadAttach.IsEnabled="True" Value="{Binding StartRow, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
</StackPanel>
<StackPanel Margin="2,0">
<TextBlock Text="列 (C)" FontSize="10" Foreground="Gray"/>
<mw:IntNumberBox mw:NumericKeypadAttach.IsEnabled="True" Value="{Binding StartCol, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
</StackPanel>
</UniformGrid>
<TextBlock Grid.Row="0" Grid.Column="2" Text="至" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,5"/>
<StackPanel Grid.Row="0" Grid.Column="3" Orientation="Horizontal">
<TextBlock Text="结束" VerticalAlignment="Center" FontWeight="Bold" Foreground="#E24A4A"/>
</StackPanel>
<UniformGrid Grid.Row="0" Grid.Column="4" Columns="2">
<StackPanel Margin="2,0">
<TextBlock Text="行 (R)" FontSize="10" Foreground="Gray"/>
<mw:IntNumberBox mw:NumericKeypadAttach.IsEnabled="True" Value="{Binding EndRow, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
</StackPanel>
<StackPanel Margin="2,0">
<TextBlock Text="列 (C)" FontSize="10" Foreground="Gray"/>
<mw:IntNumberBox mw:NumericKeypadAttach.IsEnabled="True" Value="{Binding EndCol, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
</StackPanel>
</UniformGrid>
<Border Visibility="Collapsed" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5" Background="#F9F9F9" CornerRadius="4" Padding="8">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="当前选区规模:" Foreground="#666"/>
<TextBlock Text="{Binding RowCount}" FontWeight="Bold"/>
<TextBlock Text=" 行 × "/>
<TextBlock Text="{Binding ColCount}" FontWeight="Bold"/>
<TextBlock Text=" 列"/>
<TextBlock Text="{Binding TotalItems, StringFormat=' (共 {0} 点)'}" Margin="10,0,0,0" FontStyle="Italic"/>
</StackPanel>
</Border>
</Grid>
</GroupBox>
</UserControl>

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MainShell.Resources.CustomControl
{
/// <summary>
/// RegionEditorView.xaml 的交互逻辑
/// </summary>
public partial class RegionEditorView : UserControl
{
public RegionEditorView()
{
InitializeComponent();
}
public static readonly DependencyProperty TitleProperty =
DependencyProperty.Register("Title", typeof(string), typeof(RegionEditorView), new PropertyMetadata("区域坐标设置"));
public string Title
{
get { return (string)GetValue(TitleProperty); }
set { SetValue(TitleProperty, value); }
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,555 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 定义颜色,方便统一管理和修改 -->
<!-- 启动按钮色 (Primary Green) -->
<SolidColorBrush x:Key="PrimaryGreen" Color="#28A745"/>
<SolidColorBrush x:Key="PrimaryGreenHover" Color="#218838"/>
<SolidColorBrush x:Key="PrimaryGreenPressed" Color="#1E7E34"/>
<!-- 关闭按钮色 (Danger Red) -->
<SolidColorBrush x:Key="DangerRed" Color="#DC3545"/>
<SolidColorBrush x:Key="DangerRedHover" Color="#C82333"/>
<SolidColorBrush x:Key="DangerRedPressed" Color="#BD2130"/>
<!-- 复位按钮色 (Secondary Gray) -->
<SolidColorBrush x:Key="SecondaryGray" Color="#6C757D"/>
<SolidColorBrush x:Key="SecondaryGrayHover" Color="#5A6268"/>
<SolidColorBrush x:Key="SecondaryGrayPressed" Color="#4E555B"/>
<!-- 保存按钮色 (Primary Blue) -->
<SolidColorBrush x:Key="SaveBlue" Color="#007BFF"/>
<SolidColorBrush x:Key="SaveBlueHover" Color="#0069D9"/>
<SolidColorBrush x:Key="SaveBluePressed" Color="#0062CC"/>
<!-- 测试按钮色 (Info Blue/Cyan) -->
<SolidColorBrush x:Key="InfoBlue" Color="#17A2B8"/>
<SolidColorBrush x:Key="InfoBlueHover" Color="#138496"/>
<SolidColorBrush x:Key="InfoBluePressed" Color="#117A8B"/>
<!-- 设置按钮色 (Light Gray) -->
<SolidColorBrush x:Key="LightGray" Color="#F8F9FA"/>
<SolidColorBrush x:Key="LightGrayHover" Color="#E2E6EA"/>
<SolidColorBrush x:Key="LightGrayPressed" Color="#DAE0E5"/>
<SolidColorBrush x:Key="DarkText" Color="#343A40"/>
<!-- 设置按钮的文字颜色 -->
<!-- 禁用状态颜色 -->
<SolidColorBrush x:Key="DisabledBackground" Color="#E9ECEF"/>
<SolidColorBrush x:Key="DisabledForeground" Color="#6C757D"/>
<!-- 基础按钮样式 - 包含圆角模板和通用行为 -->
<Style x:Key="BaseRoundedButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="5,2"/>
<Setter Property="Margin" Value="10,5"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Width" Value="100"/>
<Setter Property="Height" Value="35"/>
<!-- 移除按钮聚焦时的虚线框 -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<!-- 圆角半径 -->
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<!-- 禁用状态效果 -->
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background" Value="{StaticResource DisabledBackground}"/>
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource DisabledBackground}"/>
<Setter Property="Foreground" Value="{StaticResource DisabledForeground}"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ClearStatsButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="#9CA3AF"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ContentPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="#DC2626"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Foreground" Value="#B91C1C"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 启动按钮样式 -->
<Style x:Key="StartButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource PrimaryGreen}"/>
<Setter Property="BorderBrush" Value="{StaticResource PrimaryGreen}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource PrimaryGreenHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource PrimaryGreenHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource PrimaryGreenPressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource PrimaryGreenPressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 复位按钮样式 -->
<Style x:Key="ResetButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource SecondaryGray}"/>
<Setter Property="BorderBrush" Value="{StaticResource SecondaryGray}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource SecondaryGrayHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource SecondaryGrayHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource SecondaryGrayPressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource SecondaryGrayPressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 关闭按钮样式 -->
<Style x:Key="CloseButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource DangerRed}"/>
<Setter Property="BorderBrush" Value="{StaticResource DangerRed}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource DangerRedHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource DangerRedHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource DangerRedPressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource DangerRedPressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 保存按钮样式 -->
<Style x:Key="SaveButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource SaveBlue}"/>
<Setter Property="BorderBrush" Value="{StaticResource SaveBlue}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource SaveBlueHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource SaveBlueHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource SaveBluePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource SaveBluePressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 测试按钮样式 -->
<Style x:Key="TestButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource InfoBlue}"/>
<Setter Property="BorderBrush" Value="{StaticResource InfoBlue}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource InfoBlueHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource InfoBlueHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource InfoBluePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource InfoBluePressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 设置按钮样式 -->
<Style x:Key="SettingsButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource LightGray}"/>
<Setter Property="BorderBrush" Value="{StaticResource LightGray}"/>
<Setter Property="Foreground" Value="{StaticResource DarkText}"/>
<!-- 浅色背景需要深色文字 -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource LightGrayHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource LightGrayHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource LightGrayPressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource LightGrayPressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 普通按钮样式 -->
<Style x:Key="Button" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Width" Value="110"/>
<Setter Property="Height" Value="30"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="iconButton" TargetType="Button">
<Setter Property="Padding" Value="10,5"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Width" Value="85"/>
<Setter Property="Height" Value="35"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Background" Value="#F7FBFF"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="10">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#DFE8F0"/>
<!-- 浅蓝色背景 -->
<Setter Property="BorderBrush" Value="#3A8DFF"/>
<!-- 蓝色边框 -->
<Setter Property="Cursor" Value="Hand"/>
<!-- 鼠标改为手指形状 -->
</Trigger>
<!-- 鼠标点击时的样式 -->
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#DCEBF9"/>
<!-- 深蓝色背景 -->
<Setter Property="BorderBrush" Value="#1A7CE0"/>
<!-- 深蓝色边框 -->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 停止按钮色 (Stop Red) -->
<SolidColorBrush x:Key="StopRed" Color="#B24B48"/>
<SolidColorBrush x:Key="StopRedHover" Color="#9F413F"/>
<SolidColorBrush x:Key="StopRedPressed" Color="#873635"/>
<!-- 停止按钮样式 -->
<Style x:Key="StopButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource StopRed}"/>
<Setter Property="BorderBrush" Value="{StaticResource StopRed}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource StopRedHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource StopRedHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource StopRedPressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource StopRedPressed}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{StaticResource DisabledBackground}"/>
<Setter Property="BorderBrush" Value="{StaticResource DisabledBackground}"/>
<Setter Property="Foreground" Value="{StaticResource DisabledForeground}"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 示教按钮色 (Teach Orange) -->
<SolidColorBrush x:Key="TeachOrange" Color="#FD7E14"/>
<SolidColorBrush x:Key="TeachOrangeHover" Color="#E36C09"/>
<SolidColorBrush x:Key="TeachOrangePressed" Color="#CA5D04"/>
<!-- 示教按钮样式 -->
<Style x:Key="TeachButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource TeachOrange}"/>
<Setter Property="BorderBrush" Value="{StaticResource TeachOrange}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource TeachOrangeHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource TeachOrangeHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource TeachOrangePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource TeachOrangePressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- ========================================== -->
<!-- 新增样式:模板制作 & 视觉参数设置 -->
<!-- ========================================== -->
<!-- 模板制作按钮色 (Template Purple) -->
<SolidColorBrush x:Key="TemplatePurple" Color="#6F42C1"/>
<SolidColorBrush x:Key="TemplatePurpleHover" Color="#59359A"/>
<SolidColorBrush x:Key="TemplatePurplePressed" Color="#4A2C81"/>
<!-- 模板制作按钮样式 -->
<Style x:Key="TemplateButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource TemplatePurple}"/>
<Setter Property="BorderBrush" Value="{StaticResource TemplatePurple}"/>
<!-- 可以在这里添加特定的图标或不同的大小设置,如果需要的话 -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource TemplatePurpleHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource TemplatePurpleHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource TemplatePurplePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource TemplatePurplePressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 视觉参数按钮色 (Vision Teal) -->
<SolidColorBrush x:Key="VisionTeal" Color="#20C997"/>
<SolidColorBrush x:Key="VisionTealHover" Color="#1BA87E"/>
<SolidColorBrush x:Key="VisionTealPressed" Color="#168C69"/>
<!-- 视觉参数按钮样式 -->
<Style x:Key="VisionButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource VisionTeal}"/>
<Setter Property="BorderBrush" Value="{StaticResource VisionTeal}"/>
<!-- 视觉参数设置可能不需要太宽,或者需要更显眼 -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource VisionTealHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource VisionTealHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource VisionTealPressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource VisionTealPressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- ========================================== -->
<!-- 新增样式:通用按钮 (Common/Primary) -->
<!-- ========================================== -->
<!-- 通用按钮色 (General Blue) -->
<SolidColorBrush x:Key="GeneralBlue" Color="#E8E8F0"/>
<SolidColorBrush x:Key="GeneralBlueHover" Color="#B3D2EA"/>
<SolidColorBrush x:Key="GeneralBluePressed" Color="#6A92B2"/>
<!-- 通用按钮样式 -->
<Style x:Key="CommonButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource GeneralBlue}"/>
<Setter Property="BorderBrush" Value="{StaticResource GeneralBlue}"/>
<Setter Property="Foreground" Value="#5F5F5F"/>
<Setter Property="BorderBrush" Value="#B0B9C4"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource GeneralBlueHover}"/>
<Setter Property="BorderBrush" Value="#1567D5"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource GeneralBluePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource GeneralBluePressed}"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
<SolidColorBrush x:Key="MarkActionBlue" Color="#2E5FA7"/>
<SolidColorBrush x:Key="MarkActionBlueHover" Color="#264F8A"/>
<SolidColorBrush x:Key="MarkActionBluePressed" Color="#1F4274"/>
<SolidColorBrush x:Key="MarkActionSlate" Color="#5C6F88"/>
<SolidColorBrush x:Key="MarkActionSlateHover" Color="#4D5E75"/>
<SolidColorBrush x:Key="MarkActionSlatePressed" Color="#404F63"/>
<SolidColorBrush x:Key="MarkActionOutlineBorder" Color="#D5DFEB"/>
<SolidColorBrush x:Key="MarkActionOutlineForeground" Color="#32507A"/>
<SolidColorBrush x:Key="MarkActionOutlineHover" Color="#EEF4FB"/>
<SolidColorBrush x:Key="MarkActionOutlinePressed" Color="#E0EBF8"/>
<SolidColorBrush x:Key="MarkDangerOutlineBorder" Color="#F0B8BE"/>
<SolidColorBrush x:Key="MarkDangerOutlineForeground" Color="#D95B69"/>
<SolidColorBrush x:Key="MarkDangerOutlineHover" Color="#FFF3F4"/>
<SolidColorBrush x:Key="MarkDangerOutlinePressed" Color="#FDE7E9"/>
<Style x:Key="MarkPrimaryActionButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Width" Value="105"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Padding" Value="16,0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Background" Value="{StaticResource MarkActionBlue}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionBlue}"/>
<Setter Property="Foreground" Value="White"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource MarkActionBlueHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionBlueHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource MarkActionBluePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionBluePressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="MarkNeutralActionButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Width" Value="105"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Padding" Value="16,0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Background" Value="{StaticResource MarkActionSlate}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionSlate}"/>
<Setter Property="Foreground" Value="White"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource MarkActionSlateHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionSlateHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource MarkActionSlatePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionSlatePressed}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="MarkOutlineActionButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Width" Value="105"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Padding" Value="16,0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionOutlineBorder}"/>
<Setter Property="Foreground" Value="{StaticResource MarkActionOutlineForeground}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource MarkActionOutlineHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionBlue}"/>
<Setter Property="Foreground" Value="{StaticResource MarkActionBlue}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource MarkActionOutlinePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkActionBlue}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="MarkDangerOutlineButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Width" Value="105"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Padding" Value="16,0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkDangerOutlineBorder}"/>
<Setter Property="Foreground" Value="{StaticResource MarkDangerOutlineForeground}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource MarkDangerOutlineHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkDangerOutlineForeground}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource MarkDangerOutlinePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkDangerOutlineForeground}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 物流页面按钮样式 -->
<Style x:Key="LogisticsActionButtonStyle" TargetType="Button" BasedOn="{StaticResource SaveButtonStyle}">
<Setter Property="Width" Value="220"/>
<Setter Property="Height" Value="40"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
<Style x:Key="LogisticsOutlineActionButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Width" Value="220"/>
<Setter Property="Height" Value="40"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#2455C7"/>
<Setter Property="BorderBrush" Value="#2455C7"/>
<Setter Property="BorderThickness" Value="2"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#EDF4FF"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#DCE9FF"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="LogisticsWarningActionButtonStyle" TargetType="Button" BasedOn="{StaticResource TeachButtonStyle}">
<Setter Property="Width" Value="220"/>
<Setter Property="Height" Value="40"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
<Style x:Key="LogisticsSecondaryButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Width" Value="220"/>
<Setter Property="Height" Value="36"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,8,0,0"/>
<Setter Property="Background" Value="#F7F2F2"/>
<Setter Property="Foreground" Value="#D04A4A"/>
<Setter Property="BorderBrush" Value="#E4CED1"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FDECEC"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#F8DFDF"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="LogisticsScanButtonStyle" TargetType="Button" BasedOn="{StaticResource CommonButtonStyle}">
<Setter Property="Width" Value="220"/>
<Setter Property="Height" Value="42"/>
<Setter Property="Margin" Value="0,8,0,6"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Background" Value="#1A2A47"/>
<Setter Property="BorderBrush" Value="#1A2A47"/>
<Setter Property="Foreground" Value="White"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#22375B"/>
<Setter Property="BorderBrush" Value="#22375B"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#172C4A"/>
<Setter Property="BorderBrush" Value="#172C4A"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,21 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<!-- NumberBox 数值限制 -->
<sys:Double x:Key="CarrierWidthMin">50</sys:Double>
<sys:Double x:Key="CarrierWidthMax">600</sys:Double>
<sys:Double x:Key="CarrierHeightMin">50</sys:Double>
<sys:Double x:Key="CarrierHeightMax">600</sys:Double>
<sys:Double x:Key="CarrierThicknessMin">0</sys:Double>
<sys:Double x:Key="CarrierThicknessMax">100</sys:Double>
<sys:Double x:Key="SubstrateWidthMin">20</sys:Double>
<sys:Double x:Key="SubstrateWidthMax">600</sys:Double>
<sys:Double x:Key="SubstrateHeightMin">20</sys:Double>
<sys:Double x:Key="SubstrateHeightMax">600</sys:Double>
<sys:String x:Key="SubstrateThicknessMin">0</sys:String>
<sys:String x:Key="SubstrateThicknessMax">50</sys:String>
<sys:String x:Key="WaferWidthMin">5</sys:String>
<sys:String x:Key="WaferWidthMax">300</sys:String>
<sys:String x:Key="WaferHeightMin">5</sys:String>
<sys:String x:Key="WaferHeightMax">300</sys:String>
</ResourceDictionary>

View File

@@ -0,0 +1,467 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mw="http://www.maxwell-gp.com/">
<SolidColorBrush x:Key="ProcessPageBackgroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ProcessCardBackgroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ProcessCardBorderBrush" Color="#D6DFEA"/>
<SolidColorBrush x:Key="ProcessHeaderAccentBrush" Color="#1F5EA8"/>
<SolidColorBrush x:Key="ProcessInnerZoneBackgroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ProcessTitleForegroundBrush" Color="#1F2D3D"/>
<SolidColorBrush x:Key="ProcessBodyForegroundBrush" Color="#334155"/>
<SolidColorBrush x:Key="ProcessHeaderBackgroundBrush" Color="#D9E0E7"/>
<SolidColorBrush x:Key="ProcessDividerBrush" Color="#EDF1F5"/>
<SolidColorBrush x:Key="ProcessSwitchOffBrush" Color="#D5DEE8"/>
<SolidColorBrush x:Key="ProcessSwitchThumbBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ProcessNormalBrush" Color="#2FA84F"/>
<SolidColorBrush x:Key="ProcessWarningBrush" Color="#F08A24"/>
<SolidColorBrush x:Key="ProcessDangerBrush" Color="#E24A4A"/>
<Style x:Key="ProcessPageContentGroupBoxStyle" TargetType="GroupBox" BasedOn="{StaticResource {x:Type GroupBox}}">
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{StaticResource ProcessTitleForegroundBrush}"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="16,18,16,16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="34"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="{StaticResource ProcessHeaderBackgroundBrush}" BorderBrush="{StaticResource ProcessCardBorderBrush}" BorderThickness="0,0,0,1" CornerRadius="3,3,0,0">
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="12,0" RecognizesAccessKey="True"/>
</Border>
<Border Grid.Row="1" Background="{StaticResource ProcessCardBackgroundBrush}" Padding="{TemplateBinding Padding}" CornerRadius="0,0,3,3">
<ContentPresenter/>
</Border>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ProcessCardGroupBoxStyle" TargetType="GroupBox" BasedOn="{StaticResource {x:Type GroupBox}}">
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{StaticResource ProcessTitleForegroundBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Margin" Value="0,0,0,18"/>
<Setter Property="Padding" Value="22,18,22,18"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="38"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="{StaticResource ProcessHeaderBackgroundBrush}" BorderBrush="{StaticResource ProcessCardBorderBrush}" BorderThickness="0,0,0,1" CornerRadius="3,3,0,0">
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="12,0" RecognizesAccessKey="True"/>
</Border>
<Border Grid.Row="1" Background="{StaticResource ProcessCardBackgroundBrush}" Padding="{TemplateBinding Padding}" CornerRadius="0,0,3,3">
<ContentPresenter/>
</Border>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ProcessWideCardGroupBoxStyle" TargetType="GroupBox" BasedOn="{StaticResource ProcessCardGroupBoxStyle}">
<Setter Property="Width" Value="Auto"/>
</Style>
<Style x:Key="ProcessNavigationListBoxStyle" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="Margin" Value="0,0,0,6"/>
<Setter Property="Padding" Value="5,4"/>
<Setter Property="Foreground" Value="{StaticResource ProcessTitleForegroundBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="ItemBorder" Background="#F5F7FA" BorderBrush="{StaticResource ProcessCardBorderBrush}" BorderThickness="1" CornerRadius="4" Padding="{TemplateBinding Padding}">
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="#EAF2FA"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="#DCEBF8"/>
<Setter TargetName="ItemBorder" Property="BorderBrush" Value="{StaticResource ProcessHeaderAccentBrush}"/>
<Setter Property="Foreground" Value="{StaticResource ProcessHeaderAccentBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ProcessCardStyle" TargetType="Border">
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0,0,18,14"/>
<Setter Property="Width" Value="470"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style x:Key="ProcessWideCardStyle" TargetType="Border" BasedOn="{StaticResource ProcessCardStyle}">
<Setter Property="Width" Value="820"/>
</Style>
<Style x:Key="ProcessSectionStyle" TargetType="Border">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="CornerRadius" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0,0,0,18"/>
</Style>
<Style x:Key="ProcessSectionHeaderContainerStyle" TargetType="Border">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="2,0,0,0"/>
<Setter Property="Margin" Value="2,0,0,10"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<Style x:Key="ProcessSectionHeaderTextStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource ProcessHeaderAccentBrush}"/>
</Style>
<Style x:Key="ProcessCardHeaderBarStyle" TargetType="Border">
<Setter Property="Background" Value="#EEF2F6"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="CornerRadius" Value="8,8,0,0"/>
<Setter Property="Padding" Value="16,10,12,10"/>
</Style>
<Style x:Key="ProcessCardHeaderTextStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource ProcessHeaderAccentBrush}"/>
</Style>
<Style x:Key="ProcessFunctionZoneStyle" TargetType="Border">
<Setter Property="Background" Value="{StaticResource ProcessInnerZoneBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="CornerRadius" Value="0,0,8,8"/>
<Setter Property="Padding" Value="16,14,16,14"/>
<Setter Property="Margin" Value="0"/>
</Style>
<Style x:Key="ProcessNormalZoneStyle" TargetType="Border" BasedOn="{StaticResource ProcessFunctionZoneStyle}">
</Style>
<Style x:Key="ProcessWarningZoneStyle" TargetType="Border" BasedOn="{StaticResource ProcessFunctionZoneStyle}">
</Style>
<Style x:Key="ProcessDangerZoneStyle" TargetType="Border" BasedOn="{StaticResource ProcessFunctionZoneStyle}">
</Style>
<Style x:Key="ProcessLabelStyle" TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
<Setter Property="Width" Value="120"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,0,10,0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
</Style>
<Style x:Key="ProcessToggleStyle" TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Height" Value="28"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="MinWidth" Value="138"/>
<Setter Property="Margin" Value="0,4,18,4"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Foreground" Value="{StaticResource ProcessTitleForegroundBrush}"/>
<Setter Property="Background" Value="{StaticResource ProcessSwitchOffBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessSwitchOffBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" TextWrapping="Wrap"/>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="54"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid x:Name="SwitchRoot" Grid.Column="0" Width="54" Height="22">
<Border x:Name="Track"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
CornerRadius="11"/>
<Ellipse x:Name="Thumb"
Fill="{StaticResource ProcessSwitchThumbBrush}"
Width="18"
Height="18"
HorizontalAlignment="Left"
Margin="2,0,0,0"/>
</Grid>
<ContentPresenter Grid.Column="1"
Margin="8,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Left"
RecognizesAccessKey="True"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Track" Property="Background" Value="{StaticResource ProcessNormalBrush}"/>
<Setter TargetName="Track" Property="BorderBrush" Value="{StaticResource ProcessNormalBrush}"/>
<Setter TargetName="Thumb" Property="Margin" Value="34,0,0,0"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="SwitchRoot" Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ProcessSmallToggleStyle" TargetType="ToggleButton" BasedOn="{StaticResource ProcessToggleStyle}">
<Setter Property="MinWidth" Value="120"/>
</Style>
<Style x:Key="ProcessParameterRowStyle" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="Margin" Value="0,0,0,10"/>
</Style>
<Style x:Key="ProcessComboBoxStyle" TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="Width" Value="190"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Margin" Value="8,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
</Style>
<Style x:Key="ProcessLargeComboBoxStyle" TargetType="ComboBox" BasedOn="{StaticResource ProcessComboBoxStyle}">
<Setter Property="Width" Value="120"/>
</Style>
<Style x:Key="ProcessNumberBoxStyle" TargetType="{x:Type mw:NumberBox}" BasedOn="{StaticResource {x:Type mw:NumberBox}}">
<Setter Property="Width" Value="110"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Margin" Value="8,4,0,2"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
</Style>
<Style x:Key="ProcessIntNumberBoxStyle" TargetType="{x:Type mw:IntNumberBox}" BasedOn="{StaticResource {x:Type mw:IntNumberBox}}">
<Setter Property="Width" Value="110"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Margin" Value="8,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
</Style>
<Style x:Key="ProcessLargeIntNumberBoxStyle" TargetType="{x:Type mw:IntNumberBox}" BasedOn="{StaticResource ProcessIntNumberBoxStyle}">
<Setter Property="Width" Value="120"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="ProcessLargeNumberBoxStyle" TargetType="{x:Type mw:NumberBox}" BasedOn="{StaticResource ProcessNumberBoxStyle}">
<Setter Property="Width" Value="120"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="ProcessTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Height" Value="32"/>
<Setter Property="MinWidth" Value="120"/>
<Setter Property="Margin" Value="8,0,0,0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="10,0"/>
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
</Style>
<Style x:Key="ProcessReadOnlyValueBorderStyle" TargetType="Border">
<Setter Property="Background" Value="#F8FAFC"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="Padding" Value="12,6"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="ProcessReadOnlyValueTextStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<Style x:Key="ProcessCameraHostBorderStyle" TargetType="Border">
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Margin" Value="4,4,8,4"/>
<Setter Property="Padding" Value="4"/>
</Style>
<Style x:Key="ProcessDataGridStyle" TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
<Setter Property="Margin" Value="0"/>
<Setter Property="AutoGenerateColumns" Value="False"/>
<Setter Property="CanUserAddRows" Value="False"/>
<Setter Property="CanUserDeleteRows" Value="False"/>
<Setter Property="CanUserResizeRows" Value="False"/>
<Setter Property="HeadersVisibility" Value="Column"/>
<Setter Property="GridLinesVisibility" Value="Horizontal"/>
<Setter Property="RowBackground" Value="#FFFFFF"/>
<Setter Property="AlternatingRowBackground" Value="#F8FAFC"/>
<Setter Property="HorizontalGridLinesBrush" Value="{StaticResource ProcessDividerBrush}"/>
<Setter Property="VerticalGridLinesBrush" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="RowHeaderWidth" Value="0"/>
<Setter Property="ColumnHeaderStyle">
<Setter.Value>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#EEF2F6"/>
<Setter Property="Foreground" Value="{StaticResource ProcessHeaderAccentBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Padding" Value="10,8"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
</Style>
</Setter.Value>
</Setter>
<Setter Property="CellStyle">
<Setter.Value>
<Style TargetType="DataGridCell">
<Setter Property="Padding" Value="10,8"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#DCEBF8"/>
<Setter Property="Foreground" Value="{StaticResource ProcessHeaderAccentBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ProcessTabControlStyle" TargetType="TabControl" BasedOn="{StaticResource {x:Type TabControl}}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabControl">
<Grid KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TabPanel Grid.Row="0" Panel.ZIndex="1" IsItemsHost="True" Margin="0,0,0,8"/>
<Border Grid.Row="1" Background="{StaticResource ProcessCardBackgroundBrush}" BorderBrush="{StaticResource ProcessCardBorderBrush}" BorderThickness="1" CornerRadius="6" Padding="8">
<ContentPresenter ContentSource="SelectedContent"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="TabItem">
<Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border x:Name="TabBorder" Background="#F5F7FA" BorderBrush="{StaticResource ProcessCardBorderBrush}" BorderThickness="1" CornerRadius="6,6,0,0" Padding="16,8" Margin="0,0,6,0">
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="TabBorder" Property="Background" Value="#DCEBF8"/>
<Setter TargetName="TabBorder" Property="BorderBrush" Value="{StaticResource ProcessHeaderAccentBrush}"/>
<Setter Property="Foreground" Value="{StaticResource ProcessHeaderAccentBrush}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="TabBorder" Property="Background" Value="#EAF2FA"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ProcessUnitTextStyle" TargetType="TextBlock">
<Setter Property="Margin" Value="14,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="#9AA8BB"/>
</Style>
<Style x:Key="ProcessDividerStyle" TargetType="Border">
<Setter Property="Height" Value="1"/>
<Setter Property="Background" Value="{StaticResource ProcessDividerBrush}"/>
<Setter Property="Margin" Value="0,8,0,18"/>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,827 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:cv="clr-namespace:MainShell.Converter"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:commonDisp="clr-namespace:MainShell.Common.Display.View" xmlns:commonViewModel="clr-namespace:MainShell.Common.Display.ViewModel" xmlns:controlAttr="clr-namespace:MainShell.Common.ControlAttribute">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Styles/ButtonStyles.xaml"/>
<ResourceDictionary Source="/Resources/Styles/NumberLimit.xaml"/>
<ResourceDictionary Source="/Resources/Styles/ProcessParameterStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<FontFamily x:Key="ttfFont">/MainShell;component/Resources/Font/#iconfont</FontFamily>
<!-- 全局转换器 -->
<cv:DateTimeToStringConverter x:Key="DateTimeToStringConverter"/>
<cv:BoolToVisibleConverter x:Key="BoolToVisibleConverter"/>
<cv:BoolToInversionConverter x:Key="boolToInversionConverter"/>
<cv:EnumDescriptionConverter x:Key="EnumDescriptionConverter"/>
<cv:ScreenToViewModelConverter x:Key="ScreenToViewModelConverter"/>
<cv:BondingPathModeToBoolConverter x:Key="BondingPathModeToBoolConverter"/>
<cv:BondingRegionModeToBoolConverter x:Key="BondingRegionModeToBoolConverter"/>
<cv:BondingWsPathModeToBoolConverter x:Key="BondingWsPathModeToBoolConverter"/>
<cv:RunningModeEnumToBoolConverter x:Key="RunningModeToBoolConverter"/>
<cv:SubstrateHeightMeasureModeToBoolConverter x:Key="SubstrateHeightMeasureModeToBoolConverter"/>
<cv:ObjectToBoolConverter x:Key="ObjectToBoolConverter"/>
<SolidColorBrush x:Key="GlobalScrollBarTrackBackgroundBrush" Color="#F6F8FB"/>
<SolidColorBrush x:Key="GlobalScrollBarTrackBorderBrush" Color="#D7DEE8"/>
<SolidColorBrush x:Key="GlobalScrollBarButtonHoverBrush" Color="#F1F5FA"/>
<SolidColorBrush x:Key="GlobalScrollBarButtonPressedBrush" Color="#E5ECF5"/>
<SolidColorBrush x:Key="GlobalScrollBarArrowBrush" Color="#9FB0C4"/>
<SolidColorBrush x:Key="GlobalScrollBarThumbBrush" Color="#D5E1EE"/>
<SolidColorBrush x:Key="GlobalScrollBarThumbHoverBrush" Color="#C7D6E6"/>
<SolidColorBrush x:Key="GlobalScrollBarThumbPressedBrush" Color="#B8CBDF"/>
<Style x:Key="GlobalScrollBarThumbStyle" TargetType="Thumb">
<Setter Property="Background" Value="{StaticResource GlobalScrollBarThumbBrush}"/>
<Setter Property="MinHeight" Value="24"/>
<Setter Property="MinWidth" Value="24"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Border x:Name="ThumbBorder"
Margin="3,2"
Background="{TemplateBinding Background}"
BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
BorderThickness="1"
CornerRadius="3"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ThumbBorder" Property="Background" Value="{StaticResource GlobalScrollBarThumbHoverBrush}"/>
</Trigger>
<Trigger Property="IsDragging" Value="True">
<Setter TargetName="ThumbBorder" Property="Background" Value="{StaticResource GlobalScrollBarThumbPressedBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="GlobalScrollBarPageButtonStyle" TargetType="RepeatButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="GlobalScrollBarLineButtonStyle" TargetType="RepeatButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border x:Name="ButtonBorder"
Background="{TemplateBinding Background}"
BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
BorderThickness="1"
CornerRadius="2">
<Viewbox Width="6" Height="6" Stretch="Uniform">
<Path x:Name="ArrowPath"
Fill="{StaticResource GlobalScrollBarArrowBrush}"
Data="M 0 5 L 4 1 L 8 5 Z"/>
</Viewbox>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Tag" Value="Down">
<Setter TargetName="ArrowPath" Property="Data" Value="M 0 1 L 4 5 L 8 1 Z"/>
</Trigger>
<Trigger Property="Tag" Value="Left">
<Setter TargetName="ArrowPath" Property="Data" Value="M 5 0 L 1 4 L 5 8 Z"/>
</Trigger>
<Trigger Property="Tag" Value="Right">
<Setter TargetName="ArrowPath" Property="Data" Value="M 1 0 L 5 4 L 1 8 Z"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource GlobalScrollBarButtonHoverBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource GlobalScrollBarButtonPressedBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="GlobalVerticalScrollBarTemplate" TargetType="ScrollBar">
<Grid Background="Transparent" SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition Height="14"/>
<RowDefinition Height="*"/>
<RowDefinition Height="14"/>
</Grid.RowDefinitions>
<RepeatButton Grid.Row="0"
Command="ScrollBar.LineUpCommand"
Tag="Up"
Style="{StaticResource GlobalScrollBarLineButtonStyle}"/>
<Border Grid.Row="1"
Margin="2,0"
Background="{StaticResource GlobalScrollBarTrackBackgroundBrush}"
BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
BorderThickness="1"
CornerRadius="3"/>
<Track x:Name="PART_Track"
Grid.Row="1"
Margin="2,0"
Focusable="False"
IsDirectionReversed="True">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageUpCommand"
Style="{StaticResource GlobalScrollBarPageButtonStyle}"/>
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource GlobalScrollBarThumbStyle}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageDownCommand"
Style="{StaticResource GlobalScrollBarPageButtonStyle}"/>
</Track.IncreaseRepeatButton>
</Track>
<RepeatButton Grid.Row="2"
Command="ScrollBar.LineDownCommand"
Tag="Down"
Style="{StaticResource GlobalScrollBarLineButtonStyle}"/>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="GlobalHorizontalScrollBarTemplate" TargetType="ScrollBar">
<Grid Background="Transparent" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="14"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="14"/>
</Grid.ColumnDefinitions>
<RepeatButton Grid.Column="0"
Command="ScrollBar.LineLeftCommand"
Tag="Left"
Style="{StaticResource GlobalScrollBarLineButtonStyle}"/>
<Border Grid.Column="1"
Margin="0,2"
Background="{StaticResource GlobalScrollBarTrackBackgroundBrush}"
BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
BorderThickness="1"
CornerRadius="3"/>
<Track x:Name="PART_Track"
Grid.Column="1"
Margin="0,2"
Focusable="False"
IsDirectionReversed="False">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageLeftCommand"
Style="{StaticResource GlobalScrollBarPageButtonStyle}"/>
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource GlobalScrollBarThumbStyle}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageRightCommand"
Style="{StaticResource GlobalScrollBarPageButtonStyle}"/>
</Track.IncreaseRepeatButton>
</Track>
<RepeatButton Grid.Column="2"
Command="ScrollBar.LineRightCommand"
Tag="Right"
Style="{StaticResource GlobalScrollBarLineButtonStyle}"/>
</Grid>
</ControlTemplate>
<Style x:Key="GlobalScrollBarStyle" TargetType="ScrollBar">
<Setter Property="Width" Value="14"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template" Value="{StaticResource GlobalVerticalScrollBarTemplate}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="14"/>
<Setter Property="Template" Value="{StaticResource GlobalHorizontalScrollBarTemplate}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="ScrollBar" BasedOn="{StaticResource GlobalScrollBarStyle}"/>
<Style x:Key="ProcessScrollViewerStyle" TargetType="ScrollViewer" BasedOn="{StaticResource BaseStyle}">
<Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="controlAttr:ControlBehavior.RouteDieMapMouseWheel" Value="True"/>
<!-- 现代化样式:保持 ScrollViewer 标准行为,融合全局滚动条配色 -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollViewer">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6"
SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
Grid.Row="0" Grid.Column="0"
Margin="{TemplateBinding Padding}"
CanContentScroll="{TemplateBinding CanContentScroll}"/>
<ScrollBar x:Name="PART_VerticalScrollBar"
Grid.Row="0" Grid.Column="1"
AutomationProperties.AutomationId="VerticalScrollBar"
Cursor="Arrow"
Orientation="Vertical"
Maximum="{TemplateBinding ScrollableHeight}"
Minimum="0"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
ViewportSize="{TemplateBinding ViewportHeight}"/>
<ScrollBar x:Name="PART_HorizontalScrollBar"
Grid.Row="1" Grid.Column="0"
AutomationProperties.AutomationId="HorizontalScrollBar"
Cursor="Arrow"
Orientation="Horizontal"
Maximum="{TemplateBinding ScrollableWidth}"
Minimum="0"
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
ViewportSize="{TemplateBinding ViewportWidth}"/>
<Border x:Name="ScrollBarCorner"
Grid.Row="1"
Grid.Column="1"
Background="{StaticResource GlobalScrollBarTrackBackgroundBrush}"
BorderBrush="{StaticResource GlobalScrollBarTrackBorderBrush}"
BorderThickness="1,1,0,0"
CornerRadius="0,0,6,0"
Visibility="Collapsed"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="ComputedVerticalScrollBarVisibility" Value="Visible"/>
<Condition Property="ComputedHorizontalScrollBarVisibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter TargetName="ScrollBarCorner" Property="Visibility" Value="Visible"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 全局数据模板 -->
<DataTemplate DataType="{x:Type commonViewModel:CameraAxisViewModel}">
<commonDisp:CameraAxisView/>
</DataTemplate>
<!--画刷-->
<SolidColorBrush x:Key="PgBackground" Color="#EEEEED"/>
<SolidColorBrush x:Key="PgBorder" Color="#EEEEED"/>
<SolidColorBrush x:Key="MwGroupBoxBackground" Color="#38ABF1"/>
<!-- 基础文本样式 -->
<Style x:Key="CommonLableStyle" TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
<Setter Property="HorizontalContentAlignment" Value="Right"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="Height" Value="35"/>
<Setter Property="Width" Value="120"/>
</Style>
<Style x:Key="LabelStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Margin" Value="0,4,10,4"/>
<Setter Property="Foreground" Value="#333333"/>
</Style>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,4,10,4"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
<Style x:Key="ValueStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Margin" Value="0,4,0,4"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Foreground" Value="#111111"/>
</Style>
<Style x:Key="LargeTextblockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,4,0,4"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Foreground" Value="#111111"/>
</Style>
<Style x:Key="LargeBlodTextblockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,4,0,4"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Foreground" Value="#111111"/>
</Style>
<!-- GroupBox Header 样式 -->
<Style x:Key="LeftGroupStyle" TargetType="GroupBox">
<Setter Property="Margin" Value="0,0,0,15"/>
<Setter Property="BorderBrush" Value="#CCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" FontWeight="Bold" FontSize="14" Foreground="#005792"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- GroupBox 分步骤样式 -->
<Style x:Key="GroupStepControl" TargetType="GroupBox">
<Setter Property="BorderBrush" Value="#37DFE8"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="2,4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border SnapsToDevicePixels="True" BorderThickness="0">
<ContentPresenter ContentSource="Header"/>
</Border>
<Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Margin="{TemplateBinding Margin}"
SnapsToDevicePixels="True"
>
<ContentPresenter ContentSource="Content"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="Segoe UI" FontWeight="Black"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<!--导航栏ListBox-->
<Style TargetType="ListBox" x:Key="NavigationListBoxStyle">
<Setter Property="Background" Value="#D7DDE4"/>
<Setter Property="Height" Value="40"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<!-- 4.1 重写ListBoxItem的控件模板完全自定义其外观 -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="ItemBorder"
Background="#EEEEF3" BorderBrush="#B0B9C4" BorderThickness="1"
Padding="8,8">
<ContentPresenter/>
</Border>
<!-- 4.2 定义触发器,响应鼠标和选中状态 -->
<ControlTemplate.Triggers>
<!-- 鼠标悬停时的效果 -->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="Wheat"/>
</Trigger>
<!-- 项目被选中时的效果 -->
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="#4B96D1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBoxItem" x:Key="padListBoxItemStyle">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="Transparent"
BorderThickness="1"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ControlTemplate.Triggers>
<!-- 选中状态的触发器 -->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background" Value="#448EC9"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<!-- 鼠标悬停状态的触发器 -->
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="#2E76CD"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBox" x:Key="recipeListBoxStyle">
<Setter Property="Background" Value="#F0F3F6"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem" >
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Background" Value="#F0F3F6"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Opacity" Value="0.4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border
Background="{TemplateBinding Background}"
SnapsToDevicePixels="True" MinHeight="40" >
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" FontSize="18" Foreground="#3DB39E" Text="&#xe666;" FontFamily="{StaticResource ttfFont}"/>
<TextBlock VerticalAlignment="Center" FontWeight="Bold" FontSize="16" Text="&#xe65e;" FontFamily="{StaticResource ttfFont}" Visibility="{Binding IsInUse, Converter={StaticResource BoolToVisibleConverter}}"/>
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<TextBlock VerticalAlignment="Center" FontWeight="Bold" FontSize="16" Text="&#xe65e;" FontFamily="{StaticResource ttfFont}" Visibility="{Binding IsInUse, Converter={StaticResource BoolToVisibleConverter}}"/>
<TextBlock VerticalAlignment="Center" Visibility="{Binding HasError, Converter={StaticResource BoolToVisibleConverter}}"
Margin="2,0" FontSize="16" Foreground="Red" Text="&#xe6c2;"
FontFamily="{StaticResource ttfFont}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<!-- 选中项和悬停项 -->
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#448EC9"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Opacity" Value="1"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsSelected" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="#B5C3CD"/>
<Setter Property="Foreground" Value="White"/>
</MultiTrigger>
<DataTrigger Binding="{Binding SelectedIndex,
RelativeSource={RelativeSource AncestorType=ListBox}}" Value="-1">
<Setter Property="Opacity" Value="1"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsInUse}" Value="True">
<Setter Property="Foreground" Value="Blue"/>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding RecipeName}" FontWeight="SemiBold" VerticalAlignment="Center" FontSize="16" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToggleBtnSideBarStyle" TargetType="ToggleButton">
<Setter Property="Width" Value="30"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Background" Value="#2196F3"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Opacity" Value="0.15"/>
<Setter Property="ToolTip" Value="隐藏配方列表"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}"
CornerRadius="5">
<TextBlock x:Name="txt"
Text="&#xe7af;"
FontSize="26"
FontFamily="{StaticResource ttfFont}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1976D2"/>
<Setter Property="Opacity" Value="0.9"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="#1565C0"/>
<Setter TargetName="txt" Property="Text" Value="&#xe7b0;"/>
<Setter Property="ToolTip" Value="显示配方列表"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ModernCheckBoxStyle" TargetType="CheckBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#C2C1C2"/>
<Setter Property="FontSize" Value="26"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Border>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="tx" Text="&#xe617;" FontFamily="{StaticResource ttfFont}"/>
<ContentPresenter Content="{TemplateBinding Content}"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="tx" Property="Text" Value="&#xe616;"/>
<Setter Property="Foreground" Value="#A84AF1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TitleBarButtonStyle" TargetType="Button">
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="root" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="root" Property="Background" Value="#11000000"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="root" Property="Background" Value="#22000000"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TitleBarCloseButtonStyle" TargetType="Button" BasedOn="{StaticResource TitleBarButtonStyle}">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Content" Value="&#xe60c;"/>
<Setter Property="FontFamily" Value="{StaticResource ttfFont}"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="ToolTip" Value="关闭"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="root" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="root" Property="Background" Value="#11000000"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="root" Property="Background" Value="#22000000"/>
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TitleBarMinButtonStyle" TargetType="Button" BasedOn="{StaticResource TitleBarButtonStyle}">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Content" Value="&#xe650;"/>
<Setter Property="FontFamily" Value="{StaticResource ttfFont}"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="ToolTip" Value="最小化"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="root" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="root" Property="Background" Value="#11000000"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="root" Property="Background" Value="#22000000"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MwGroupBoxStyle" TargetType="GroupBox">
<Setter Property="Background" Value="{StaticResource MwGroupBoxBackground}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border CornerRadius="4" SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" ContentSource="Header"/>
</Border>
<Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<ContentPresenter ContentSource="Content"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="Segoe UI" FontWeight="Black" Foreground="White" Margin="10,4"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="AxisMoveBg" Color="#4A90A4"/>
<SolidColorBrush x:Key="AxisMoveHover" Color="#3F7E8B"/>
<SolidColorBrush x:Key="AxisMovePressed" Color="#33666F"/>
<!-- 轴移动按钮样式 -->
<Style x:Key="AxisMoveButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
<Setter Property="Background" Value="{StaticResource AxisMoveBg}"/>
<Setter Property="BorderBrush" Value="{StaticResource AxisMoveBg}"/>
<Setter Property="Foreground" Value="White"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource AxisMoveHover}"/>
<Setter Property="BorderBrush" Value="{StaticResource AxisMoveHover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource AxisMovePressed}"/>
<Setter Property="BorderBrush" Value="{StaticResource AxisMovePressed}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{StaticResource DisabledBackground}"/>
<Setter Property="BorderBrush" Value="{StaticResource DisabledBackground}"/>
<Setter Property="Foreground" Value="{StaticResource DisabledForeground}"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- DataGrid错误提示样式 -->
<Style x:Key="DataGridRowErrorStyle" TargetType="{x:Type DataGridRow}">
<Setter Property="ValidationErrorTemplate">
<Setter.Value>
<ControlTemplate>
<DockPanel>
<!-- 在行左侧显示一个红色感叹号 -->
<TextBlock Foreground="Red" FontWeight="Bold"
Text="!" DockPanel.Dock="Bottom" Margin="5,0,0,0"/>
<!-- 占位符,显示原始的行 -->
<AdornedElementPlaceholder />
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
<!-- 当行有错误时,设置工具提示 -->
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="ToolTip"
Value="{Binding RelativeSource={RelativeSource Self},
Path=(Validation.Errors)[0].ErrorContent}" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="ModernSwitchStyle" TargetType="{x:Type CheckBox}">
<Setter Property="Foreground" Value="#CBD5E1"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<StackPanel Orientation="Horizontal">
<Grid x:Name="SwitchRoot" Width="50" Height="20">
<Border x:Name="Track"
Background="#D7DDE4"
CornerRadius="10"
BorderThickness="0"/>
<Ellipse x:Name="Thumb"
Fill="White"
Width="16"
Height="16"
HorizontalAlignment="Left"
Margin="2,0,0,0">
<Ellipse.RenderTransform>
<TranslateTransform X="0"/>
</Ellipse.RenderTransform>
</Ellipse>
</Grid>
<ContentPresenter Margin="8,0,0,0" VerticalAlignment="Center"/>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Thumb"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
To="30" Duration="0:0:0.2"/>
<ColorAnimation Storyboard.TargetName="Track"
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
To="#10B981" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Thumb"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
To="0" Duration="0:0:0.2"/>
<ColorAnimation Storyboard.TargetName="Track"
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
To="#CBD5E1" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="SwitchRoot" Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,401 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:cv="clr-namespace:MainShell.Converter"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Styles/ButtonStyles.xaml"/>
<ResourceDictionary Source="/Resources/Styles/NumberLimit.xaml"/>
</ResourceDictionary.MergedDictionaries>
<FontFamily x:Key="ttfFont">/MainShell;component/Resources/Font/#iconfont</FontFamily>
<!-- 全局转换器 -->
<cv:DateTimeToStringConverter x:Key="DateTimeToStringConverter"/>
<cv:BoolToVisibleConverter x:Key="BoolToVisibleConverter"/>
<cv:BoolToInversionConverter x:Key="boolToInversionConverter"/>
<cv:AxisIndexToNameConverter x:Key="AxisNameConverter"/>
<cv:EnumDescriptionConverter x:Key="EnumDescriptionConverter"/>
<!--画刷-->
<SolidColorBrush x:Key="PgBackground" Color="#EEEEED"/>
<SolidColorBrush x:Key="PgBorder" Color="#EEEEED"/>
<SolidColorBrush x:Key="MwGroupBoxBackground" Color="#38ABF1"/>
<!-- 基础文本样式 -->
<Style x:Key="CommonLableStyle" TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
<Setter Property="HorizontalContentAlignment" Value="Right"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="Height" Value="35"/>
<Setter Property="Width" Value="120"/>
</Style>
<Style x:Key="LabelStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Margin" Value="0,4,10,4"/>
<Setter Property="Foreground" Value="#333333"/>
</Style>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,4,10,4"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
<Style x:Key="ValueStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Margin" Value="0,4,0,4"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Foreground" Value="#111111"/>
</Style>
<!-- GroupBox Header 样式 -->
<Style x:Key="LeftGroupStyle" TargetType="GroupBox">
<Setter Property="Margin" Value="0,0,0,15"/>
<Setter Property="BorderBrush" Value="#CCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" FontWeight="Bold" FontSize="14" Foreground="#005792"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- GroupBox 分步骤样式 -->
<Style x:Key="GroupStepControl" TargetType="GroupBox">
<Setter Property="BorderBrush" Value="#37DFE8"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="2,4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border SnapsToDevicePixels="True" BorderThickness="0">
<ContentPresenter ContentSource="Header"/>
</Border>
<Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Margin="{TemplateBinding Margin}"
SnapsToDevicePixels="True"
>
<ContentPresenter ContentSource="Content"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="Segoe UI" FontWeight="Black"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBoxItem" x:Key="padListBoxItemStyle">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="Transparent"
BorderThickness="1"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ControlTemplate.Triggers>
<!-- 选中状态的触发器 -->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background" Value="#448EC9"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<!-- 鼠标悬停状态的触发器 -->
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="#2E76CD"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBox" x:Key="recipeListBoxStyle">
<Setter Property="Background" Value="#F0F3F6"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem" >
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Background" Value="#F0F3F6"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Opacity" Value="0.4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border
Background="{TemplateBinding Background}"
SnapsToDevicePixels="True" MinHeight="40" >
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" FontSize="18" Foreground="#3DB39E" Text="&#xe666;" FontFamily="{StaticResource ttfFont}"/>
<TextBlock VerticalAlignment="Center" FontWeight="Bold" FontSize="16" Text="&#xe65e;" FontFamily="{StaticResource ttfFont}" Visibility="{Binding IsInUse, Converter={StaticResource BoolToVisibleConverter}}"/>
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<TextBlock VerticalAlignment="Center" FontWeight="Bold" FontSize="16" Text="&#xe65e;" FontFamily="{StaticResource ttfFont}" Visibility="{Binding IsInUse, Converter={StaticResource BoolToVisibleConverter}}"/>
<TextBlock VerticalAlignment="Center" Visibility="{Binding HasError, Converter={StaticResource BoolToVisibleConverter}}"
Margin="2,0" FontSize="16" Foreground="Red" Text="&#xe6c2;"
FontFamily="{StaticResource ttfFont}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<!-- 选中项和悬停项 -->
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#448EC9"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Opacity" Value="1"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsSelected" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="#B5C3CD"/>
<Setter Property="Foreground" Value="White"/>
</MultiTrigger>
<DataTrigger Binding="{Binding SelectedIndex,
RelativeSource={RelativeSource AncestorType=ListBox}}" Value="-1">
<Setter Property="Opacity" Value="1"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsInUse}" Value="True">
<Setter Property="Foreground" Value="Blue"/>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding RecipeName}" FontWeight="SemiBold" VerticalAlignment="Center" FontSize="16" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToggleBtnSideBarStyle" TargetType="ToggleButton">
<Setter Property="Width" Value="30"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Background" Value="#2196F3"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Opacity" Value="0.15"/>
<Setter Property="ToolTip" Value="隐藏配方列表"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}"
CornerRadius="5">
<TextBlock x:Name="txt"
Text="&#xe7af;"
FontSize="26"
FontFamily="{StaticResource ttfFont}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1976D2"/>
<Setter Property="Opacity" Value="0.9"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="#1565C0"/>
<Setter TargetName="txt" Property="Text" Value="&#xe7b0;"/>
<Setter Property="ToolTip" Value="显示配方列表"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ModernCheckBoxStyle" TargetType="CheckBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#C2C1C2"/>
<Setter Property="FontSize" Value="26"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Border>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="tx" Text="&#xe617;" FontFamily="{StaticResource ttfFont}"/>
<ContentPresenter Content="{TemplateBinding Content}"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="tx" Property="Text" Value="&#xe616;"/>
<Setter Property="Foreground" Value="#A84AF1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TitleBarButtonStyle" TargetType="Button">
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="root" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="root" Property="Background" Value="#11000000"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="root" Property="Background" Value="#22000000"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TitleBarCloseButtonStyle" TargetType="Button" BasedOn="{StaticResource TitleBarButtonStyle}">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Content" Value="&#xe60c;"/>
<Setter Property="FontFamily" Value="{StaticResource ttfFont}"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="ToolTip" Value="关闭"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="root" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="root" Property="Background" Value="#11000000"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="root" Property="Background" Value="#22000000"/>
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TitleBarMinButtonStyle" TargetType="Button" BasedOn="{StaticResource TitleBarButtonStyle}">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Content" Value="&#xe650;"/>
<Setter Property="FontFamily" Value="{StaticResource ttfFont}"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="ToolTip" Value="最小化"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="root" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="root" Property="Background" Value="#11000000"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="root" Property="Background" Value="#22000000"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<<<<<<< HEAD
<Style x:Key="MwGroupBoxStyle" TargetType="GroupBox">
<Setter Property="Background" Value="{StaticResource MwGroupBoxBackground}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border CornerRadius="4" SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" ContentSource="Header"/>
</Border>
<Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<ContentPresenter ContentSource="Content"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="Segoe UI" FontWeight="Black" Foreground="White" Margin="10,4"/>
</DataTemplate>
</Setter.Value>
</Setter>
=======
<!-- DataGrid错误提示样式 -->
<Style x:Key="DataGridRowErrorStyle" TargetType="{x:Type DataGridRow}">
<Setter Property="ValidationErrorTemplate">
<Setter.Value>
<ControlTemplate>
<DockPanel>
<!-- 在行左侧显示一个红色感叹号 -->
<TextBlock Foreground="Red" FontWeight="Bold"
Text="!" DockPanel.Dock="Bottom" Margin="5,0,0,0"/>
<!-- 占位符,显示原始的行 -->
<AdornedElementPlaceholder />
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
<!-- 当行有错误时,设置工具提示 -->
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="ToolTip"
Value="{Binding RelativeSource={RelativeSource Self},
Path=(Validation.Errors)[0].ErrorContent}" />
</Trigger>
</Style.Triggers>
>>>>>>> 81155a53cff1759bc7c4285135affedd29f2b9d6
</Style>
</ResourceDictionary>