예제 #1
0
        private void MouseInfoProvider_OnMouseDown(object sender, System.Drawing.Point p)
        {
            if (ColorString != null)
            {
                // nasty hack - sometimes clipboard can be in use and it will raise and exception
                for (int i = 0; i < 10; i++)
                {
                    try
                    {
                        Clipboard.SetText(ColorString.ToLowerInvariant());
                        break;
                    }
                    catch (COMException ex)
                    {
                        const uint CLIPBRD_E_CANT_OPEN = 0x800401D0;
                        if ((uint)ex.ErrorCode != CLIPBRD_E_CANT_OPEN)
                        {
                            Logger.LogError("Failed to set text into clipboard", ex);
                        }
                    }
                    System.Threading.Thread.Sleep(10);
                }
            }

            _appStateHandler.HideColorPicker();
        }