diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2016-09-19 23:57:26 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2016-09-19 23:57:26 +0300 |
commit | 61e27e08130f495ab2118730c61b2008aa88f593 (patch) | |
tree | 7256a5cca42a83d5a1128bad88aba2673838b36a /TestApps | |
parent | 5711e59cbfd23e8b445f0298d62a1ff9d3bf934f (diff) |
Add Dialog.CommandActivated event
The new event can be used to handle command
responses and to cancel a dialog response (end loop)
by setting EventArgs.Handled.
Diffstat (limited to 'TestApps')
-rw-r--r-- | TestApps/Samples/Samples/Windows.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/TestApps/Samples/Samples/Windows.cs b/TestApps/Samples/Samples/Windows.cs index 4bae0f8f..dc236ae4 100644 --- a/TestApps/Samples/Samples/Windows.cs +++ b/TestApps/Samples/Samples/Windows.cs @@ -73,6 +73,12 @@ namespace Samples d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok)); d.Buttons.Add (new DialogButton (Command.Cancel)); d.Buttons.Add (new DialogButton (Command.Ok)); + + d.CommandActivated += (sender, e) => { + if (e.Command == custom) { + e.Handled = !MessageDialog.Confirm ("Really close?", Command.Close); + } + }; var r = d.Run (this.ParentWindow); db.Label = "Result: " + (r != null ? r.Label : "(Closed)"); |