diff --git a/Control/Windows/GlobalColorPickerWindow.xaml b/Control/Windows/GlobalColorPickerWindow.xaml index 7d5a69d..e179746 100644 --- a/Control/Windows/GlobalColorPickerWindow.xaml +++ b/Control/Windows/GlobalColorPickerWindow.xaml @@ -5,6 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:GeekDesk.Control.Windows" xmlns:hc="https://handyorg.github.io/handycontrol" + xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF" WindowStyle="None" AllowsTransparency="True" Background="Transparent" @@ -14,15 +15,59 @@ Background="White" Height="385" Width="228"> - - - + + + + + - - - + + - + + diff --git a/Control/Windows/GlobalColorPickerWindow.xaml.cs b/Control/Windows/GlobalColorPickerWindow.xaml.cs index 80f69ac..65a3a7a 100644 --- a/Control/Windows/GlobalColorPickerWindow.xaml.cs +++ b/Control/Windows/GlobalColorPickerWindow.xaml.cs @@ -1,5 +1,8 @@ using GeekDesk.Interface; +using GeekDesk.Util; using System; +using System.Collections.ObjectModel; +using System.ComponentModel; using System.Threading; using System.Windows; using System.Windows.Controls; @@ -14,10 +17,33 @@ namespace GeekDesk.Control.Windows public partial class GlobalColorPickerWindow : IWindowCommon { PixelColorPickerWindow colorPickerWindow = null; + + class PrivateDataContext : INotifyPropertyChanged + { + private bool copyAnimation = false; + + public bool CopyAnimation + { + set + { + copyAnimation = value; + OnPropertyChanged("CopyAnimation"); + + } + get { return copyAnimation; } + } + + public event PropertyChangedEventHandler PropertyChanged; + private void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } public GlobalColorPickerWindow() { this.Topmost = true; InitializeComponent(); + this.DataContext = new PrivateDataContext(); } public void OnKeyDown(object sender, KeyEventArgs e) @@ -35,14 +61,26 @@ namespace GeekDesk.Control.Windows /// /// /// - private void MyColorPicker_Canceled(object sender, EventArgs e) + private void MyColorPicker_Canceled(object sender, RoutedEventArgs e) { MyColorPickerClose(); } - private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs e) + private void MyColorPicker_Confirmed(object sender, RoutedEventArgs e) { + CopySuccess.Visibility = Visibility.Visible; + PrivateDataContext pdc = this.DataContext as PrivateDataContext; + pdc.CopyAnimation = true; + new Thread(() => + { + Thread.Sleep(400); + this.Dispatcher.Invoke(() => + { + pdc.CopyAnimation = false; + CopySuccess.Visibility = Visibility.Collapsed; + }); + }).Start(); Color c = MyColorPicker.SelectedBrush.Color; - Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", c.A, c.R, c.G, c.B)); + Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B)); } /// @@ -148,5 +186,28 @@ namespace GeekDesk.Control.Windows { this.Close(); } + + private ICommand _hideCommand; + public ICommand HideCommand + { + get + { + if (_hideCommand == null) + { + _hideCommand = new RelayCommand( + p => + { + return true; + }, + p => + { + //CopySuccess.Visibility = Visibility.Collapsed; + }); + } + return _hideCommand; + } + } + + } }