protected void FlyInEnd() { state = NotifierStates.SHOWN; if (needOtherPosition) { AnimationFactory.FlyOutXYZ(this, targetPosition, FLY_ANIMATION_TIME, "flyOut" + (++animationCounter).ToString()); needOtherPosition = false; } }
/// <summary> /// Hides the popup immediately /// </summary> public new void Hide() { if (State != NotifierStates.Hidden) { AnimationTimer.Stop(); State = NotifierStates.Hidden; base.Hide(); } }
/// <summary> /// Initiate disappearing animation /// </summary> public void StartDisappearing() { int Helper = VisibleTime; VisibleTime = 1; State = ClamWinTrayNotifier.NotifierStates.Visible; this.OnTimer(this, new EventArgs()); VisibleTime = Helper; }
/// <summary> /// Shows notify /// </summary> /// <param name="AppearingTime">Appearing animation time (ms)</param> /// <param name="VisibleTime">Visible time (ms)</param> /// <param name="DisappearingTime">Disappearing animation time (ms)</param> public void ShowNotify(int AppearingTime, int VisibleTime, int DisappearingTime) { WorkAreaRectangle = Screen.GetWorkingArea(WorkAreaRectangle); if (InitialHeight == -1) { InitialHeight = this.Height; this.Region = CreateRoundedRectRegion(10); } this.VisibleTime = VisibleTime; int AppearingInterval = 0; if (AppearingTime != AppearingTimeInstant) { AppearingInterval = Math.Max(6 * AppearingTime / this.InitialHeight, 1); AppearingIncrement = 6; } if (DisappearingTime != DisappearingTimeInstant) { DisappearingInterval = Math.Max(6 * DisappearingTime / this.InitialHeight, 1); DisappearingIncrement = 6; } else { DisappearInstantly = true; } switch (State) { case NotifierStates.Hidden: { if (AppearingTime != AppearingTimeInstant) { State = NotifierStates.Appearing; AnimationTimer.Interval = AppearingInterval; AnimationTimer.Start(); Win32API.ShowWindow(this.Handle, Win32API.SW_SHOWNOACTIVATE); SetBounds(WorkAreaRectangle.Right - this.Width - 1, WorkAreaRectangle.Bottom - Delta, this.Width, 0); } else { Win32API.ShowWindow(this.Handle, Win32API.SW_SHOWNOACTIVATE); SetBounds(WorkAreaRectangle.Right - this.Width - 1, WorkAreaRectangle.Bottom - this.InitialHeight - Delta, this.Width, this.InitialHeight); State = NotifierStates.Visible; if (VisibleTime == VisibleTimeInfinite) { AnimationTimer.Interval = 1024 * 64; } else { AnimationTimer.Interval = VisibleTime; } AnimationTimer.Start(); Refresh(); } break; } case NotifierStates.Appearing: { Refresh(); break; } case NotifierStates.Visible: { AnimationTimer.Stop(); if (VisibleTime == VisibleTimeInfinite) { AnimationTimer.Interval = 1024 * 64; } else { AnimationTimer.Interval = VisibleTime; } AnimationTimer.Start(); Refresh(); break; } case NotifierStates.Disappearing: { AnimationTimer.Stop(); if (DisappearingTime != DisappearingTimeInstant) { State = NotifierStates.Appearing; SetBounds(WorkAreaRectangle.Right - this.Width - 1, WorkAreaRectangle.Bottom - this.InitialHeight - Delta, this.Width, this.InitialHeight); if (VisibleTime == VisibleTimeInfinite) { AnimationTimer.Interval = 1024 * 64; } else { AnimationTimer.Interval = VisibleTime; } AnimationTimer.Start(); Refresh(); } else { Hide(); } break; } } }
/// <summary> /// Timer on-tick handler /// </summary> /// <param name="obj"></param> /// <param name="ea"></param> protected void OnTimer(Object obj, EventArgs ea) { switch (State) { case NotifierStates.Hidden: { break; } case NotifierStates.Visible: { if (VisibleTime == VisibleTimeInfinite) { break; } AnimationTimer.Stop(); AnimationTimer.Interval = DisappearingInterval; State = NotifierStates.Disappearing; AnimationTimer.Start(); break; } case NotifierStates.Appearing: { if (this.Height < InitialHeight) { SetBounds(Left, Top - AppearingIncrement, Width, Height + AppearingIncrement); } else { AnimationTimer.Stop(); Height = InitialHeight; if (VisibleTime == VisibleTimeInfinite) { AnimationTimer.Interval = 1024 * 64; } else { AnimationTimer.Interval = VisibleTime; } State = NotifierStates.Visible; AnimationTimer.Start(); } break; } case NotifierStates.Disappearing: { if (DisappearInstantly) { Hide(); break; } if (Top < WorkAreaRectangle.Bottom - Delta) { SetBounds(Left, Top + DisappearingIncrement, Width, Height - DisappearingIncrement); } else { Hide(); } break; } } }
protected void FlyOutEnd() { state = NotifierStates.HIDE; notifierController.NotifierFlyOutEnd(this); }
protected void FlyOutBegin() { state = NotifierStates.FLYING_OUT; }
protected void FlyInBegin() { state = NotifierStates.FLYING_IN; }