You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.3 KiB
86 lines
2.3 KiB
using System.ComponentModel; |
|
using System.Windows; |
|
using System.Windows.Input; |
|
using System.Windows.Media; |
|
|
|
namespace SparkClient.Views.Dialog |
|
{ |
|
/// <summary> |
|
/// MsgDialog.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class MsgDialog : Window, INotifyPropertyChanged |
|
{ |
|
private string _errorMessage; |
|
|
|
public string ErrorMessage |
|
{ |
|
get { return _errorMessage; } |
|
set |
|
{ |
|
if (_errorMessage != value) |
|
{ |
|
_errorMessage = value; |
|
OnPropertyChanged(nameof(ErrorMessage)); |
|
} |
|
} |
|
} |
|
|
|
public MsgDialog() |
|
{ |
|
InitializeComponent(); |
|
this.Loaded += (s, e) => ApplyCornerRadiusClip(); |
|
this.SizeChanged += (s, e) => ApplyCornerRadiusClip(); |
|
this.DataContext = this; // 设置 DataContext 以便绑定 |
|
} |
|
|
|
/// <summary> |
|
/// 关闭按钮点击事件 |
|
/// </summary> |
|
private void CloseButton_Click(object sender, RoutedEventArgs e) |
|
{ |
|
this.Close(); |
|
} |
|
|
|
/// <summary> |
|
/// 跳过按钮点击事件 |
|
/// </summary> |
|
private void Skip_Click(object sender, RoutedEventArgs e) |
|
{ |
|
this.Close(); |
|
} |
|
|
|
/// <summary> |
|
/// 窗口圆角裁剪 |
|
/// </summary> |
|
private void ApplyCornerRadiusClip() |
|
{ |
|
if (this.ActualWidth > 0 && this.ActualHeight > 0) |
|
{ |
|
this.Clip = new RectangleGeometry |
|
{ |
|
Rect = new Rect(0, 0, this.ActualWidth, this.ActualHeight), |
|
RadiusX = 20, |
|
RadiusY = 20 |
|
}; |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 支持窗口拖动 |
|
/// </summary> |
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
{ |
|
if (e.LeftButton == MouseButtonState.Pressed) |
|
{ |
|
this.DragMove(); |
|
} |
|
} |
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
protected virtual void OnPropertyChanged(string propertyName) |
|
{ |
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
} |
|
} |
|
}
|
|
|