コード例 #1
0
 public NotificationPopup(PopUpZone zone, bool waitForResult, CancellationToken cancellationToken, double secondsTillShow = 0.0)
 {
     this._checkTimer          = new System.Timers.Timer(1000.0);
     this._checkTimer.Elapsed += new ElapsedEventHandler(this._checkTimer_Elapsed);
     this._checkTimer.Enabled  = true;
     base.Closed += new EventHandler(this.NotificationPopup_Closed);
     if (cancellationToken.IsCancellationRequested)
     {
         this.Popup_HidePopUp(this, "CANCEL");
         return;
     }
     this.InitializeComponent();
     base.set_IsTitleVisible(true);
     this._cancellationToken   = cancellationToken;
     this._mZone               = zone;
     this._popupId             = Guid.NewGuid();
     this._popUp               = new PopUp();
     this._popUp.ShowPopUp    += new PopUp.ShowPopUpDelegate(this.Popup_ShowPopUp);
     this._popUp.HidePopUp    += new PopUp.HidePopUpDelegate(this.Popup_HidePopUp);
     this._popUp.SetTitle     += new PopUp.SetTitleDelegate(this.Popup_SetTitle);
     this._popUp.SetCloseable += new PopUp.SetCloseableDelegate(this.Popup_CanClose);
     this._popUp.SetSize      += new PopUp.SetSizeDelegate(this.Popup_SetSize);
     this._popUp.SetPosition  += new PopUp.SetWindowPositionDelegate(this.Popup_SetPosition);
     if (waitForResult)
     {
         this._mPopupClosedSource = new TaskCompletionSource <string>();
     }
     this._contentFrame = (Frame)ObjectHolder.MainForm.Template.FindName("PopUpFrame", ObjectHolder.MainForm);
     if (secondsTillShow == 0.0)
     {
         this.DoShowPopup();
         return;
     }
     System.Timers.Timer showTimer = new System.Timers.Timer
     {
         Interval = 1000.0 * secondsTillShow,
         Enabled  = true
     };
     SendOrPostCallback < > 9__1;
     showTimer.Elapsed += delegate(object sender, ElapsedEventArgs args)
     {
         SynchronizationContext arg_25_0 = ObjectHolder.MainContext;
         SendOrPostCallback     arg_25_1;
         if ((arg_25_1 = < > 9__1) == null)
         {
             arg_25_1 = (< > 9__1 = delegate(object o)
             {
                 showTimer.Enabled = false;
                 this.DoShowPopup();
             });
         }
         arg_25_0.Post(arg_25_1, null);
     };
 }
コード例 #2
0
 public static void ShowOnceTimed(PopUpZone zone, double secondsTillShow, CancellationToken cancellationToken)
 {
     new NotificationPopup(zone, false, cancellationToken, secondsTillShow);
 }
コード例 #3
0
 public static void ShowWithoutResult(PopUpZone zone)
 {
     new NotificationPopup(zone, false, CancellationToken.None, 0.0);
 }
コード例 #4
0
 public static void ShowOnceTimed(PopUpZone zone, double secondsTillShow)
 {
     NotificationPopup.ShowOnceTimed(zone, secondsTillShow, CancellationToken.None);
 }
コード例 #5
0
 public static Task <string> ShowWithResult(PopUpZone zone, CancellationToken cancellationToken)
 {
     return(new NotificationPopup(zone, true, cancellationToken, 0.0).GetCloseTask());
 }