初始化 monorepo: Go后端(7微服务) + Unity客户端(9模块) + 启动器 HTML5原型: Three.js 3D体素世界, Perlin噪声地形, 原版材质, 22种方块 Minecraft创造模式背包: 双栏布局, 拖拽移动物品, 方向性元件引脚 AI助搭策划文档 + 客户端/服务端骨架 + Docker Compose + CI
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<Grid x:Class="PCL.MyMsgInput"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:my="clr-namespace:PCL"
|
||||
RenderTransformOrigin="0,0.5" UseLayoutRounding="True" SnapsToDevicePixels="True" MinWidth="400"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="25">
|
||||
<Grid.RenderTransform>
|
||||
<TransformGroup>
|
||||
<RotateTransform x:Name="TransformRotate" Angle="-4" />
|
||||
<TranslateTransform x:Name="TransformPos" X="0" Y="40" />
|
||||
</TransformGroup>
|
||||
</Grid.RenderTransform>
|
||||
<Border Name="PanBorder" CornerRadius="7" Background="{DynamicResource ColorBrushBackground}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="{DynamicResource ColorObjectMsgBoxShadow}" BlurRadius="20" ShadowDepth="2"
|
||||
RenderingBias="Performance" Opacity="0.8" x:Name="EffectShadow" />
|
||||
</Border.Effect>
|
||||
<Grid Name="PanMain" VerticalAlignment="Top" Margin="22,22,22,23">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="2" />
|
||||
<RowDefinition Height="13" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" FontSize="23" TextTrimming="None" Foreground="{DynamicResource ColorBrush2}"
|
||||
HorizontalAlignment="Left" Name="LabTitle" Margin="7,-1,70,9" Text="测试标题文本"
|
||||
VerticalAlignment="Top" SnapsToDevicePixels="False" UseLayoutRounding="False" />
|
||||
<Rectangle x:Name="ShapeLine" Grid.Row="1" Height="2" Fill="{Binding Foreground, ElementName=LabTitle}" />
|
||||
<my:MyScrollViewer Grid.Row="3" VerticalAlignment="Top" x:Name="PanText" Margin="0,0,0,7"
|
||||
Padding="7,0,15,0"
|
||||
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
|
||||
DeltaMult="0.7">
|
||||
<TextBlock VerticalAlignment="Top" TextTrimming="None" TextWrapping="Wrap" Name="LabText" FontSize="15"
|
||||
LineHeight="18"
|
||||
Foreground="{DynamicResource ColorBrush1}" FontWeight="Normal" Padding="1" />
|
||||
</my:MyScrollViewer>
|
||||
<my:MyTextBox Grid.Row="4" Margin="7,0,7,12" x:Name="TextArea" UseLayoutRounding="False" MaxLength="1000"
|
||||
MinWidth="450" />
|
||||
<StackPanel Grid.Row="5" Name="PanBtn" VerticalAlignment="Top" HorizontalAlignment="Right"
|
||||
Margin="150,0,8,0" Orientation="Horizontal">
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮1" x:Name="Btn1" Margin="12,0,0,0"
|
||||
TextPadding="7" SnapsToDevicePixels="False" Padding="5,0" UseLayoutRounding="False"
|
||||
Click="Btn1_Click" />
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮2" x:Name="Btn2" Margin="12,0,0,0"
|
||||
TextPadding="7" SnapsToDevicePixels="False" Padding="5,0" UseLayoutRounding="False"
|
||||
Click="Btn2_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -0,0 +1,174 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using PCL.Core.UI.Controls;
|
||||
|
||||
using PCL.Core.App.Localization;
|
||||
namespace PCL;
|
||||
|
||||
public partial class MyMsgInput
|
||||
{
|
||||
private readonly ModMain.MyMsgBoxConverter myConverter;
|
||||
private readonly int uuid = ModBase.GetUuid();
|
||||
|
||||
public MyMsgInput(ModMain.MyMsgBoxConverter converter)
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
AppendUniqueNameSuffix(Btn1);
|
||||
AppendUniqueNameSuffix(Btn2);
|
||||
myConverter = converter;
|
||||
LabTitle.Text = converter.Title;
|
||||
LabText.Text = converter.Text;
|
||||
PanText.Visibility = string.IsNullOrEmpty(converter.Text) ? Visibility.Collapsed : Visibility.Visible;
|
||||
TextArea.Text = (string)converter.Content;
|
||||
TextArea.HintText = converter.HintText;
|
||||
TextArea.ValidateRules = converter.ValidateRules;
|
||||
ConfigurePrimaryButton(converter.Button1, converter.IsWarn);
|
||||
ConfigureSecondaryButton(converter.Button2);
|
||||
ShapeLine.StrokeThickness = ModBase.GetWPFSize(1d);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"输入弹窗初始化失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
|
||||
Loaded += Load;
|
||||
}
|
||||
|
||||
private void AppendUniqueNameSuffix(FrameworkElement element)
|
||||
{
|
||||
element.Name += ModBase.GetUuid();
|
||||
}
|
||||
|
||||
private void ConfigurePrimaryButton(string text, bool isWarn)
|
||||
{
|
||||
Btn1.Text = text;
|
||||
if (isWarn)
|
||||
{
|
||||
Btn1.ColorType = MyButton.ColorState.Red;
|
||||
LabTitle.SetResourceReference(TextBlock.ForegroundProperty, "ColorBrushRedLight");
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureSecondaryButton(string text)
|
||||
{
|
||||
Btn2.Text = text;
|
||||
Btn2.Visibility = string.IsNullOrEmpty(text) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
private void Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// UI 初始化
|
||||
if (Btn2.IsVisible && !(Btn1.ColorType == MyButton.ColorState.Red))
|
||||
Btn1.ColorType = MyButton.ColorState.Highlight;
|
||||
TextArea.Focus();
|
||||
TextArea.SelectionStart = TextArea.Text.Length;
|
||||
// 动画
|
||||
Opacity = 0d;
|
||||
ModAnimation.AniStart(
|
||||
ModAnimation.AaColor(ModMain.frmMain.PanMsgBackground, BlurBorder.BackgroundProperty,
|
||||
(myConverter.IsWarn
|
||||
? new ModBase.MyColor(140d, 80d, 0d, 0d)
|
||||
: new ModBase.MyColor(90d, 0d, 0d, 0d)) - ModMain.frmMain.PanMsgBackground.Background, 200),
|
||||
"PanMsgBackground Background");
|
||||
ModAnimation.AniStart(
|
||||
new[]
|
||||
{
|
||||
ModAnimation.AaOpacity(this, 1d, 120, 60),
|
||||
ModAnimation.AaDouble(i => TransformPos.Y += (double)i,
|
||||
-TransformPos.Y, 300, 60, new ModAnimation.AniEaseOutBack(ModAnimation.AniEasePower.Weak)),
|
||||
ModAnimation.AaDouble(i => TransformRotate.Angle += (double)i,
|
||||
-TransformRotate.Angle, 300, 60,
|
||||
new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak))
|
||||
}, "MyMsgBox " + uuid);
|
||||
// 记录日志
|
||||
ModBase.Log("[Control] 输入弹窗:" + LabTitle.Text);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"输入弹窗加载失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
}
|
||||
|
||||
private void Close()
|
||||
{
|
||||
// 结束线程阻塞
|
||||
myConverter.WaitFrame.Continue = false;
|
||||
ComponentDispatcher.PopModal();
|
||||
// 动画
|
||||
ModAnimation.AniStart(new[]
|
||||
{
|
||||
ModAnimation.AaCode(() =>
|
||||
{
|
||||
if (!ModMain.WaitingMyMsgBox.Any())
|
||||
ModAnimation.AniStart(ModAnimation.AaColor(ModMain.frmMain.PanMsgBackground,
|
||||
BlurBorder.BackgroundProperty,
|
||||
new ModBase.MyColor(0d, 0d, 0d, 0d) - ModMain.frmMain.PanMsgBackground.Background, 200,
|
||||
ease: new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak)));
|
||||
}, 30),
|
||||
ModAnimation.AaOpacity(this, -Opacity, 80, 20),
|
||||
ModAnimation.AaDouble(i => TransformPos.Y += (double)i, 20d - TransformPos.Y,
|
||||
150, 0, new ModAnimation.AniEaseOutFluent()),
|
||||
ModAnimation.AaDouble(i => TransformRotate.Angle += (double)i,
|
||||
6d - TransformRotate.Angle, 150, 0, new ModAnimation.AniEaseInFluent(ModAnimation.AniEasePower.Weak)),
|
||||
ModAnimation.AaCode(() => ((Grid)Parent).Children.Remove(this), after: true)
|
||||
}, "MyMsgBox " + uuid);
|
||||
}
|
||||
|
||||
public void Btn1_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TextArea.Validate(); // #5773
|
||||
if (myConverter.IsExited || !TextArea.IsValidated)
|
||||
return;
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = TextArea.Text;
|
||||
Close();
|
||||
}
|
||||
|
||||
public void Btn2_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (myConverter.IsExited)
|
||||
return;
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = null;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void TextCaption_ValidateChanged(object sender, EventArgs e)
|
||||
{
|
||||
Btn1.IsEnabled = TextArea.IsValidated;
|
||||
}
|
||||
|
||||
private void Drag(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
if (e.GetPosition(ShapeLine).Y <= 2d)
|
||||
ModMain.frmMain.DragMove();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"拖拽移动失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<Grid x:Class="PCL.MyMsgMarkdown"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:my="clr-namespace:PCL"
|
||||
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
|
||||
RenderTransformOrigin="0,0.5" UseLayoutRounding="True" SnapsToDevicePixels="True" MinWidth="400"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="25">
|
||||
<Grid.RenderTransform>
|
||||
<TransformGroup>
|
||||
<RotateTransform x:Name="TransformRotate" Angle="-4" />
|
||||
<TranslateTransform x:Name="TransformPos" X="0" Y="40" />
|
||||
</TransformGroup>
|
||||
</Grid.RenderTransform>
|
||||
<Border Name="PanBorder" CornerRadius="7" Background="{DynamicResource ColorBrushBackground}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="{DynamicResource ColorObjectMsgBoxShadow}" BlurRadius="20" ShadowDepth="2"
|
||||
RenderingBias="Performance" Opacity="0.8" x:Name="EffectShadow" />
|
||||
</Border.Effect>
|
||||
<Grid Name="PanMain" VerticalAlignment="Top" Margin="22,22,22,23">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="2" />
|
||||
<RowDefinition Height="13" />
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" FontSize="23" TextTrimming="None" Foreground="{DynamicResource ColorBrush2}"
|
||||
HorizontalAlignment="Left" Name="LabTitle" Margin="7,-1,70,9" Text="测试标题文本"
|
||||
VerticalAlignment="Top" SnapsToDevicePixels="False" UseLayoutRounding="False" />
|
||||
<Rectangle x:Name="ShapeLine" Grid.Row="1" Height="2" Fill="{Binding Foreground, ElementName=LabTitle}" />
|
||||
<my:MyScrollViewer Grid.Row="3" VerticalAlignment="Top" x:Name="PanCaption" Margin="0,0,0,17"
|
||||
Padding="0,0,7,0"
|
||||
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
|
||||
DeltaMult="0.7">
|
||||
<markdig:MarkdownViewer VerticalAlignment="Top" Name="LabCaption"
|
||||
Foreground="{DynamicResource ColorBrush1}" FontWeight="Normal" />
|
||||
</my:MyScrollViewer>
|
||||
<StackPanel Grid.Row="4" Name="PanBtn" VerticalAlignment="Top" HorizontalAlignment="Right"
|
||||
Margin="150,0,8,0" Orientation="Horizontal">
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮1" x:Name="Btn1" Margin="12,0,0,0"
|
||||
Click="Btn1_Click" TextPadding="7" SnapsToDevicePixels="False" Padding="5,0"
|
||||
UseLayoutRounding="False" />
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮2" x:Name="Btn2" Margin="12,0,0,0"
|
||||
Click="Btn2_Click" TextPadding="7" SnapsToDevicePixels="False" Padding="5,0"
|
||||
UseLayoutRounding="False" />
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮3" x:Name="Btn3" Margin="12,0,0,0"
|
||||
Click="Btn3_Click" TextPadding="7" SnapsToDevicePixels="False" Padding="5,0"
|
||||
UseLayoutRounding="False" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -0,0 +1,197 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using PCL.Core.UI.Controls;
|
||||
|
||||
using PCL.Core.App.Localization;
|
||||
namespace PCL;
|
||||
|
||||
public partial class MyMsgMarkdown
|
||||
{
|
||||
private readonly ModMain.MyMsgBoxConverter myConverter;
|
||||
private readonly int uuid = ModBase.GetUuid();
|
||||
|
||||
public MyMsgMarkdown(ModMain.MyMsgBoxConverter converter)
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
AppendUniqueNameSuffix(Btn1);
|
||||
AppendUniqueNameSuffix(Btn2);
|
||||
AppendUniqueNameSuffix(Btn3);
|
||||
myConverter = converter;
|
||||
LabTitle.Text = converter.Title;
|
||||
LabCaption.Markdown = converter.Text;
|
||||
DataContext = this;
|
||||
ConfigurePrimaryButton(converter.Button1, converter.IsWarn);
|
||||
ConfigureSecondaryButton(Btn2, converter.Button2);
|
||||
ConfigureSecondaryButton(Btn3, converter.Button3);
|
||||
ShapeLine.StrokeThickness = ModBase.GetWPFSize(1d);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"普通弹窗初始化失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
|
||||
Loaded += Load;
|
||||
}
|
||||
|
||||
private void AppendUniqueNameSuffix(FrameworkElement element)
|
||||
{
|
||||
element.Name += ModBase.GetUuid();
|
||||
}
|
||||
|
||||
private void ConfigurePrimaryButton(string text, bool isWarn)
|
||||
{
|
||||
Btn1.Text = text;
|
||||
if (isWarn)
|
||||
{
|
||||
Btn1.ColorType = MyButton.ColorState.Red;
|
||||
LabTitle.SetResourceReference(TextBlock.ForegroundProperty, "ColorBrushRedLight");
|
||||
}
|
||||
}
|
||||
|
||||
private static void ConfigureSecondaryButton(MyButton button, string text)
|
||||
{
|
||||
button.Text = text;
|
||||
button.Visibility = string.IsNullOrEmpty(text) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
private void Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// UI 初始化
|
||||
if (Btn2.IsVisible && !(Btn1.ColorType == MyButton.ColorState.Red))
|
||||
Btn1.ColorType = MyButton.ColorState.Highlight;
|
||||
Btn1.Focus();
|
||||
// 动画
|
||||
Opacity = 0d;
|
||||
ModAnimation.AniStart(
|
||||
ModAnimation.AaColor(ModMain.frmMain.PanMsgBackground, BlurBorder.BackgroundProperty,
|
||||
(myConverter.IsWarn
|
||||
? new ModBase.MyColor(140d, 80d, 0d, 0d)
|
||||
: new ModBase.MyColor(90d, 0d, 0d, 0d)) - ModMain.frmMain.PanMsgBackground.Background, 200),
|
||||
"PanMsgBackground Background");
|
||||
ModAnimation.AniStart(
|
||||
new[]
|
||||
{
|
||||
ModAnimation.AaOpacity(this, 1d, 120, 60),
|
||||
ModAnimation.AaDouble(i => TransformPos.Y += (double)i,
|
||||
-TransformPos.Y, 300, 60, new ModAnimation.AniEaseOutBack(ModAnimation.AniEasePower.Weak)),
|
||||
ModAnimation.AaDouble(i => TransformRotate.Angle += (double)i,
|
||||
-TransformRotate.Angle, 300, 60,
|
||||
new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak))
|
||||
}, "MyMsgBox " + uuid);
|
||||
// 记录日志
|
||||
ModBase.Log("[Control] 普通弹窗:" + LabTitle.Text + "\r\n" + LabCaption.Markdown);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"普通弹窗加载失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
}
|
||||
|
||||
private void Close()
|
||||
{
|
||||
// 结束线程阻塞
|
||||
if (myConverter.ForceWait || !string.IsNullOrEmpty(myConverter.Button2))
|
||||
myConverter.WaitFrame.Continue = false;
|
||||
ComponentDispatcher.PopModal();
|
||||
// 动画
|
||||
ModAnimation.AniStart(new[]
|
||||
{
|
||||
ModAnimation.AaCode(() =>
|
||||
{
|
||||
if (!ModMain.WaitingMyMsgBox.Any())
|
||||
ModAnimation.AniStart(ModAnimation.AaColor(ModMain.frmMain.PanMsgBackground,
|
||||
BlurBorder.BackgroundProperty,
|
||||
new ModBase.MyColor(0d, 0d, 0d, 0d) - ModMain.frmMain.PanMsgBackground.Background, 200,
|
||||
ease: new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak)));
|
||||
}, 30),
|
||||
ModAnimation.AaOpacity(this, -Opacity, 80, 20),
|
||||
ModAnimation.AaDouble(i => TransformPos.Y += (double)i, 20d - TransformPos.Y,
|
||||
150, 0, new ModAnimation.AniEaseOutFluent()),
|
||||
ModAnimation.AaDouble(i => TransformRotate.Angle += (double)i,
|
||||
6d - TransformRotate.Angle, 150, 0, new ModAnimation.AniEaseInFluent(ModAnimation.AniEasePower.Weak)),
|
||||
ModAnimation.AaCode(() => ((Grid)Parent).Children.Remove(this), after: true)
|
||||
}, "MyMsgBox " + uuid);
|
||||
}
|
||||
|
||||
public void Btn1_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (myConverter.IsExited)
|
||||
return;
|
||||
if (myConverter.Button1Action is not null)
|
||||
{
|
||||
myConverter.Button1Action();
|
||||
}
|
||||
else
|
||||
{
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = 1;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Btn2_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (myConverter.IsExited)
|
||||
return;
|
||||
if (myConverter.Button2Action is not null)
|
||||
{
|
||||
myConverter.Button2Action();
|
||||
}
|
||||
else
|
||||
{
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = 2;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Btn3_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (myConverter.IsExited)
|
||||
return;
|
||||
if (myConverter.Button3Action is not null)
|
||||
{
|
||||
myConverter.Button3Action();
|
||||
}
|
||||
else
|
||||
{
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = 3;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void Drag(object? sender = null, MouseButtonEventArgs? e = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
if (e.GetPosition(ShapeLine).Y <= 2d)
|
||||
ModMain.frmMain.DragMove();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"拖拽移动失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<Grid x:Class="PCL.MyMsgSelect"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:my="clr-namespace:PCL"
|
||||
RenderTransformOrigin="0,0.5" UseLayoutRounding="True" SnapsToDevicePixels="True" MinWidth="400"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="25">
|
||||
<Grid.RenderTransform>
|
||||
<TransformGroup>
|
||||
<RotateTransform x:Name="TransformRotate" Angle="-4" />
|
||||
<TranslateTransform x:Name="TransformPos" X="0" Y="40" />
|
||||
</TransformGroup>
|
||||
</Grid.RenderTransform>
|
||||
<Border Name="PanBorder" CornerRadius="7" Background="{DynamicResource ColorBrushBackground}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="{DynamicResource ColorObjectMsgBoxShadow}" BlurRadius="20" ShadowDepth="2"
|
||||
RenderingBias="Performance" Opacity="0.8" x:Name="EffectShadow" />
|
||||
</Border.Effect>
|
||||
<Grid Name="PanMain" VerticalAlignment="Top" Margin="22,22,22,23">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="2" />
|
||||
<RowDefinition Height="13" />
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" FontSize="23" TextTrimming="None" Foreground="{DynamicResource ColorBrush2}"
|
||||
HorizontalAlignment="Left" Name="LabTitle" Margin="7,-1,70,9" Text="测试标题文本"
|
||||
VerticalAlignment="Top" SnapsToDevicePixels="False" UseLayoutRounding="False" />
|
||||
<Rectangle x:Name="ShapeLine" Grid.Row="1" Height="2" Fill="{Binding Foreground, ElementName=LabTitle}" />
|
||||
<my:MyScrollViewer Grid.Row="3" VerticalAlignment="Top" x:Name="PanCaption" Margin="0,0,0,17"
|
||||
Padding="7,0,15,0"
|
||||
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
|
||||
DeltaMult="0.7">
|
||||
<StackPanel x:Name="PanSelection" Orientation="Vertical" />
|
||||
</my:MyScrollViewer>
|
||||
<StackPanel Grid.Row="4" Name="PanBtn" VerticalAlignment="Top" HorizontalAlignment="Right"
|
||||
Margin="150,0,8,0" Orientation="Horizontal">
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮1" x:Name="Btn1" Margin="12,0,0,0"
|
||||
TextPadding="7" SnapsToDevicePixels="False" Padding="5,0" UseLayoutRounding="False" />
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮2" x:Name="Btn2" Margin="12,0,0,0"
|
||||
TextPadding="7" SnapsToDevicePixels="False" Padding="5,0" UseLayoutRounding="False" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -0,0 +1,205 @@
|
||||
using System.Collections;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using PCL.Core.UI.Controls;
|
||||
|
||||
using PCL.Core.App.Localization;
|
||||
namespace PCL;
|
||||
|
||||
public partial class MyMsgSelect
|
||||
{
|
||||
private readonly ModMain.MyMsgBoxConverter myConverter;
|
||||
private readonly int uuid = ModBase.GetUuid();
|
||||
|
||||
private int selectedIndex = -1;
|
||||
|
||||
public MyMsgSelect(ModMain.MyMsgBoxConverter converter)
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
AppendUniqueNameSuffix(Btn1);
|
||||
AppendUniqueNameSuffix(Btn2);
|
||||
myConverter = converter;
|
||||
LabTitle.Text = converter.Title;
|
||||
ConfigurePrimaryButton(converter.Button1, converter.IsWarn);
|
||||
ConfigureSecondaryButton(converter.Button2);
|
||||
ShapeLine.StrokeThickness = ModBase.GetWPFSize(1d);
|
||||
InitializeSelectionList(converter.Content);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"选择弹窗初始化失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
|
||||
Loaded += Load;
|
||||
Btn1.Click += Btn1_Click;
|
||||
Btn2.Click += Btn2_Click;
|
||||
LabTitle.MouseLeftButtonDown += Drag;
|
||||
PanBorder.MouseLeftButtonDown += Drag;
|
||||
}
|
||||
|
||||
private void AppendUniqueNameSuffix(FrameworkElement element)
|
||||
{
|
||||
element.Name += ModBase.GetUuid();
|
||||
}
|
||||
|
||||
private void ConfigurePrimaryButton(string text, bool isWarn)
|
||||
{
|
||||
Btn1.Text = text;
|
||||
if (isWarn)
|
||||
{
|
||||
Btn1.ColorType = MyButton.ColorState.Red;
|
||||
LabTitle.SetResourceReference(TextBlock.ForegroundProperty, "ColorBrushRedLight");
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureSecondaryButton(string text)
|
||||
{
|
||||
Btn2.Text = text;
|
||||
Btn2.Visibility = string.IsNullOrEmpty(text) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
private void InitializeSelectionList(object content)
|
||||
{
|
||||
// 添加选择控件
|
||||
Btn1.IsEnabled = false;
|
||||
foreach (var rawContent in (IEnumerable)content)
|
||||
{
|
||||
// 1. Initialize and get the actual element
|
||||
// Note: We use a new variable because 'foreach' variables are read-only
|
||||
var selectionContent = MyVirtualizingElement.TryInit((FrameworkElement)rawContent);
|
||||
|
||||
// 2. Interface casting and event subscription
|
||||
if (selectionContent is IMyRadio selection)
|
||||
{
|
||||
PanSelection.Children.Add((UIElement)selection);
|
||||
selection.Check += (sender, e) => OnChecked((IMyRadio)sender, e);
|
||||
|
||||
// 3. Property configuration based on specific type
|
||||
if (selection is MyListItem listItem)
|
||||
{
|
||||
listItem.Type = MyListItem.CheckType.RadioBox;
|
||||
listItem.MinHeight = 24.0;
|
||||
}
|
||||
else if (selection is MyRadioBox radioBox)
|
||||
{
|
||||
radioBox.MinHeight = 24.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// UI 初始化
|
||||
if (Btn2.IsVisible && !(Btn1.ColorType == MyButton.ColorState.Red))
|
||||
Btn1.ColorType = MyButton.ColorState.Highlight;
|
||||
// 动画
|
||||
Opacity = 0d;
|
||||
ModAnimation.AniStart(
|
||||
ModAnimation.AaColor(ModMain.frmMain.PanMsgBackground, BlurBorder.BackgroundProperty,
|
||||
(myConverter.IsWarn
|
||||
? new ModBase.MyColor(140d, 80d, 0d, 0d)
|
||||
: new ModBase.MyColor(90d, 0d, 0d, 0d)) - ModMain.frmMain.PanMsgBackground.Background, 200),
|
||||
"PanMsgBackground Background");
|
||||
ModAnimation.AniStart(
|
||||
new[]
|
||||
{
|
||||
ModAnimation.AaOpacity(this, 1d, 120, 60),
|
||||
ModAnimation.AaDouble(i => TransformPos.Y += (double)i,
|
||||
-TransformPos.Y, 300, 60, new ModAnimation.AniEaseOutBack(ModAnimation.AniEasePower.Weak)),
|
||||
ModAnimation.AaDouble(i => TransformRotate.Angle += (double)i,
|
||||
-TransformRotate.Angle, 300, 60,
|
||||
new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak))
|
||||
}, "MyMsgBox " + uuid);
|
||||
// 记录日志
|
||||
ModBase.Log("[Control] 选择弹窗:" + LabTitle.Text);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"选择弹窗加载失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
}
|
||||
|
||||
private void Close()
|
||||
{
|
||||
// 结束线程阻塞
|
||||
myConverter.WaitFrame.Continue = false;
|
||||
ComponentDispatcher.PopModal();
|
||||
// 动画
|
||||
ModAnimation.AniStart(new[]
|
||||
{
|
||||
ModAnimation.AaCode(() =>
|
||||
{
|
||||
if (!ModMain.WaitingMyMsgBox.Any())
|
||||
ModAnimation.AniStart(ModAnimation.AaColor(ModMain.frmMain.PanMsgBackground,
|
||||
BlurBorder.BackgroundProperty,
|
||||
new ModBase.MyColor(0d, 0d, 0d, 0d) - ModMain.frmMain.PanMsgBackground.Background, 200,
|
||||
ease: new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak)));
|
||||
}, 30),
|
||||
ModAnimation.AaOpacity(this, -Opacity, 80, 20),
|
||||
ModAnimation.AaDouble(i => TransformPos.Y += (double)i, 20d - TransformPos.Y,
|
||||
150, 0, new ModAnimation.AniEaseOutFluent()),
|
||||
ModAnimation.AaDouble(i => TransformRotate.Angle += (double)i,
|
||||
6d - TransformRotate.Angle, 150, 0, new ModAnimation.AniEaseInFluent(ModAnimation.AniEasePower.Weak)),
|
||||
ModAnimation.AaCode(() => ((Grid)Parent).Children.Remove(this), after: true)
|
||||
}, "MyMsgBox " + uuid);
|
||||
}
|
||||
|
||||
public void Btn1_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (myConverter.IsExited || selectedIndex == -1)
|
||||
return;
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = selectedIndex;
|
||||
Close();
|
||||
}
|
||||
|
||||
public void Btn2_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (myConverter.IsExited)
|
||||
return;
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = null;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OnChecked(IMyRadio sender, EventArgs e)
|
||||
{
|
||||
Btn1.IsEnabled = true;
|
||||
selectedIndex = PanSelection.Children.IndexOf((UIElement)sender);
|
||||
}
|
||||
|
||||
private void Drag(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
if (e.GetPosition(ShapeLine).Y <= 2d)
|
||||
ModMain.frmMain.DragMove();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"拖拽移动失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<Grid x:Class="PCL.MyMsgText"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:my="clr-namespace:PCL"
|
||||
RenderTransformOrigin="0,0.5" UseLayoutRounding="True" SnapsToDevicePixels="True" MinWidth="400"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="25">
|
||||
<Grid.RenderTransform>
|
||||
<TransformGroup>
|
||||
<RotateTransform x:Name="TransformRotate" Angle="-4" />
|
||||
<TranslateTransform x:Name="TransformPos" X="0" Y="40" />
|
||||
</TransformGroup>
|
||||
</Grid.RenderTransform>
|
||||
<Border Name="PanBorder" CornerRadius="7" Background="{DynamicResource ColorBrushBackground}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="{DynamicResource ColorObjectMsgBoxShadow}" BlurRadius="20" ShadowDepth="2"
|
||||
RenderingBias="Performance" Opacity="0.8" x:Name="EffectShadow" />
|
||||
</Border.Effect>
|
||||
<Grid Name="PanMain" VerticalAlignment="Top" Margin="22,22,22,23">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="2" />
|
||||
<RowDefinition Height="13" />
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" FontSize="23" TextTrimming="None" Foreground="{DynamicResource ColorBrush2}"
|
||||
HorizontalAlignment="Left" Name="LabTitle" Margin="7,-1,70,9" Text="测试标题文本"
|
||||
VerticalAlignment="Top" SnapsToDevicePixels="False" UseLayoutRounding="False" />
|
||||
<Rectangle x:Name="ShapeLine" Grid.Row="1" Height="2" Fill="{Binding Foreground, ElementName=LabTitle}" />
|
||||
<my:MyScrollViewer Grid.Row="3" VerticalAlignment="Top" x:Name="PanCaption" Margin="0,0,0,17"
|
||||
Padding="7,0,15,0"
|
||||
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
|
||||
DeltaMult="0.7">
|
||||
<TextBlock VerticalAlignment="Top" TextTrimming="None" TextWrapping="Wrap" Name="LabCaption"
|
||||
FontSize="15" LineHeight="18"
|
||||
Foreground="{DynamicResource ColorBrush1}" FontWeight="Normal" Padding="1" />
|
||||
</my:MyScrollViewer>
|
||||
<StackPanel Grid.Row="4" Name="PanBtn" VerticalAlignment="Top" HorizontalAlignment="Right"
|
||||
Margin="150,0,8,0" Orientation="Horizontal">
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮1" Click="Btn1_Click" x:Name="Btn1"
|
||||
Margin="12,0,0,0"
|
||||
TextPadding="7" SnapsToDevicePixels="False" Padding="5,0" UseLayoutRounding="False" />
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮2" Click="Btn2_Click" x:Name="Btn2"
|
||||
Margin="12,0,0,0"
|
||||
TextPadding="7" SnapsToDevicePixels="False" Padding="5,0" UseLayoutRounding="False" />
|
||||
<my:MyButton ColorType="Normal" x:FieldModifier="public" Text="测试按钮3" Click="Btn3_Click" x:Name="Btn3"
|
||||
Margin="12,0,0,0"
|
||||
TextPadding="7" SnapsToDevicePixels="False" Padding="5,0" UseLayoutRounding="False" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -0,0 +1,196 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using PCL.Core.UI.Controls;
|
||||
|
||||
using PCL.Core.App.Localization;
|
||||
namespace PCL;
|
||||
|
||||
public partial class MyMsgText
|
||||
{
|
||||
private readonly ModMain.MyMsgBoxConverter myConverter;
|
||||
private readonly int uuid = ModBase.GetUuid();
|
||||
|
||||
public MyMsgText(ModMain.MyMsgBoxConverter converter)
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
AppendUniqueNameSuffix(Btn1);
|
||||
AppendUniqueNameSuffix(Btn2);
|
||||
AppendUniqueNameSuffix(Btn3);
|
||||
myConverter = converter;
|
||||
LabTitle.Text = converter.Title;
|
||||
LabCaption.Text = converter.Text;
|
||||
ConfigurePrimaryButton(converter.Button1, converter.IsWarn);
|
||||
ConfigureSecondaryButton(Btn2, converter.Button2);
|
||||
ConfigureSecondaryButton(Btn3, converter.Button3);
|
||||
ShapeLine.StrokeThickness = ModBase.GetWPFSize(1d);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"普通弹窗初始化失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
|
||||
Loaded += Load;
|
||||
}
|
||||
|
||||
private void AppendUniqueNameSuffix(FrameworkElement element)
|
||||
{
|
||||
element.Name += ModBase.GetUuid();
|
||||
}
|
||||
|
||||
private void ConfigurePrimaryButton(string text, bool isWarn)
|
||||
{
|
||||
Btn1.Text = text;
|
||||
if (isWarn)
|
||||
{
|
||||
Btn1.ColorType = MyButton.ColorState.Red;
|
||||
LabTitle.SetResourceReference(TextBlock.ForegroundProperty, "ColorBrushRedLight");
|
||||
}
|
||||
}
|
||||
|
||||
private static void ConfigureSecondaryButton(MyButton button, string text)
|
||||
{
|
||||
button.Text = text;
|
||||
button.Visibility = string.IsNullOrEmpty(text) ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
private void Load(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// UI 初始化
|
||||
if (Btn2.IsVisible && !(Btn1.ColorType == MyButton.ColorState.Red))
|
||||
Btn1.ColorType = MyButton.ColorState.Highlight;
|
||||
Btn1.Focus();
|
||||
// 动画
|
||||
Opacity = 0d;
|
||||
ModAnimation.AniStart(
|
||||
ModAnimation.AaColor(ModMain.frmMain.PanMsgBackground, BlurBorder.BackgroundProperty,
|
||||
(myConverter.IsWarn
|
||||
? new ModBase.MyColor(140d, 80d, 0d, 0d)
|
||||
: new ModBase.MyColor(90d, 0d, 0d, 0d)) - ModMain.frmMain.PanMsgBackground.Background, 200),
|
||||
"PanMsgBackground Background");
|
||||
ModAnimation.AniStart(
|
||||
new[]
|
||||
{
|
||||
ModAnimation.AaOpacity(this, 1d, 120, 60),
|
||||
ModAnimation.AaDouble(i => TransformPos.Y += (double)i,
|
||||
-TransformPos.Y, 300, 60, new ModAnimation.AniEaseOutBack(ModAnimation.AniEasePower.Weak)),
|
||||
ModAnimation.AaDouble(i => TransformRotate.Angle += (double)i,
|
||||
-TransformRotate.Angle, 300, 60,
|
||||
new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak))
|
||||
}, "MyMsgBox " + uuid);
|
||||
// 记录日志
|
||||
ModBase.Log("[Control] 普通弹窗:" + LabTitle.Text + "\r\n" + LabCaption.Text);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"普通弹窗加载失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
}
|
||||
|
||||
private void Close()
|
||||
{
|
||||
// 结束线程阻塞
|
||||
if (myConverter.ForceWait || !string.IsNullOrEmpty(myConverter.Button2))
|
||||
myConverter.WaitFrame.Continue = false;
|
||||
ComponentDispatcher.PopModal();
|
||||
// 动画
|
||||
ModAnimation.AniStart(new[]
|
||||
{
|
||||
ModAnimation.AaCode(() =>
|
||||
{
|
||||
if (!ModMain.WaitingMyMsgBox.Any())
|
||||
ModAnimation.AniStart(ModAnimation.AaColor(ModMain.frmMain.PanMsgBackground,
|
||||
BlurBorder.BackgroundProperty,
|
||||
new ModBase.MyColor(0d, 0d, 0d, 0d) - ModMain.frmMain.PanMsgBackground.Background, 200,
|
||||
ease: new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak)));
|
||||
}, 30),
|
||||
ModAnimation.AaOpacity(this, -Opacity, 80, 20),
|
||||
ModAnimation.AaDouble(i => TransformPos.Y += (double)i, 20d - TransformPos.Y,
|
||||
150, 0, new ModAnimation.AniEaseOutFluent()),
|
||||
ModAnimation.AaDouble(i => TransformRotate.Angle += (double)i,
|
||||
6d - TransformRotate.Angle, 150, 0, new ModAnimation.AniEaseInFluent(ModAnimation.AniEasePower.Weak)),
|
||||
ModAnimation.AaCode(() => ((Grid)Parent).Children.Remove(this), after: true)
|
||||
}, "MyMsgBox " + uuid);
|
||||
}
|
||||
|
||||
public void Btn1_Click(object? sender = null, MouseButtonEventArgs? e = null)
|
||||
{
|
||||
if (myConverter.IsExited)
|
||||
return;
|
||||
if (myConverter.Button1Action is not null)
|
||||
{
|
||||
myConverter.Button1Action();
|
||||
}
|
||||
else
|
||||
{
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = 1;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Btn2_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (myConverter.IsExited)
|
||||
return;
|
||||
if (myConverter.Button2Action is not null)
|
||||
{
|
||||
myConverter.Button2Action();
|
||||
}
|
||||
else
|
||||
{
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = 2;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Btn3_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (myConverter.IsExited)
|
||||
return;
|
||||
if (myConverter.Button3Action is not null)
|
||||
{
|
||||
myConverter.Button3Action();
|
||||
}
|
||||
else
|
||||
{
|
||||
myConverter.IsExited = true;
|
||||
myConverter.Result = 3;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void Drag(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
if (e.GetPosition(ShapeLine).Y <= 2d)
|
||||
ModMain.frmMain.DragMove();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModBase.Log(
|
||||
ex,
|
||||
"拖拽移动失败",
|
||||
ModBase.LogLevel.Hint,
|
||||
userSummary: Lang.Text("Application.Control.MessageBox.Error.OperationFailed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user