Exemplo n.º 1
0
        public IDisposable SusupendNotification(bool notifyReset, bool checkRealChanges)
        {
            var cache = checkRealChanges ? this.ToArray() : null;

            return(FinallyBlock.Create(this.NotifyChanges = false, _ =>
            {
                this.NotifyChanges = true;

                if (notifyReset && (!checkRealChanges || !this.SequenceEqual(cache)))
                {
                    dispatcher.Invoke((Action <NotifyCollectionChangedEventArgs>)OnCollectionChanged,
                                      new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
                }
            }));
        }
Exemplo n.º 2
0
        void endNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            if (!endChanging)
            {
                using (FinallyBlock.Create(endChanging = true, _ => endChanging = false))
                {
                    this.EndValue = sender == endNumericUpDown ? (float)endNumericUpDown.Value : endTrackBar.Value / 100f;

                    if (EndValueChanged != null)
                    {
                        EndValueChanged(this, EventArgs.Empty);
                    }
                }
            }
        }
Exemplo n.º 3
0
        void beginNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            if (!beginChanging)
            {
                using (FinallyBlock.Create(beginChanging = true, _ => beginChanging = false))
                {
                    this.BeginValue = sender == beginNumericUpDown ? (float)beginNumericUpDown.Value : beginTrackBar.Value / 100f;

                    if (BeginValueChanged != null)
                    {
                        BeginValueChanged(this, EventArgs.Empty);
                    }
                }
            }
        }
Exemplo n.º 4
0
        void UpdateUIValues()
        {
            if (activePanel.Enabled = this.Caption != null)
            {
                beginLabel.Text = this.Caption.StartFrame.ToString("0.00");
                endLabel.Text   = (this.Caption.StartFrame + this.Caption.DurationFrame).ToString("0.00");
                timelineControl.CurrentAmount = (float)((this.CurrentFrame - this.Caption.StartFrame) / this.Caption.DurationFrame);
            }

            if (updates != null)
            {
                updates();
            }

            updates = null;

            if (this.AnimationData != null)
            {
                timelineControl.Amounts = this.AnimationData.X.Frames.Select(_ => _.FrameAmount).ToArray();
            }
            else
            {
                timelineControl.Amounts = null;
            }

            timelineControl.TryUpdate();

            if (parametersPanel.Enabled = this.Caption != null && this.AnimationData != null && this.IsAnimationEnabled)
            {
                if (!changing)
                {
                    using (FinallyBlock.Create(changing = true, _ => changing = false))
                    {
                        GetValueSet(xEntry, this.AnimationData.X);
                        GetValueSet(yEntry, this.AnimationData.Y);
                        GetValueSet(alphaEntry, this.AnimationData.Alpha);
                        GetValueSet(rotationEntry, this.AnimationData.Rotation);
                        GetValueSet(fontSizeEntry, this.AnimationData.FontSize);
                        GetValueSet(lineSpacingEntry, this.AnimationData.LineSpacing);
                        GetValueSet(letterSpacingEntry, this.AnimationData.LetterSpacing);
                        GetValueSet(shadowDistanceEntry, this.AnimationData.ShadowDistance);
                    }
                }
            }
        }
Exemplo n.º 5
0
 public void SetNewValues()
 {
     if (!changing)
     {
         using (FinallyBlock.Create(changing = true, _ => changing = false))
             if (this.Caption != null && this.AnimationData != null)
             {
                 SetValueSet(xEntry, this.AnimationData.X);
                 SetValueSet(yEntry, this.AnimationData.Y);
                 SetValueSet(alphaEntry, this.AnimationData.Alpha);
                 SetValueSet(rotationEntry, this.AnimationData.Rotation);
                 SetValueSet(fontSizeEntry, this.AnimationData.FontSize);
                 SetValueSet(lineSpacingEntry, this.AnimationData.LineSpacing);
                 SetValueSet(letterSpacingEntry, this.AnimationData.LetterSpacing);
                 SetValueSet(shadowDistanceEntry, this.AnimationData.ShadowDistance);
             }
     }
 }
Exemplo n.º 6
0
 protected static IDisposable AcquireUpgradableReaderLock(ReaderWriterLockSlim self)
 {
     return(FinallyBlock.Create(() => self.EnterUpgradeableReadLock(), () => self.ExitUpgradeableReadLock()));
 }