using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace SparkClient.Views.Dialog
{
///
/// MsgDialog.xaml 的交互逻辑
///
public partial class MsgDialog : Window
{
public MsgDialog()
{
InitializeComponent();
this.Loaded += (s, e) => ApplyCornerRadiusClip();
this.SizeChanged += (s, e) => ApplyCornerRadiusClip();
}
///
/// 关闭按钮点击事件
///
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
///
/// 跳过按钮点击事件
///
private void Skip_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
///
/// 窗口圆角裁剪
///
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
};
}
}
///
/// 支持窗口拖动
///
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
}
}
}
}