示例#1
0
        public void SetColor(int?type)
        {
            if (type.HasValue)
            {
                var info = ColorInfos.FirstOrDefault(x => x.Type == type.Value);

                if (info != null)
                {
                    selection = Convert.ToInt32(type);

                    if (text != null)
                    {
                        component.color = info.Color;
                    }
                }
                else
                {
                    selection = null;
                }
            }
            else
            {
                selection = null;
            }
        }
        private async void CaptureCommandHandler(bool notify)
        {
            if (SelectedScreenInfo != null)
            {
                try
                {
                    IsBusy = true;

                    SelectedScreenInfo.CaptureProcess(ShowTaskBar);

                    _lastOperateTokenSource?.Cancel();
                    _lastOperateTokenSource = new CancellationTokenSource();

                    ColorInfos = new List <ColorInfo>();
                    ColorInfos = (await SelectedScreenInfo.ScanAllUniqueColors(_lastOperateTokenSource.Token)).ToList();
                }
                catch (OperationCanceledException canceledException)
                {
                    Debug.WriteLine(canceledException);
                }
                finally
                {
                    IsBusy = false;
                }
            }

            if (notify)
            {
                await RaisePropertyChanged(nameof(SelectedScreenInfo));
            }

            ColorInfosChangedEvent?.Invoke(this, ColorInfos.ToList());
        }
示例#3
0
        public void SetColor(int?type)
        {
            if (type.HasValue)
            {
                var info = ColorInfos.FirstOrDefault(x => x.Type == type.Value);

                if (info != null)
                {
                    selection = Convert.ToInt32(type);

                    if (text != null)
                    {
                        component.color = info.Color;
                    }

                    //====== Shadow ======

                    if (Shadow != null)
                    {
                        Shadow.enabled = info.ShadowColor.HasValue;

                        if (info.ShadowColor.HasValue)
                        {
                            Shadow.SetColor(info.ShadowColor.Value);
                        }
                    }

                    //====== Drop Shadow ======

                    if (RichShadow != null)
                    {
                        RichShadow.enabled = info.ShadowColor.HasValue;

                        if (info.ShadowColor.HasValue)
                        {
                            RichShadow.effectColor = info.ShadowColor.Value;
                        }
                    }

                    //====== Outline ======

                    if (Outline != null)
                    {
                        Outline.enabled = info.OutlineColor.HasValue;

                        if (info.OutlineColor.HasValue)
                        {
                            Outline.SetColor(info.OutlineColor.Value);
                        }
                    }

                    //====== RichOutline ======

                    if (RichOutline != null)
                    {
                        RichOutline.enabled = info.OutlineColor.HasValue;

                        if (info.OutlineColor.HasValue)
                        {
                            RichOutline.effectColor = info.OutlineColor.Value;
                        }
                    }
                }
                else
                {
                    selection = null;
                }
            }
            else
            {
                selection = null;
            }
        }