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 { /// /// 颜色拾取器窗体 /// public partial class ColorPickerEx : Window { #region 变量 /// /// 颜色 /// 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 颜色拾取器 取消 /// /// 颜色拾取器 取消 /// /// /// 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 e) { try { ColorBrush = ColorPicker.SelectedBrush; this.DialogResult = true; } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } #endregion #region ESC关闭画面 /// /// ESC关闭画面 /// /// /// private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Escape) { this.Close(); } } #endregion } }