Esempio n. 1
0
    void SponsorReasonConfirmation(object sender, ReasonConfirmationArgs e)
    {
      DisableRemarkAlertReasonPopup.Show();

      //nugget: idea from here: http://www.deanchalk.me.uk/post/WPF-Modal-Controls-Via-Dispatcher (Army firewall blocks this site)
      //nugget: this is really cool because it maintains the synchronous nature of this call stack, returning the result to the model layer after the psuedo modal popup, even though the popup is actually acting on it's own asynch event handler!!
      _disableRemarkAlertReasonPopupDispatcherFrame = new System.Windows.Threading.DispatcherFrame(); //nugget:
      System.Windows.Threading.Dispatcher.PushFrame(_disableRemarkAlertReasonPopupDispatcherFrame); //nugget: blocks gui message pump & createst nested pump, making this a blocking call 

      e.Accept = DisableRemarkAlertReasonPopup.IsOK;
      e.Reason = DisableRemarkAlertReasonPopup.ReasonText;
    }
Esempio n. 2
0
    void SponsorRemarksColumnChanging(object sender, DataColumnChangeEventArgs e)
    {
      if (!IsMyRow(e.Row)) return;

      if (e.Column.ColumnName == "Alert" && (bool)e.ProposedValue == false)
      {
        if (ReasonConfirmation != null)
        {
          var args = new ReasonConfirmationArgs();
          ReasonConfirmation(null, args);
          if (args.Accept)
          {
            e.Row.SetReadonlyField("AlertResolved", args.Reason);
          }
          else e.ProposedValue = e.Row[e.Column]; //cancel by putting the current value into proposed (throwing an exception gets messy to handle at the UI)
        }
      }
    }