protected virtual void OnAnimationCompleted(AnimationCompletedEventArg e) { if (this.AnimationCompleted != null) { this.AnimationCompleted(this, e); } }
public void ClearQueue() { List <QueueItem> list = null; lock (this.queue) { list = new List <QueueItem>(this.queue); this.queue.Clear(); } using (List <QueueItem> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { MethodInvoker method = null; QueueItem item = enumerator.Current; if (item.control != null) { if (method == null) { method = delegate { switch (item.mode) { case AnimateMode.Show: item.control.Visible = true; return; case AnimateMode.Hide: item.control.Visible = false; return; } }; } item.control.BeginInvoke(method); } AnimationCompletedEventArg e = new AnimationCompletedEventArg { Animation = item.animation, Control = item.control, Mode = item.mode }; this.OnAnimationCompleted(e); } } if (list.Count > 0) { this.OnAllAnimationsCompleted(); } }
private void OnCompleted(QueueItem item) { if (item.controller != null) { item.controller.Dispose(); } lock (this.queue) { this.queue.Remove(item); } AnimationCompletedEventArg e = new AnimationCompletedEventArg { Animation = item.animation, Control = item.control, Mode = item.mode }; this.OnAnimationCompleted(e); }
public void ClearQueue() { List<QueueItem> list = null; lock (this.queue) { list = new List<QueueItem>(this.queue); this.queue.Clear(); } using (List<QueueItem>.Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { MethodInvoker method = null; QueueItem item = enumerator.Current; if (item.control != null) { if (method == null) { method = delegate { switch (item.mode) { case AnimateMode.Show: item.control.Visible = true; return; case AnimateMode.Hide: item.control.Visible = false; return; } }; } item.control.BeginInvoke(method); } AnimationCompletedEventArg e = new AnimationCompletedEventArg { Animation = item.animation, Control = item.control, Mode = item.mode }; this.OnAnimationCompleted(e); } } if (list.Count > 0) { this.OnAllAnimationsCompleted(); } }