/// <summary> /// Starts the effect with the given arguments /// </summary> /// <param name="arguments">The effect arguments containing information about the preview form and the affected controls</param> public void Start(IEffect.Arguments arguments) { foreach (var effect in Effects) { effect.Start(arguments); } }
/// <summary> /// Starts the effect with the given arguments /// </summary> /// <param name="arguments">The effect arguments containing information about the preview form and the affected controls</param> public override void Start(IEffect.Arguments arguments) { var screenLocationOfSourceControl = arguments.SourceControl.PointToScreen(Point.Empty); var centerOfSourceControl = new Point( screenLocationOfSourceControl.X + (arguments.SourceControl.Width / 2), screenLocationOfSourceControl.Y + (arguments.SourceControl.Height / 2)); var previewTransitionLocation = new Point( centerOfSourceControl.X - (arguments.PreviewForm.Width / 2), centerOfSourceControl.Y - (arguments.PreviewForm.Height / 2)); var transition = Transition .With(arguments.PreviewForm, nameof(arguments.PreviewForm.Left), previewTransitionLocation.X) .With(arguments.PreviewForm, nameof(arguments.PreviewForm.Top), previewTransitionLocation.Y) .With(arguments.PreviewForm, nameof(arguments.PreviewForm.Opacity), 0d) .Build(new Deceleration(500)); void selfRemovingHandler(object _, Transition.Args __) { transition.TransitionCompletedEvent -= selfRemovingHandler; arguments.PreviewForm.BeginInvoke((Action)(() => base.ClosePreview(arguments))); } transition.TransitionCompletedEvent += selfRemovingHandler; transition.Run(); }
/// <summary> /// Starts the effect with the given arguments /// </summary> /// <param name="arguments">The effect arguments containing information about the preview form and the affected controls</param> public override void Start(IEffect.Arguments arguments) { if (arguments?.TargetControl is null) { throw new ArgumentNullException($"Target control cannot be null for this {nameof(MorphToTargetEffect)}"); } var screenLocationOfSourceControl = arguments.TargetControl.PointToScreen(Point.Empty); var centerOfTargetControl = new Point( screenLocationOfSourceControl.X + (arguments.TargetControl.Width / 2), screenLocationOfSourceControl.Y + (arguments.TargetControl.Height / 2)); var previewTransitionLocation = new Point( centerOfTargetControl.X - (arguments.PreviewForm.Width / 2), centerOfTargetControl.Y - (arguments.PreviewForm.Height / 2)); var transition = Transition .With(arguments.PreviewForm, nameof(arguments.PreviewForm.Left), previewTransitionLocation.X) .With(arguments.PreviewForm, nameof(arguments.PreviewForm.Top), previewTransitionLocation.Y) .With(arguments.PreviewForm, nameof(arguments.PreviewForm.Opacity), 0d) .Build(new Deceleration(750)); void selfRemovingHandler(object _, EventArgs __) { transition.TransitionCompleted -= selfRemovingHandler; arguments.PreviewForm.BeginInvoke((Action)(() => base.ClosePreview(arguments))); } transition.TransitionCompleted += selfRemovingHandler; transition.Run(); }
/// <summary> /// Starts the effect with the given arguments /// </summary> /// <param name="arguments">The effect arguments containing information about the preview form and the affected controls</param> public override void Start(IEffect.Arguments arguments) { arguments.PreviewForm.Opacity = 0d; arguments.PreviewForm.Show(); Transition .With(arguments.PreviewForm, nameof(arguments.PreviewForm.Opacity), 1d) .Decelerate(TimeSpan.FromMilliseconds(500)); }
public void Start(IEffect.Arguments arguments) { if (arguments?.TargetControl is null) { throw new ArgumentNullException($"Target control cannot be null for this {nameof(FlashSourceControlEffect)}"); } Transition .With(arguments.TargetControl, nameof(arguments.TargetControl.BackColor), Color.LightSeaGreen) .Bounce(TimeSpan.FromSeconds(1.2)); }
/// <summary> /// Starts the effect with the given arguments /// </summary> /// <param name="arguments">The effect arguments containing information about the preview form and the affected controls</param> public override void Start(IEffect.Arguments arguments) { var transition = Transition .With(arguments.PreviewForm, nameof(arguments.PreviewForm.Opacity), 0d) .Build(new Deceleration(500)); void selfRemovingHandler(object _, Transition.Args __) { transition.TransitionCompletedEvent -= selfRemovingHandler; arguments.PreviewForm.BeginInvoke((Action)(() => base.ClosePreview(arguments))); } transition.TransitionCompletedEvent += selfRemovingHandler; transition.Run(); }
/// <summary> /// Closes and disposes the preview form /// </summary> /// <param name="arguments">The effect arguments containing information about the preview form and the affected controls</param> protected virtual void ClosePreview(IEffect.Arguments arguments) { arguments.PreviewForm.Close(); arguments.PreviewForm.Dispose(); }
/// <summary> /// Starts the effect with the given arguments /// </summary> /// <param name="arguments">The effect arguments containing information about the preview form and the affected controls</param> public virtual void Start(IEffect.Arguments arguments) { ClosePreview(arguments); }
/// <summary> /// Starts the effect with the given arguments /// </summary> /// <param name="arguments">The effect arguments containing information about the preview form and the affected controls</param> public virtual void Start(IEffect.Arguments arguments) { arguments.PreviewForm.Show(); }