代码清理
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Ink_Canvas
|
||||
InitializeComponent();
|
||||
mainWindow = owner;
|
||||
IsSuccess = false;
|
||||
|
||||
|
||||
// 添加TextBox内容变化事件以检查是否可以保存
|
||||
IconNameTextBox.TextChanged += (s, e) => ValidateSaveButton();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
selectedFilePath = openFileDialog.FileName;
|
||||
IconPathTextBox.Text = selectedFilePath;
|
||||
|
||||
|
||||
// 显示预览
|
||||
try
|
||||
{
|
||||
@@ -51,15 +51,15 @@ namespace Ink_Canvas
|
||||
{
|
||||
MessageBox.Show($"无法加载图像: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
|
||||
// 自动填充名称建议(文件名,不包括扩展名)
|
||||
string suggestedName = Path.GetFileNameWithoutExtension(selectedFilePath);
|
||||
IconNameTextBox.Text = suggestedName;
|
||||
|
||||
|
||||
ValidateSaveButton();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ValidateSaveButton()
|
||||
{
|
||||
SaveButton.IsEnabled = !string.IsNullOrWhiteSpace(IconNameTextBox.Text) && !string.IsNullOrEmpty(selectedFilePath);
|
||||
@@ -77,37 +77,37 @@ namespace Ink_Canvas
|
||||
// 创建pictures/icons文件夹结构(如果不存在)
|
||||
string picturesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "pictures");
|
||||
string iconsFolder = Path.Combine(picturesFolder, "icons");
|
||||
|
||||
|
||||
if (!Directory.Exists(picturesFolder))
|
||||
{
|
||||
Directory.CreateDirectory(picturesFolder);
|
||||
}
|
||||
|
||||
|
||||
if (!Directory.Exists(iconsFolder))
|
||||
{
|
||||
Directory.CreateDirectory(iconsFolder);
|
||||
}
|
||||
|
||||
|
||||
// 生成一个唯一的文件名(使用GUID)
|
||||
string extension = Path.GetExtension(selectedFilePath);
|
||||
string newFileName = $"{Guid.NewGuid()}{extension}";
|
||||
string destPath = Path.Combine(iconsFolder, newFileName);
|
||||
|
||||
|
||||
// 复制文件到pictures/icons文件夹
|
||||
File.Copy(selectedFilePath, destPath);
|
||||
|
||||
|
||||
// 创建新的自定义图标对象
|
||||
var customIcon = new CustomFloatingBarIcon(IconNameTextBox.Text, destPath);
|
||||
|
||||
|
||||
// 添加到主窗口的设置中
|
||||
MainWindow.Settings.Appearance.CustomFloatingBarImgs.Add(customIcon);
|
||||
|
||||
|
||||
// 更新ComboBox
|
||||
mainWindow.UpdateCustomIconsInComboBox();
|
||||
|
||||
|
||||
// 保存设置
|
||||
MainWindow.SaveSettingsToFile();
|
||||
|
||||
|
||||
IsSuccess = true;
|
||||
Close();
|
||||
}
|
||||
@@ -117,4 +117,4 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Ink_Canvas
|
||||
InitializeComponent();
|
||||
mainWindow = owner;
|
||||
IsSuccess = false;
|
||||
|
||||
|
||||
// 添加TextBox内容变化事件以检查是否可以保存
|
||||
BackgroundNameTextBox.TextChanged += (s, e) => ValidateSaveButton();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
selectedFilePath = openFileDialog.FileName;
|
||||
BackgroundPathTextBox.Text = selectedFilePath;
|
||||
|
||||
|
||||
// 显示预览
|
||||
try
|
||||
{
|
||||
@@ -52,15 +52,15 @@ namespace Ink_Canvas
|
||||
{
|
||||
MessageBox.Show($"无法加载图像: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
|
||||
// 自动填充名称建议(文件名,不包括扩展名)
|
||||
string suggestedName = Path.GetFileNameWithoutExtension(selectedFilePath);
|
||||
BackgroundNameTextBox.Text = suggestedName;
|
||||
|
||||
|
||||
ValidateSaveButton();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ValidateSaveButton()
|
||||
{
|
||||
SaveButton.IsEnabled = !string.IsNullOrWhiteSpace(BackgroundNameTextBox.Text) && !string.IsNullOrEmpty(selectedFilePath);
|
||||
@@ -78,37 +78,37 @@ namespace Ink_Canvas
|
||||
// 创建pictures/picknamebackgrounds文件夹结构(如果不存在)
|
||||
string picturesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "pictures");
|
||||
string backgroundsFolder = Path.Combine(picturesFolder, "picknamebackgrounds");
|
||||
|
||||
|
||||
if (!Directory.Exists(picturesFolder))
|
||||
{
|
||||
Directory.CreateDirectory(picturesFolder);
|
||||
}
|
||||
|
||||
|
||||
if (!Directory.Exists(backgroundsFolder))
|
||||
{
|
||||
Directory.CreateDirectory(backgroundsFolder);
|
||||
}
|
||||
|
||||
|
||||
// 生成一个唯一的文件名(使用GUID)
|
||||
string extension = Path.GetExtension(selectedFilePath);
|
||||
string newFileName = $"{Guid.NewGuid()}{extension}";
|
||||
string destPath = Path.Combine(backgroundsFolder, newFileName);
|
||||
|
||||
|
||||
// 复制文件到pictures/picknamebackgrounds文件夹
|
||||
File.Copy(selectedFilePath, destPath);
|
||||
|
||||
|
||||
// 创建新的自定义背景对象
|
||||
var customBackground = new CustomPickNameBackground(BackgroundNameTextBox.Text, destPath);
|
||||
|
||||
|
||||
// 添加到主窗口的设置中
|
||||
MainWindow.Settings.RandSettings.CustomPickNameBackgrounds.Add(customBackground);
|
||||
|
||||
|
||||
// 更新ComboBox
|
||||
mainWindow.UpdatePickNameBackgroundsInComboBox();
|
||||
|
||||
|
||||
// 保存设置
|
||||
MainWindow.SaveSettingsToFile();
|
||||
|
||||
|
||||
IsSuccess = true;
|
||||
Close();
|
||||
}
|
||||
@@ -118,4 +118,4 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Media;
|
||||
using System.Timers;
|
||||
@@ -7,8 +9,6 @@ using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Application = System.Windows.Application;
|
||||
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||
using Timer = System.Timers.Timer;
|
||||
@@ -364,7 +364,8 @@ namespace Ink_Canvas
|
||||
// Set to center
|
||||
double dpiScaleX = 1, dpiScaleY = 1;
|
||||
PresentationSource source = PresentationSource.FromVisual(this);
|
||||
if (source != null) {
|
||||
if (source != null)
|
||||
{
|
||||
dpiScaleX = source.CompositionTarget.TransformToDevice.M11;
|
||||
dpiScaleY = source.CompositionTarget.TransformToDevice.M22;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
InitializeComponent();
|
||||
mainWindow = owner;
|
||||
|
||||
|
||||
// 从主窗口的设置获取自定义图标列表
|
||||
CustomIcons = new ObservableCollection<CustomFloatingBarIcon>(MainWindow.Settings.Appearance.CustomFloatingBarImgs);
|
||||
CustomIconsListView.ItemsSource = CustomIcons;
|
||||
@@ -28,26 +28,26 @@ namespace Ink_Canvas
|
||||
{
|
||||
// 从列表中移除图标
|
||||
CustomIcons.Remove(icon);
|
||||
|
||||
|
||||
// 更新主窗口的设置
|
||||
MainWindow.Settings.Appearance.CustomFloatingBarImgs.Clear();
|
||||
foreach (var customIcon in CustomIcons)
|
||||
{
|
||||
MainWindow.Settings.Appearance.CustomFloatingBarImgs.Add(customIcon);
|
||||
}
|
||||
|
||||
|
||||
// 如果当前选中的是被删除的图标,重置为默认图标
|
||||
if (MainWindow.Settings.Appearance.FloatingBarImg >= 8 &&
|
||||
if (MainWindow.Settings.Appearance.FloatingBarImg >= 8 &&
|
||||
MainWindow.Settings.Appearance.FloatingBarImg - 8 >= MainWindow.Settings.Appearance.CustomFloatingBarImgs.Count)
|
||||
{
|
||||
MainWindow.Settings.Appearance.FloatingBarImg = 0;
|
||||
mainWindow.ComboBoxFloatingBarImg.SelectedIndex = 0;
|
||||
mainWindow.UpdateFloatingBarIcon();
|
||||
}
|
||||
|
||||
|
||||
// 更新ComboBox
|
||||
mainWindow.UpdateCustomIconsInComboBox();
|
||||
|
||||
|
||||
// 保存设置
|
||||
MainWindow.SaveSettingsToFile();
|
||||
}
|
||||
@@ -58,4 +58,4 @@ namespace Ink_Canvas
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using MdXaml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -10,9 +13,6 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using MdXaml;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
@@ -72,34 +72,34 @@ namespace Ink_Canvas
|
||||
public HasNewUpdateWindow(string currentVersion, string newVersion, string releaseDate, string releaseNotes = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
// 设置版本信息
|
||||
CurrentVersion = currentVersion;
|
||||
NewVersion = newVersion;
|
||||
ReleaseDate = releaseDate;
|
||||
ReleaseNotes = releaseNotes;
|
||||
|
||||
|
||||
// 更新UI
|
||||
updateVersionInfo.Text = $"本次更新: {CurrentVersion} -> {NewVersion}";
|
||||
updateDateInfo.Text = $"{ReleaseDate}发布更新";
|
||||
|
||||
|
||||
// 如果有发布说明,设置到Markdown内容中
|
||||
if (!string.IsNullOrEmpty(ReleaseNotes))
|
||||
{
|
||||
markdownContent.Markdown = ReleaseNotes;
|
||||
}
|
||||
|
||||
|
||||
// 自动更新和静默更新设置已移至设置界面,此处不再需要
|
||||
|
||||
|
||||
// 确保按钮可见且可用
|
||||
EnsureButtonsVisibility();
|
||||
|
||||
|
||||
// 显示窗口动画
|
||||
AnimationsHelper.ShowWithFadeIn(this, 0.25);
|
||||
|
||||
|
||||
// 设置深色模式
|
||||
UseImmersiveDarkMode(new WindowInteropHelper(this).Handle, true);
|
||||
|
||||
|
||||
// 窗口加载完成后再次确保按钮可见
|
||||
Loaded += HasNewUpdateWindow_Loaded;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
// 窗口加载完成后再次确保按钮可见
|
||||
EnsureButtonsVisibility();
|
||||
|
||||
|
||||
// 调整窗口大小以适应屏幕分辨率
|
||||
AdjustWindowSizeForScreenResolution();
|
||||
}
|
||||
@@ -119,18 +119,18 @@ namespace Ink_Canvas
|
||||
// 确保立即更新按钮可见
|
||||
UpdateNowButton.Visibility = Visibility.Visible;
|
||||
UpdateNowButton.IsEnabled = true;
|
||||
|
||||
|
||||
// 确保稍后更新按钮可见
|
||||
UpdateLaterButton.Visibility = Visibility.Visible;
|
||||
UpdateLaterButton.IsEnabled = true;
|
||||
|
||||
|
||||
// 确保跳过版本按钮可见
|
||||
SkipVersionButton.Visibility = Visibility.Visible;
|
||||
SkipVersionButton.IsEnabled = true;
|
||||
|
||||
|
||||
// 强制刷新UI
|
||||
UpdateLayout();
|
||||
|
||||
|
||||
// 记录日志
|
||||
LogHelper.WriteLogToFile("AutoUpdate | Update dialog buttons visibility ensured");
|
||||
}
|
||||
@@ -154,7 +154,8 @@ namespace Ink_Canvas
|
||||
var groups = AutoUpdateHelper.ChannelLineGroups[MainWindow.Settings.Startup.UpdateChannel];
|
||||
downloadSuccess = await AutoUpdateHelper.DownloadSetupFileWithFallback(NewVersion, groups, (percent, text) =>
|
||||
{
|
||||
Dispatcher.Invoke(() => {
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
DownloadProgressBar.Value = percent;
|
||||
DownloadProgressText.Text = text;
|
||||
});
|
||||
@@ -176,10 +177,10 @@ namespace Ink_Canvas
|
||||
DownloadProgressBar.Value = 100;
|
||||
DownloadProgressText.Text = "下载完成,准备安装...";
|
||||
await Task.Delay(800);
|
||||
// 设置结果为立即更新
|
||||
Result = UpdateResult.UpdateNow;
|
||||
DialogResult = true;
|
||||
Close();
|
||||
// 设置结果为立即更新
|
||||
Result = UpdateResult.UpdateNow;
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -193,10 +194,10 @@ namespace Ink_Canvas
|
||||
private void UpdateLaterButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LogHelper.WriteLogToFile("AutoUpdate | Update Later button clicked");
|
||||
|
||||
|
||||
// 设置结果为稍后更新
|
||||
Result = UpdateResult.UpdateLater;
|
||||
|
||||
|
||||
// 关闭窗口
|
||||
DialogResult = true;
|
||||
Close();
|
||||
@@ -205,16 +206,16 @@ namespace Ink_Canvas
|
||||
private void SkipVersionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LogHelper.WriteLogToFile("AutoUpdate | Skip Version button clicked");
|
||||
|
||||
|
||||
// 设置结果为跳过该版本
|
||||
Result = UpdateResult.SkipVersion;
|
||||
|
||||
|
||||
// 关闭窗口
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 根据屏幕分辨率调整窗口大小
|
||||
private void AdjustWindowSizeForScreenResolution()
|
||||
@@ -224,15 +225,15 @@ namespace Ink_Canvas
|
||||
// 获取主屏幕分辨率
|
||||
double screenWidth = SystemParameters.PrimaryScreenWidth;
|
||||
double screenHeight = SystemParameters.PrimaryScreenHeight;
|
||||
|
||||
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | Screen resolution: {screenWidth}x{screenHeight}");
|
||||
|
||||
|
||||
// 始终确保窗口不超过屏幕大小的85%
|
||||
double maxHeight = screenHeight * 0.85;
|
||||
double maxWidth = screenWidth * 0.85;
|
||||
|
||||
|
||||
bool needsAdjustment = false;
|
||||
|
||||
|
||||
// 如果窗口高度超过最大允许高度,调整窗口高度
|
||||
if (Height > maxHeight)
|
||||
{
|
||||
@@ -240,7 +241,7 @@ namespace Ink_Canvas
|
||||
needsAdjustment = true;
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | Adjusted window height to: {Height}");
|
||||
}
|
||||
|
||||
|
||||
// 如果窗口宽度超过最大允许宽度,调整窗口宽度
|
||||
if (Width > maxWidth)
|
||||
{
|
||||
@@ -248,7 +249,7 @@ namespace Ink_Canvas
|
||||
needsAdjustment = true;
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | Adjusted window width to: {Width}");
|
||||
}
|
||||
|
||||
|
||||
// 如果屏幕分辨率较低,调整更多UI元素
|
||||
if (screenHeight < 768 || screenWidth < 1024 || needsAdjustment)
|
||||
{
|
||||
@@ -257,7 +258,7 @@ namespace Ink_Canvas
|
||||
var updateNowButton = FindName("UpdateNowButton") as Button;
|
||||
var updateLaterButton = FindName("UpdateLaterButton") as Button;
|
||||
var skipVersionButton = FindName("SkipVersionButton") as Button;
|
||||
|
||||
|
||||
// 查找包含ScrollViewer的边框控件,减小其高度
|
||||
var contentBorders = FindVisualChildren<Border>().ToList();
|
||||
foreach (var border in contentBorders)
|
||||
@@ -277,7 +278,7 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 调整按钮大小
|
||||
if (updateNowButton != null && updateLaterButton != null && skipVersionButton != null)
|
||||
{
|
||||
@@ -290,13 +291,13 @@ namespace Ink_Canvas
|
||||
LogHelper.WriteLogToFile("AutoUpdate | Reduced button sizes for small screen");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 确保窗口在屏幕范围内
|
||||
if (Left < 0) Left = 0;
|
||||
if (Top < 0) Top = 0;
|
||||
if (Left + Width > screenWidth) Left = screenWidth - Width;
|
||||
if (Top + Height > screenHeight) Top = screenHeight - Height;
|
||||
|
||||
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | Final window size: {Width}x{Height}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -304,13 +305,13 @@ namespace Ink_Canvas
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | Error adjusting window size: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 递归查找指定类型的所有子控件
|
||||
private IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj = null) where T : DependencyObject
|
||||
{
|
||||
if (depObj == null)
|
||||
depObj = this;
|
||||
|
||||
|
||||
if (depObj != null)
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
|
||||
@@ -341,7 +342,8 @@ namespace Ink_Canvas
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | 开始安装版本: {version}");
|
||||
AutoUpdateHelper.InstallNewVersionApp(version, false);
|
||||
App.IsAppExitByUser = true;
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
});
|
||||
return true;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -7,7 +8,6 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Ink_Canvas.Helpers;
|
||||
// Added for OrderByDescending
|
||||
|
||||
namespace Ink_Canvas
|
||||
@@ -104,7 +104,8 @@ namespace Ink_Canvas
|
||||
channel,
|
||||
(percent, text) =>
|
||||
{
|
||||
Dispatcher.Invoke(() => {
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
DownloadProgressBar.Value = percent;
|
||||
DownloadProgressText.Text = text;
|
||||
});
|
||||
@@ -139,4 +140,4 @@ namespace Ink_Canvas
|
||||
base.OnClosing(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
InitializeComponent();
|
||||
mainWindow = owner;
|
||||
|
||||
|
||||
// 从主窗口的设置获取自定义背景列表
|
||||
Backgrounds = new ObservableCollection<CustomPickNameBackground>(MainWindow.Settings.RandSettings.CustomPickNameBackgrounds);
|
||||
BackgroundsListView.ItemsSource = Backgrounds;
|
||||
@@ -30,16 +30,16 @@ namespace Ink_Canvas
|
||||
{
|
||||
// 找到背景在列表中的索引(加8,因为前8个是默认值)
|
||||
int index = Backgrounds.IndexOf(background) + 1; // 增加1因为索引0将是"默认"
|
||||
|
||||
|
||||
// 更新设置
|
||||
MainWindow.Settings.RandSettings.SelectedBackgroundIndex = index;
|
||||
|
||||
|
||||
// 更新UI
|
||||
mainWindow.UpdatePickNameBackgroundDisplay();
|
||||
|
||||
|
||||
// 保存设置
|
||||
MainWindow.SaveSettingsToFile();
|
||||
|
||||
|
||||
MessageBox.Show($"已将\"{background.Name}\"设置为当前点名背景", "设置成功", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
@@ -57,17 +57,17 @@ namespace Ink_Canvas
|
||||
{
|
||||
File.Delete(background.FilePath);
|
||||
}
|
||||
|
||||
|
||||
// 从列表中移除背景
|
||||
Backgrounds.Remove(background);
|
||||
|
||||
|
||||
// 更新主窗口的设置
|
||||
MainWindow.Settings.RandSettings.CustomPickNameBackgrounds.Clear();
|
||||
foreach (var bg in Backgrounds)
|
||||
{
|
||||
MainWindow.Settings.RandSettings.CustomPickNameBackgrounds.Add(bg);
|
||||
}
|
||||
|
||||
|
||||
// 如果当前选中的是被删除的背景,重置为默认背景
|
||||
int selectedIndex = MainWindow.Settings.RandSettings.SelectedBackgroundIndex;
|
||||
if (selectedIndex > 0 && selectedIndex - 1 >= MainWindow.Settings.RandSettings.CustomPickNameBackgrounds.Count)
|
||||
@@ -75,10 +75,10 @@ namespace Ink_Canvas
|
||||
MainWindow.Settings.RandSettings.SelectedBackgroundIndex = 0;
|
||||
mainWindow.UpdatePickNameBackgroundDisplay();
|
||||
}
|
||||
|
||||
|
||||
// 更新ComboBox
|
||||
mainWindow.UpdatePickNameBackgroundsInComboBox();
|
||||
|
||||
|
||||
// 保存设置
|
||||
MainWindow.SaveSettingsToFile();
|
||||
}
|
||||
@@ -95,4 +95,4 @@ namespace Ink_Canvas
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel;
|
||||
using Ink_Canvas.Helpers;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Ink_Canvas.Helpers;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Ink_Canvas.Helpers;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
@@ -26,17 +26,22 @@ namespace Ink_Canvas
|
||||
if (e.LeftButton == MouseButtonState.Pressed) DragMove();
|
||||
}
|
||||
|
||||
private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (WindowState == WindowState.Normal) {
|
||||
private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (WindowState == WindowState.Normal)
|
||||
{
|
||||
WindowState = WindowState.Maximized;
|
||||
SymbolIconFullscreen.Symbol = Symbol.BackToWindow;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowState = WindowState.Normal;
|
||||
SymbolIconFullscreen.Symbol = Symbol.FullScreen;
|
||||
}
|
||||
}
|
||||
|
||||
private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e) {
|
||||
private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using Ink_Canvas.Helpers.Plugins;
|
||||
using Ink_Canvas.Helpers.Plugins.BuiltIn;
|
||||
using Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
@@ -6,12 +12,6 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using Ink_Canvas.Helpers;
|
||||
using Ink_Canvas.Helpers.Plugins;
|
||||
using Ink_Canvas.Helpers.Plugins.BuiltIn;
|
||||
using Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Microsoft.Win32;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace Ink_Canvas.Windows
|
||||
@@ -22,14 +22,14 @@ namespace Ink_Canvas.Windows
|
||||
public partial class PluginSettingsWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 刷新插件列表
|
||||
/// </summary>
|
||||
public void RefreshPluginList()
|
||||
{
|
||||
LoadPlugins();
|
||||
|
||||
|
||||
// 如果当前选中的插件仍然存在,保持其选中状态
|
||||
if (SelectedPlugin != null)
|
||||
{
|
||||
@@ -39,13 +39,13 @@ namespace Ink_Canvas.Windows
|
||||
PluginListView.SelectedItem = matchingPlugin;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OnPropertyChanged(nameof(SelectedPlugin));
|
||||
LogHelper.WriteLogToFile("插件列表已刷新");
|
||||
}
|
||||
|
||||
private IPlugin _selectedPlugin;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中的插件
|
||||
/// </summary>
|
||||
@@ -83,21 +83,21 @@ namespace Ink_Canvas.Windows
|
||||
public PluginSettingsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
// 设置数据上下文
|
||||
PluginDetailGrid.DataContext = this;
|
||||
|
||||
|
||||
// 设置导出按钮初始状态
|
||||
BtnExportPlugin.IsEnabled = false;
|
||||
BtnExportPlugin.ToolTip = "请先选择要导出的插件";
|
||||
|
||||
|
||||
// 加载插件列表
|
||||
LoadPlugins();
|
||||
|
||||
|
||||
// 注册窗口关闭事件
|
||||
Closing += PluginSettingsWindow_Closing;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 窗口关闭事件处理
|
||||
/// </summary>
|
||||
@@ -115,44 +115,44 @@ namespace Ink_Canvas.Windows
|
||||
LogHelper.WriteLogToFile($"关闭窗口时保存插件配置出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载插件列表
|
||||
/// </summary>
|
||||
private void LoadPlugins()
|
||||
{
|
||||
Plugins.Clear();
|
||||
|
||||
|
||||
LogHelper.WriteLogToFile($"开始加载插件列表到UI,插件总数: {PluginManager.Instance.Plugins.Count}");
|
||||
|
||||
|
||||
// 添加所有已加载的插件
|
||||
foreach (var plugin in PluginManager.Instance.Plugins)
|
||||
{
|
||||
bool isEnabled = false;
|
||||
|
||||
|
||||
// 从插件实例获取启用状态
|
||||
if (plugin is PluginBase pluginBase)
|
||||
{
|
||||
isEnabled = pluginBase.IsEnabled;
|
||||
}
|
||||
|
||||
|
||||
// 记录插件详细信息
|
||||
LogHelper.WriteLogToFile($"正在加载插件到UI: 类型={plugin.GetType().FullName}, 名称={plugin.Name ?? "未命名"}, 状态={isEnabled}");
|
||||
|
||||
|
||||
// 创建视图模型并添加到集合
|
||||
var viewModel = new PluginViewModel(plugin)
|
||||
{
|
||||
IsEnabled = isEnabled
|
||||
};
|
||||
Plugins.Add(viewModel);
|
||||
|
||||
|
||||
LogHelper.WriteLogToFile($"已加载插件到UI列表: {plugin.Name},状态: {(isEnabled ? "启用" : "禁用")}");
|
||||
}
|
||||
|
||||
|
||||
// 绑定到ListView
|
||||
LogHelper.WriteLogToFile($"绑定 {Plugins.Count} 个插件到ListView");
|
||||
PluginListView.ItemsSource = Plugins;
|
||||
|
||||
|
||||
// 如果有插件,选择第一个
|
||||
if (Plugins.Count > 0)
|
||||
{
|
||||
@@ -164,7 +164,7 @@ namespace Ink_Canvas.Windows
|
||||
LogHelper.WriteLogToFile("没有找到任何插件", LogHelper.LogType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新属性变更通知
|
||||
/// </summary>
|
||||
@@ -173,7 +173,7 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插件列表选择变更事件
|
||||
/// </summary>
|
||||
@@ -183,13 +183,13 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
// 设置当前选中的插件
|
||||
SelectedPlugin = viewModel.Plugin;
|
||||
|
||||
|
||||
// 加载插件设置界面
|
||||
PluginSettingsContainer.Content = SelectedPlugin.GetSettingsView();
|
||||
|
||||
|
||||
// 设置删除按钮的可见性
|
||||
BtnDeletePlugin.Visibility = !SelectedPlugin.IsBuiltIn ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
|
||||
// 设置导出按钮的可用状态
|
||||
BtnExportPlugin.IsEnabled = !SelectedPlugin.IsBuiltIn;
|
||||
if (SelectedPlugin.IsBuiltIn)
|
||||
@@ -210,7 +210,7 @@ namespace Ink_Canvas.Windows
|
||||
BtnExportPlugin.ToolTip = "请先选择要导出的插件";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载本地插件按钮点击事件
|
||||
/// </summary>
|
||||
@@ -224,38 +224,38 @@ namespace Ink_Canvas.Windows
|
||||
Filter = "ICC插件文件(*.iccpp)|*.iccpp",
|
||||
Title = "选择要加载的插件文件"
|
||||
};
|
||||
|
||||
|
||||
// 显示对话框
|
||||
if (dialog.ShowDialog() == true)
|
||||
{
|
||||
// 获取插件文件路径
|
||||
string pluginPath = dialog.FileName;
|
||||
|
||||
|
||||
// 检查是否在Plugins目录下
|
||||
string pluginsDirectory = Path.Combine(App.RootPath, "Plugins");
|
||||
string targetPath = Path.Combine(pluginsDirectory, Path.GetFileName(pluginPath));
|
||||
|
||||
|
||||
// 确保Plugins目录存在
|
||||
if (!Directory.Exists(pluginsDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(pluginsDirectory);
|
||||
}
|
||||
|
||||
|
||||
// 如果插件不在Plugins目录下,复制过去
|
||||
if (!string.Equals(pluginPath, targetPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
File.Copy(pluginPath, targetPath, true);
|
||||
pluginPath = targetPath;
|
||||
}
|
||||
|
||||
|
||||
// 加载插件
|
||||
IPlugin plugin = PluginManager.Instance.LoadExternalPlugin(pluginPath);
|
||||
|
||||
|
||||
if (plugin != null)
|
||||
{
|
||||
// 刷新插件列表
|
||||
LoadPlugins();
|
||||
|
||||
|
||||
// 选择新加载的插件
|
||||
foreach (var item in Plugins)
|
||||
{
|
||||
@@ -265,7 +265,7 @@ namespace Ink_Canvas.Windows
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MessageBox.Show($"插件 {plugin.Name} v{plugin.Version} 已成功加载!", "成功", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
@@ -279,47 +279,47 @@ namespace Ink_Canvas.Windows
|
||||
MessageBox.Show($"加载插件时发生错误:{ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除插件按钮点击事件
|
||||
/// </summary>
|
||||
private void BtnDeletePlugin_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (SelectedPlugin == null) return;
|
||||
|
||||
|
||||
// 不能删除内置插件
|
||||
if (SelectedPlugin.IsBuiltIn)
|
||||
{
|
||||
MessageBox.Show("内置插件无法删除。", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 保存插件名称,以便在删除后使用
|
||||
string pluginName = SelectedPlugin.Name;
|
||||
|
||||
|
||||
// 确认删除
|
||||
MessageBoxResult result = MessageBox.Show(
|
||||
$"确定要删除插件 {pluginName} 吗?\n此操作将永久删除插件文件,无法恢复。",
|
||||
"删除确认",
|
||||
MessageBoxButton.YesNo,
|
||||
$"确定要删除插件 {pluginName} 吗?\n此操作将永久删除插件文件,无法恢复。",
|
||||
"删除确认",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Warning);
|
||||
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
// 删除插件
|
||||
bool success = PluginManager.Instance.DeletePlugin(SelectedPlugin);
|
||||
|
||||
|
||||
if (success)
|
||||
{
|
||||
// 刷新插件列表
|
||||
LoadPlugins();
|
||||
|
||||
|
||||
// 如果还有插件,选择第一个
|
||||
if (Plugins.Count > 0)
|
||||
{
|
||||
PluginListView.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
MessageBox.Show($"插件 {pluginName} 已成功删除。", "成功", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
@@ -328,7 +328,7 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导出插件按钮点击事件
|
||||
/// </summary>
|
||||
@@ -403,7 +403,7 @@ namespace Ink_Canvas.Windows
|
||||
MessageBox.Show($"导出插件时发生错误: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插件开关切换事件
|
||||
/// </summary>
|
||||
@@ -411,26 +411,26 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sender is ToggleSwitch toggleSwitch &&
|
||||
if (sender is ToggleSwitch toggleSwitch &&
|
||||
toggleSwitch.Tag is IPlugin plugin)
|
||||
{
|
||||
// 记录当前开关状态
|
||||
bool targetState = toggleSwitch.IsOn;
|
||||
|
||||
|
||||
// 记录插件类型名称和名称,用于稍后查找重载后的插件
|
||||
string pluginTypeName = plugin.GetType().FullName;
|
||||
string pluginName = plugin.Name;
|
||||
bool wasBuiltIn = plugin.IsBuiltIn;
|
||||
|
||||
|
||||
LogHelper.WriteLogToFile($"UI开关切换: {pluginName}, 目标状态: {(targetState ? "启用" : "禁用")}");
|
||||
|
||||
|
||||
// 切换插件状态
|
||||
PluginManager.Instance.TogglePlugin(plugin, targetState);
|
||||
|
||||
|
||||
// 立即同步保存配置到文件(确保状态被立即持久化)
|
||||
PluginManager.Instance.SaveConfig();
|
||||
LogHelper.WriteLogToFile("插件状态已立即保存到配置文件");
|
||||
|
||||
|
||||
// 延迟一下再检查状态,确保变更已应用
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
@@ -446,17 +446,17 @@ namespace Ink_Canvas.Windows
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (currentPlugin == null)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"无法找到插件: {pluginName},UI状态可能不准确", LogHelper.LogType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 检查实际状态
|
||||
bool actualState = currentPlugin is PluginBase pb && pb.IsEnabled;
|
||||
LogHelper.WriteLogToFile($"插件 {pluginName} 实际状态: {(actualState ? "启用" : "禁用")}");
|
||||
|
||||
|
||||
// 更新视图模型
|
||||
PluginViewModel viewModel = null;
|
||||
if (toggleSwitch.DataContext is PluginViewModel vm)
|
||||
@@ -467,7 +467,7 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
viewModel = Plugins.FirstOrDefault(p => p.Plugin == currentPlugin);
|
||||
}
|
||||
|
||||
|
||||
if (viewModel != null)
|
||||
{
|
||||
// 确保视图模型状态与实际状态一致
|
||||
@@ -476,7 +476,7 @@ namespace Ink_Canvas.Windows
|
||||
LogHelper.WriteLogToFile($"同步视图模型状态: {(actualState ? "启用" : "禁用")}");
|
||||
viewModel.IsEnabled = actualState;
|
||||
}
|
||||
|
||||
|
||||
// 确保UI开关状态与实际状态一致
|
||||
if (toggleSwitch.IsOn != actualState)
|
||||
{
|
||||
@@ -484,25 +484,25 @@ namespace Ink_Canvas.Windows
|
||||
toggleSwitch.IsOn = actualState;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 如果是当前选中的插件,更新属性
|
||||
if (currentPlugin == SelectedPlugin)
|
||||
{
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
}
|
||||
|
||||
|
||||
// 对于内置插件,特别处理
|
||||
if (wasBuiltIn)
|
||||
{
|
||||
// 特殊插件刷新逻辑,如果是超级启动台插件,立即刷新UI
|
||||
if (currentPlugin is SuperLauncherPlugin &&
|
||||
if (currentPlugin is SuperLauncherPlugin &&
|
||||
PluginSettingsContainer.Content is LauncherSettingsControl)
|
||||
{
|
||||
// 重新获取设置界面
|
||||
PluginSettingsContainer.Content = currentPlugin.GetSettingsView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LogHelper.WriteLogToFile($"插件 {pluginName} UI状态同步完成");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -518,7 +518,7 @@ namespace Ink_Canvas.Windows
|
||||
MessageBox.Show($"切换插件状态时出错: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存插件状态按钮点击事件
|
||||
/// </summary>
|
||||
@@ -527,7 +527,7 @@ namespace Ink_Canvas.Windows
|
||||
try
|
||||
{
|
||||
int syncCount = 0;
|
||||
|
||||
|
||||
// 遍历界面上所有插件视图模型,获取开关状态
|
||||
foreach (var viewModel in Plugins)
|
||||
{
|
||||
@@ -537,10 +537,10 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
// 获取UI中开关的当前状态(从界面控件读取)
|
||||
bool uiState = viewModel.IsEnabled;
|
||||
|
||||
|
||||
// 获取插件类型名,用于查找配置
|
||||
string pluginTypeName = viewModel.Plugin.GetType().FullName;
|
||||
|
||||
|
||||
// 查找实际的插件实例(可能与viewModel.Plugin不同,因为可能已经重新加载)
|
||||
IPlugin actualPlugin = null;
|
||||
foreach (var p in PluginManager.Instance.Plugins)
|
||||
@@ -551,21 +551,21 @@ namespace Ink_Canvas.Windows
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 如果找不到对应的实际插件实例,跳过
|
||||
if (actualPlugin == null)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"手动保存:无法找到与UI对应的插件实例:{viewModel.Name}", LogHelper.LogType.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// 获取插件实际状态
|
||||
bool pluginState = false;
|
||||
if (actualPlugin is PluginBase pluginBase)
|
||||
{
|
||||
pluginState = pluginBase.IsEnabled;
|
||||
}
|
||||
|
||||
|
||||
// 如果界面状态与插件实际状态不一致,应用界面状态
|
||||
if (uiState != pluginState)
|
||||
{
|
||||
@@ -574,7 +574,7 @@ namespace Ink_Canvas.Windows
|
||||
LogHelper.WriteLogToFile($"手动保存:同步插件 {actualPlugin.Name} 状态 {pluginState} -> {uiState}");
|
||||
syncCount++;
|
||||
}
|
||||
|
||||
|
||||
// 确保配置中的状态也与界面一致
|
||||
if (PluginManager.Instance.PluginStates.TryGetValue(pluginTypeName, out bool configState) && configState != uiState)
|
||||
{
|
||||
@@ -590,19 +590,19 @@ namespace Ink_Canvas.Windows
|
||||
LogHelper.WriteLogToFile($"手动保存:处理插件 {viewModel.Name} 时出错: {pluginEx.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 保存插件状态配置
|
||||
PluginManager.Instance.SaveConfig();
|
||||
|
||||
|
||||
// 记录日志
|
||||
LogHelper.WriteLogToFile($"用户手动保存插件状态配置,同步了 {syncCount} 个状态变更");
|
||||
|
||||
|
||||
// 刷新插件列表,确保UI与最新状态同步
|
||||
RefreshPluginList();
|
||||
|
||||
|
||||
// 显示保存成功提示
|
||||
string message = syncCount > 0
|
||||
? $"插件状态已成功保存,同步了 {syncCount} 个状态变更"
|
||||
string message = syncCount > 0
|
||||
? $"插件状态已成功保存,同步了 {syncCount} 个状态变更"
|
||||
: "插件状态已成功保存,所有插件状态已是最新";
|
||||
MessageBox.Show(message, "保存成功", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
@@ -610,12 +610,12 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
// 记录错误日志
|
||||
LogHelper.WriteLogToFile($"手动保存插件状态时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
|
||||
|
||||
// 显示错误信息
|
||||
MessageBox.Show($"保存插件状态时发生错误: {ex.Message}", "保存失败", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关闭按钮点击事件
|
||||
/// </summary>
|
||||
@@ -625,32 +625,32 @@ namespace Ink_Canvas.Windows
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插件视图模型
|
||||
/// </summary>
|
||||
public class PluginViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插件实例
|
||||
/// </summary>
|
||||
public IPlugin Plugin { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插件名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
string name = Plugin?.Name ?? "未命名插件";
|
||||
LogHelper.WriteLogToFile($"获取插件名称: {name},类型: {Plugin?.GetType().FullName ?? "未知"}");
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插件是否启用
|
||||
/// </summary>
|
||||
@@ -667,24 +667,24 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public PluginViewModel(IPlugin plugin)
|
||||
{
|
||||
Plugin = plugin;
|
||||
|
||||
|
||||
// 获取实际状态
|
||||
_isEnabled = plugin is PluginBase pluginBase && pluginBase.IsEnabled;
|
||||
|
||||
|
||||
// 记录日志
|
||||
LogHelper.WriteLogToFile($"创建插件视图模型: {plugin?.GetType().FullName ?? "未知"}, 名称: {plugin?.Name ?? "未命名"}");
|
||||
|
||||
|
||||
// 注册插件状态变更事件
|
||||
if (plugin is PluginBase pb)
|
||||
{
|
||||
pb.EnabledStateChanged += Plugin_EnabledStateChanged;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 处理插件状态变更事件
|
||||
/// </summary>
|
||||
@@ -694,7 +694,7 @@ namespace Ink_Canvas.Windows
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
IsEnabled = isEnabled;
|
||||
|
||||
|
||||
// 确保配置立即保存
|
||||
if (sender is IPlugin plugin)
|
||||
{
|
||||
@@ -704,7 +704,7 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 属性变更通知
|
||||
/// </summary>
|
||||
@@ -713,4 +713,4 @@ namespace Ink_Canvas.Windows
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -8,27 +11,27 @@ using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Microsoft.VisualBasic;
|
||||
using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for RandWindow.xaml
|
||||
/// </summary>
|
||||
public partial class RandWindow : Window {
|
||||
public RandWindow(Settings settings) {
|
||||
public partial class RandWindow : Window
|
||||
{
|
||||
public RandWindow(Settings settings)
|
||||
{
|
||||
InitializeComponent();
|
||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
|
||||
BorderBtnHelp.Visibility = settings.RandSettings.DisplayRandWindowNamesInputBtn == false ? Visibility.Collapsed : Visibility.Visible;
|
||||
RandMaxPeopleOneTime = settings.RandSettings.RandWindowOnceMaxStudents;
|
||||
RandDoneAutoCloseWaitTime = (int)settings.RandSettings.RandWindowOnceCloseLatency*1000;
|
||||
|
||||
RandDoneAutoCloseWaitTime = (int)settings.RandSettings.RandWindowOnceCloseLatency * 1000;
|
||||
|
||||
// 加载背景
|
||||
LoadBackground(settings);
|
||||
}
|
||||
|
||||
|
||||
private void LoadBackground(Settings settings)
|
||||
{
|
||||
try
|
||||
@@ -60,7 +63,8 @@ namespace Ink_Canvas {
|
||||
}
|
||||
}
|
||||
|
||||
public RandWindow(Settings settings, bool IsAutoClose) {
|
||||
public RandWindow(Settings settings, bool IsAutoClose)
|
||||
{
|
||||
InitializeComponent();
|
||||
isAutoClose = IsAutoClose;
|
||||
PeopleControlPane.Opacity = 0.4;
|
||||
@@ -68,13 +72,15 @@ namespace Ink_Canvas {
|
||||
BorderBtnHelp.Visibility = settings.RandSettings.DisplayRandWindowNamesInputBtn == false ? Visibility.Collapsed : Visibility.Visible;
|
||||
RandMaxPeopleOneTime = settings.RandSettings.RandWindowOnceMaxStudents;
|
||||
RandDoneAutoCloseWaitTime = (int)settings.RandSettings.RandWindowOnceCloseLatency * 1000;
|
||||
|
||||
|
||||
// 加载背景
|
||||
LoadBackground(settings);
|
||||
|
||||
new Thread(() => {
|
||||
new Thread(() =>
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
BorderBtnRand_MouseUp(BorderBtnRand, null);
|
||||
});
|
||||
}).Start();
|
||||
@@ -88,7 +94,8 @@ namespace Ink_Canvas {
|
||||
public int PeopleCount = 60;
|
||||
public List<string> Names = new List<string>();
|
||||
|
||||
private void BorderBtnAdd_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
private void BorderBtnAdd_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (RandMaxPeopleOneTime == -1 && TotalCount >= PeopleCount) return;
|
||||
if (RandMaxPeopleOneTime != -1 && TotalCount >= RandMaxPeopleOneTime) return;
|
||||
TotalCount++;
|
||||
@@ -98,11 +105,13 @@ namespace Ink_Canvas {
|
||||
BorderBtnMinus.Opacity = 1;
|
||||
}
|
||||
|
||||
private void BorderBtnMinus_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
private void BorderBtnMinus_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (TotalCount < 2) return;
|
||||
TotalCount--;
|
||||
LabelNumberCount.Text = TotalCount.ToString();
|
||||
if (TotalCount == 1) {
|
||||
if (TotalCount == 1)
|
||||
{
|
||||
SymbolIconStart.Symbol = Symbol.Contact;
|
||||
}
|
||||
}
|
||||
@@ -112,7 +121,8 @@ namespace Ink_Canvas {
|
||||
public int RandMaxPeopleOneTime = 10;
|
||||
public int RandDoneAutoCloseWaitTime = 2500;
|
||||
|
||||
private void BorderBtnRand_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
private void BorderBtnRand_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Random random = new Random();// randSeed + DateTime.Now.Millisecond / 10 % 10);
|
||||
string outputString = "";
|
||||
List<string> outputs = new List<string>();
|
||||
@@ -121,18 +131,25 @@ namespace Ink_Canvas {
|
||||
LabelOutput2.Visibility = Visibility.Collapsed;
|
||||
LabelOutput3.Visibility = Visibility.Collapsed;
|
||||
|
||||
new Thread(() => {
|
||||
for (int i = 0; i < RandWaitingTimes; i++) {
|
||||
new Thread(() =>
|
||||
{
|
||||
for (int i = 0; i < RandWaitingTimes; i++)
|
||||
{
|
||||
int rand = random.Next(1, PeopleCount + 1);
|
||||
while (rands.Contains(rand)) {
|
||||
while (rands.Contains(rand))
|
||||
{
|
||||
rand = random.Next(1, PeopleCount + 1);
|
||||
}
|
||||
rands.Add(rand);
|
||||
if (rands.Count >= PeopleCount) rands = new List<int>();
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
if (Names.Count != 0) {
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (Names.Count != 0)
|
||||
{
|
||||
LabelOutput.Content = Names[rand - 1];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelOutput.Content = rand.ToString();
|
||||
}
|
||||
});
|
||||
@@ -141,61 +158,80 @@ namespace Ink_Canvas {
|
||||
}
|
||||
|
||||
rands = new List<int>();
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
for (int i = 0; i < TotalCount; i++) {
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
for (int i = 0; i < TotalCount; i++)
|
||||
{
|
||||
int rand = random.Next(1, PeopleCount + 1);
|
||||
while (rands.Contains(rand)) {
|
||||
while (rands.Contains(rand))
|
||||
{
|
||||
rand = random.Next(1, PeopleCount + 1);
|
||||
}
|
||||
rands.Add(rand);
|
||||
if (rands.Count >= PeopleCount) rands = new List<int>();
|
||||
|
||||
if (Names.Count != 0) {
|
||||
if (Names.Count != 0)
|
||||
{
|
||||
outputs.Add(Names[rand - 1]);
|
||||
outputString += Names[rand - 1] + Environment.NewLine;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
outputs.Add(rand.ToString());
|
||||
outputString += rand + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
if (TotalCount <= 5) {
|
||||
if (TotalCount <= 5)
|
||||
{
|
||||
LabelOutput.Content = outputString.Trim();
|
||||
} else if (TotalCount <= 10) {
|
||||
}
|
||||
else if (TotalCount <= 10)
|
||||
{
|
||||
LabelOutput2.Visibility = Visibility.Visible;
|
||||
outputString = "";
|
||||
for (int i = 0; i < (outputs.Count + 1) / 2; i++) {
|
||||
for (int i = 0; i < (outputs.Count + 1) / 2; i++)
|
||||
{
|
||||
outputString += outputs[i] + Environment.NewLine;
|
||||
}
|
||||
LabelOutput.Content = outputString.Trim();
|
||||
outputString = "";
|
||||
for (int i = (outputs.Count + 1) / 2; i < outputs.Count; i++) {
|
||||
for (int i = (outputs.Count + 1) / 2; i < outputs.Count; i++)
|
||||
{
|
||||
outputString += outputs[i] + Environment.NewLine;
|
||||
}
|
||||
LabelOutput2.Content = outputString.Trim();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelOutput2.Visibility = Visibility.Visible;
|
||||
LabelOutput3.Visibility = Visibility.Visible;
|
||||
outputString = "";
|
||||
for (int i = 0; i < (outputs.Count + 1) / 3; i++) {
|
||||
for (int i = 0; i < (outputs.Count + 1) / 3; i++)
|
||||
{
|
||||
outputString += outputs[i] + Environment.NewLine;
|
||||
}
|
||||
LabelOutput.Content = outputString.Trim();
|
||||
outputString = "";
|
||||
for (int i = (outputs.Count + 1) / 3; i < (outputs.Count + 1) * 2 / 3; i++) {
|
||||
for (int i = (outputs.Count + 1) / 3; i < (outputs.Count + 1) * 2 / 3; i++)
|
||||
{
|
||||
outputString += outputs[i] + Environment.NewLine;
|
||||
}
|
||||
LabelOutput2.Content = outputString.Trim();
|
||||
outputString = "";
|
||||
for (int i = (outputs.Count + 1) * 2 / 3; i < outputs.Count; i++) {
|
||||
for (int i = (outputs.Count + 1) * 2 / 3; i < outputs.Count; i++)
|
||||
{
|
||||
outputString += outputs[i] + Environment.NewLine;
|
||||
}
|
||||
LabelOutput3.Content = outputString.Trim();
|
||||
}
|
||||
|
||||
if (isAutoClose) {
|
||||
new Thread(() => {
|
||||
if (isAutoClose)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
Thread.Sleep(RandDoneAutoCloseWaitTime);
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
PeopleControlPane.Opacity = 1;
|
||||
PeopleControlPane.IsHitTestVisible = true;
|
||||
Close();
|
||||
@@ -206,22 +242,28 @@ namespace Ink_Canvas {
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e) {
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Names = new List<string>();
|
||||
if (File.Exists(App.RootPath + "Names.txt")) {
|
||||
if (File.Exists(App.RootPath + "Names.txt"))
|
||||
{
|
||||
string[] fileNames = File.ReadAllLines(App.RootPath + "Names.txt");
|
||||
string[] replaces = new string[0];
|
||||
|
||||
if (File.Exists(App.RootPath + "Replace.txt")) {
|
||||
if (File.Exists(App.RootPath + "Replace.txt"))
|
||||
{
|
||||
replaces = File.ReadAllLines(App.RootPath + "Replace.txt");
|
||||
}
|
||||
|
||||
//Fix emtpy lines
|
||||
foreach (string str in fileNames) {
|
||||
foreach (string str in fileNames)
|
||||
{
|
||||
string s = str;
|
||||
//Make replacement
|
||||
foreach (string replace in replaces) {
|
||||
if (s == Strings.Left(replace, replace.IndexOf("-->"))) {
|
||||
foreach (string replace in replaces)
|
||||
{
|
||||
if (s == Strings.Left(replace, replace.IndexOf("-->")))
|
||||
{
|
||||
s = Strings.Mid(replace, replace.IndexOf("-->") + 4);
|
||||
}
|
||||
}
|
||||
@@ -231,19 +273,22 @@ namespace Ink_Canvas {
|
||||
|
||||
PeopleCount = Names.Count();
|
||||
TextBlockPeopleCount.Text = PeopleCount.ToString();
|
||||
if (PeopleCount == 0) {
|
||||
if (PeopleCount == 0)
|
||||
{
|
||||
PeopleCount = 60;
|
||||
TextBlockPeopleCount.Text = "点击此处以导入名单";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BorderBtnHelp_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
private void BorderBtnHelp_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
new NamesInputWindow().ShowDialog();
|
||||
Window_Loaded(this, null);
|
||||
}
|
||||
|
||||
private void BtnClose_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
private void BtnClose_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using Brushes = System.Windows.Media.Brushes;
|
||||
using Color = System.Windows.Media.Color;
|
||||
|
||||
using DrawingRectangle = System.Drawing.Rectangle;
|
||||
// 为了避免命名冲突,使用别名
|
||||
using WpfCanvas = System.Windows.Controls.Canvas;
|
||||
using DrawingRectangle = System.Drawing.Rectangle;
|
||||
using WpfRectangle = System.Windows.Shapes.Rectangle;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
@@ -25,20 +20,20 @@ namespace Ink_Canvas
|
||||
private System.Windows.Point _currentPoint;
|
||||
private List<System.Windows.Point> _freehandPoints;
|
||||
private Polyline _freehandPolyline;
|
||||
|
||||
|
||||
public DrawingRectangle? SelectedArea { get; private set; }
|
||||
public List<System.Windows.Point> SelectedPath { get; private set; }
|
||||
|
||||
public ScreenshotSelectorWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
// 设置窗口覆盖所有屏幕
|
||||
SetupFullScreenOverlay();
|
||||
|
||||
|
||||
// 初始化自由绘制模式
|
||||
InitializeFreehandMode();
|
||||
|
||||
|
||||
// 隐藏提示文字的定时器
|
||||
var timer = new System.Windows.Threading.DispatcherTimer();
|
||||
timer.Interval = TimeSpan.FromSeconds(5);
|
||||
@@ -49,7 +44,7 @@ namespace Ink_Canvas
|
||||
};
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
|
||||
private void InitializeFreehandMode()
|
||||
{
|
||||
_freehandPoints = new List<System.Windows.Point>();
|
||||
@@ -97,28 +92,28 @@ namespace Ink_Canvas
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void RectangleModeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_isFreehandMode = false;
|
||||
RectangleModeButton.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235)); // 蓝色
|
||||
FreehandModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
|
||||
HintText.Text = "拖拽鼠标选择矩形区域";
|
||||
|
||||
|
||||
// 清除自由绘制的内容
|
||||
_freehandPoints.Clear();
|
||||
_freehandPolyline.Points.Clear();
|
||||
SelectionPath.Visibility = Visibility.Collapsed;
|
||||
SelectionRectangle.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
private void FreehandModeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_isFreehandMode = true;
|
||||
FreehandModeButton.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235)); // 蓝色
|
||||
RectangleModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
|
||||
HintText.Text = "按住鼠标左键绘制任意形状,松开完成";
|
||||
|
||||
|
||||
// 清除矩形选择的内容
|
||||
SelectionRectangle.Visibility = Visibility.Collapsed;
|
||||
_freehandPoints.Clear();
|
||||
@@ -130,10 +125,10 @@ namespace Ink_Canvas
|
||||
_isSelecting = true;
|
||||
_startPoint = e.GetPosition(this);
|
||||
_currentPoint = _startPoint;
|
||||
|
||||
|
||||
// 隐藏提示文字
|
||||
HintText.Visibility = Visibility.Collapsed;
|
||||
|
||||
|
||||
if (_isFreehandMode)
|
||||
{
|
||||
// 自由绘制模式
|
||||
@@ -148,10 +143,10 @@ namespace Ink_Canvas
|
||||
SelectionRectangle.Visibility = Visibility.Visible;
|
||||
SizeInfoBorder.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
// 捕获鼠标
|
||||
CaptureMouse();
|
||||
|
||||
|
||||
if (!_isFreehandMode)
|
||||
{
|
||||
UpdateSelection();
|
||||
@@ -163,7 +158,7 @@ namespace Ink_Canvas
|
||||
if (_isSelecting)
|
||||
{
|
||||
_currentPoint = e.GetPosition(this);
|
||||
|
||||
|
||||
if (_isFreehandMode)
|
||||
{
|
||||
// 自由绘制模式:添加点到路径
|
||||
@@ -193,20 +188,20 @@ namespace Ink_Canvas
|
||||
// 闭合路径
|
||||
_freehandPoints.Add(_startPoint);
|
||||
_freehandPolyline.Points.Add(_startPoint);
|
||||
|
||||
|
||||
// 保存选择的路径
|
||||
SelectedPath = new List<System.Windows.Point>(_freehandPoints);
|
||||
|
||||
|
||||
// 计算边界矩形用于截图
|
||||
var bounds = CalculatePathBounds(_freehandPoints);
|
||||
var dpiScale = GetDpiScale();
|
||||
var virtualScreen = System.Windows.Forms.SystemInformation.VirtualScreen;
|
||||
|
||||
|
||||
int screenX = (int)((bounds.X * dpiScale) + virtualScreen.Left);
|
||||
int screenY = (int)((bounds.Y * dpiScale) + virtualScreen.Top);
|
||||
int screenWidth = (int)(bounds.Width * dpiScale);
|
||||
int screenHeight = (int)(bounds.Height * dpiScale);
|
||||
|
||||
|
||||
SelectedArea = new DrawingRectangle(screenX, screenY, screenWidth, screenHeight);
|
||||
DialogResult = true;
|
||||
}
|
||||
@@ -275,20 +270,20 @@ namespace Ink_Canvas
|
||||
double y = Math.Min(_startPoint.Y, _currentPoint.Y);
|
||||
double width = Math.Abs(_currentPoint.X - _startPoint.X);
|
||||
double height = Math.Abs(_currentPoint.Y - _startPoint.Y);
|
||||
|
||||
|
||||
return new Rect(x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
private Rect CalculatePathBounds(List<System.Windows.Point> points)
|
||||
{
|
||||
if (points == null || points.Count == 0)
|
||||
return new Rect();
|
||||
|
||||
|
||||
double minX = points[0].X;
|
||||
double minY = points[0].Y;
|
||||
double maxX = points[0].X;
|
||||
double maxY = points[0].Y;
|
||||
|
||||
|
||||
foreach (var point in points)
|
||||
{
|
||||
minX = Math.Min(minX, point.X);
|
||||
@@ -296,7 +291,7 @@ namespace Ink_Canvas
|
||||
maxX = Math.Max(maxX, point.X);
|
||||
maxY = Math.Max(maxY, point.Y);
|
||||
}
|
||||
|
||||
|
||||
return new Rect(minX, minY, maxX - minX, maxY - minY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace Ink_Canvas
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, EventArgs e) {
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
_windowClose?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user