//----------------------------------------------------------------------------------- public void Init(ShowCallback callback) { if (callback != null) { m_callback += callback; } //Advertisement.Initialize() }
public void ShowForm() { try { if (this.InvokeRequired) { var d = new ShowCallback(ShowForm); this.Invoke(d, new object[] { }); } else { this.Show(); } } catch (Exception ex) { } }
public void Show(bool show, string title, string desc) { if (this.InvokeRequired) { ShowCallback d = new ShowCallback(Show); this.Invoke(d, new object[] { show, title, desc }); } else { var loc = NyaaSnapMain.self.Location; var bounds = NyaaSnapMain.self.Bounds; var thisBounds = this.Bounds; this.Location = new Point(loc.X + ((bounds.Width / 2)) - (thisBounds.Width / 2), loc.Y + ((bounds.Height / 2) - (thisBounds.Height / 2))); if (show) this.Show(); else this.Hide(); this.Text = title; this.LB_Desc.Text = desc; } }
/// <summary> /// Displays the popup for a certain amount of time /// </summary> /// <param name="strTitle">The string which will be shown as the title of the popup</param> /// <param name="strContent">The string which will be shown as the content of the popup</param> /// <param name="nTimeToShow">Duration of the showing animation (in milliseconds)</param> /// <param name="nTimeToStay">Duration of the visible state before collapsing (in milliseconds)</param> /// <param name="nTimeToHide">Duration of the hiding animation (in milliseconds)</param> /// <returns>Nothing</returns> public void Show(string strTitle, string strContent, int nTimeToShow, int nTimeToStay, int nTimeToHide) { if (this.InvokeRequired) { showCallback = new ShowCallback(Show); this.Invoke(showCallback, strTitle, strContent, nTimeToShow, nTimeToStay, nTimeToHide); } else { WorkAreaRectangle = Screen.GetWorkingArea(WorkAreaRectangle); titleText = strTitle; contentText = strContent; nVisibleEvents = nTimeToStay; CalculateMouseRectangles(); // We calculate the pixel increment and the timer value for the showing animation int nEvents; if (nTimeToShow > 10) { nEvents = Math.Min((nTimeToShow / 10), BackgroundBitmap.Height); nShowEvents = nTimeToShow / nEvents; nIncrementShow = BackgroundBitmap.Height / nEvents; } else { nShowEvents = 10; nIncrementShow = BackgroundBitmap.Height; } // We calculate the pixel increment and the timer value for the hiding animation if (nTimeToHide > 10) { nEvents = Math.Min((nTimeToHide / 10), BackgroundBitmap.Height); nHideEvents = nTimeToHide / nEvents; nIncrementHide = BackgroundBitmap.Height / nEvents; } else { nHideEvents = 10; nIncrementHide = BackgroundBitmap.Height; } switch (taskbarState) { case TaskbarStates.hidden: taskbarState = TaskbarStates.appearing; SetBounds(WorkAreaRectangle.Right - BackgroundBitmap.Width - 17, WorkAreaRectangle.Bottom - 1, BackgroundBitmap.Width, 0); timer.Interval = nShowEvents; timer.Start(); // We Show the popup without stealing focus ShowWindow(this.Handle, 4); break; case TaskbarStates.appearing: Refresh(); break; case TaskbarStates.visible: timer.Stop(); timer.Interval = nVisibleEvents; timer.Start(); Refresh(); break; case TaskbarStates.disappearing: timer.Stop(); taskbarState = TaskbarStates.visible; SetBounds(WorkAreaRectangle.Right - BackgroundBitmap.Width - 17, WorkAreaRectangle.Bottom - BackgroundBitmap.Height - 1, BackgroundBitmap.Width, BackgroundBitmap.Height); timer.Interval = nVisibleEvents; timer.Start(); Refresh(); break; } } }
private void ShowInThread(bool visible) { ShowCallback callback = new ShowCallback(ShowHide); this.Invoke(callback, new object[] { visible }); }