using DataEntity.Share;
|
using System;
|
using System.Windows;
|
using System.Windows.Input;
|
using System.Windows.Media;
|
using XCommon.Log;
|
using XHandler.View.Consumables;
|
using XHandler.View.MethodProperty;
|
|
namespace XHandler.View.ColorPicker
|
{
|
/// <summary>
|
/// 颜色拾取器窗体
|
/// </summary>
|
public partial class ColorPickerEx : Window
|
{
|
#region 变量
|
/// <summary>
|
/// 颜色
|
/// </summary>
|
public SolidColorBrush ColorBrush = null;
|
|
#endregion
|
|
#region 构造函数
|
public ColorPickerEx()
|
{
|
InitializeComponent();
|
this.Owner = (Window)Shared.Main;
|
}
|
#endregion
|
|
#region 初始化
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
{
|
try
|
{
|
ColorPicker.SelectedBrush = ColorBrush;
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region 颜色拾取器 取消
|
/// <summary>
|
/// 颜色拾取器 取消
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void ColorPicker_Canceled(object sender, EventArgs e)
|
{
|
try
|
{
|
this.DialogResult = false;
|
this.Close();
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region 颜色拾取器 确定
|
private void ColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<System.Windows.Media.Color> e)
|
{
|
try
|
{
|
ColorBrush = ColorPicker.SelectedBrush;
|
this.DialogResult = true;
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region ESC关闭画面
|
/// <summary>
|
/// ESC关闭画面
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.Key == Key.Escape)
|
{
|
this.Close();
|
}
|
}
|
#endregion
|
|
}
|
}
|