Esempio n. 1
0
        public void FilesInfoOnUpdatedOperation(UpdatedOperationEventArgs updatedOperationEventArgs)
        {
            this.SafeInvoke(form => {
                if (_currentOperation == (int)updatedOperationEventArgs.CurrentOperation)
                {
                    return;
                }

                // status text, take the last flag found
                foreach (var name in Enum.GetNames(typeof(CurrentOperation)))
                {
                    CurrentOperation flag = (CurrentOperation)Enum.Parse(typeof(CurrentOperation), name);
                    if (updatedOperationEventArgs.CurrentOperation.HasFlag(flag))
                    {
                        lbStatus.Text = flag.GetAttribute <CurrentOperationAttr>().Name;
                    }
                }

                // blink back color
                lbStatus.UseCustomBackColor = true;
                if (updatedOperationEventArgs.CurrentOperation > 0)
                {
                    Transition.run(lbStatus, "BackColor", ThemeManager.Current.FormBack, ThemeManager.Current.AccentColor, new TransitionType_Flash(3, 400), (o, args) => {
                        lbStatus.BackColor = ThemeManager.Current.AccentColor;
                        lbStatus.Invalidate();
                    });
                }
                else
                {
                    Transition.run(lbStatus, "BackColor", ThemeManager.Current.AccentColor, ThemeManager.Current.FormBack, new TransitionType_Flash(3, 400), (o, args) => {
                        lbStatus.UseCustomBackColor = false;
                        lbStatus.Invalidate();
                    });
                }

                _currentOperation = (int)updatedOperationEventArgs.CurrentOperation;

                if (btStopExecution.Visible != (_currentOperation >= (int)CurrentOperation.Prolint))
                {
                    btStopExecution.Visible = (_currentOperation >= (int)CurrentOperation.Prolint);
                    lbStatus.Width          = lbStatus.Width + (btStopExecution.Visible ? -1 : 1) * btStopExecution.Width;
                }

                if (btBringProcessToFront.Visible != updatedOperationEventArgs.CurrentOperation.HasFlag(CurrentOperation.Run))
                {
                    btBringProcessToFront.Visible = updatedOperationEventArgs.CurrentOperation.HasFlag(CurrentOperation.Run);
                    lbStatus.Width = lbStatus.Width + (btBringProcessToFront.Visible ? -1 : 1) * btBringProcessToFront.Width;
                }
            });
        }