清理ColorPicker,进度条。修复UI问题
This commit is contained in:
52
ShrlAlgo.Addin.Test/ProgressWindow.xaml.cs
Normal file
52
ShrlAlgo.Addin.Test/ProgressWindow.xaml.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
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.Shapes;
|
||||
|
||||
namespace ShrlAlgo.Addin.Test
|
||||
{
|
||||
/// <summary>
|
||||
/// ProgressWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ProgressWindow : Window
|
||||
{
|
||||
private readonly ProgressViewModel _viewModel;
|
||||
|
||||
public ProgressWindow(ProgressViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
_viewModel = viewModel;
|
||||
DataContext = _viewModel;
|
||||
|
||||
// 绑定关闭委托
|
||||
_viewModel.CloseAction = this.Close;
|
||||
}
|
||||
|
||||
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_viewModel.Cancel();
|
||||
(sender as System.Windows.Controls.Button).IsEnabled = false;
|
||||
}
|
||||
|
||||
// 屏蔽系统的 Alt+F4 关闭,强制必须等主线程任务结束
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
if (!_viewModel.UIDispatcher.HasShutdownStarted)
|
||||
{
|
||||
e.Cancel = true;
|
||||
_viewModel.Cancel(); // 尝试取消
|
||||
}
|
||||
base.OnClosing(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user