private void Sample5_DialogHost_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs) { Console.WriteLine("SAMPLE 5: Closing dialog with parameter: " + (eventArgs.Parameter ?? "")); //you can cancel the dialog close: //eventArgs.Cancel(); if (!Equals(eventArgs.Parameter, true)) { return; } if (!string.IsNullOrWhiteSpace(AnimalTextBox.Text)) { AnimalListBox.Items.Add(AnimalTextBox.Text.Trim()); } }
private void ExtendedClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == false) { return; } //OK, lets cancel the close... eventArgs.Cancel(); //...now, lets update the "session" with some new content! eventArgs.Session.UpdateContent(new SampleProgressDialog()); //note, you can also grab the session when the dialog opens via the DialogOpenedEventHandler //lets run a fake operation for 3 seconds then close this baby. Task.Delay(TimeSpan.FromSeconds(3)) .ContinueWith((t, _) => eventArgs.Session.Close(false), null, TaskScheduler.FromCurrentSynchronizationContext()); }
private void Sample2_DialogHost_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs) { Console.WriteLine("SAMPLE 2: Closing dialog with parameter: " + (eventArgs.Parameter ?? "")); }
private void ClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { Console.WriteLine("You can intercept the closing event, and cancel here."); }
protected void OnDialogClosing(DialogClosingEventArgs eventArgs) { RaiseEvent(eventArgs); }