From 815f13f9113c151e8a862e6fe90bbd05579a57db Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Fri, 5 Jul 2024 07:58:41 +0000 Subject: [PATCH] Pilz.UI.Telerik aktualisieren --- Pilz.UI.Telerik.md | 96 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 4 deletions(-) diff --git a/Pilz.UI.Telerik.md b/Pilz.UI.Telerik.md index 27d0e8c..be17160 100644 --- a/Pilz.UI.Telerik.md +++ b/Pilz.UI.Telerik.md @@ -49,10 +49,98 @@ private void RadButton_Cancel_Click(object sender, EventArgs e) } ``` -## Using flyouts +## Use the UI as flyout -## Using dialogs +Use the static `RadFlyoutBase.Show<>()` method for opening a flyout. This uses `RadFlyout` as base and will create a new instance of the provided type. -# SymbolFactory +```csharp +RadFlyoutBase.Show(this, strTitle, svgSymbol); +``` -tba \ No newline at end of file +### Events for prepair & result callback + +There are some static events you can use to initialize a flyout or get back the some values. + +```csharp +public AccountManagerPage() +{ + RadFlyoutBase.FlyoutCreated += RadFlyoutBase_FlyoutCreated; + RadFlyoutBase.FlyoutClosed += RadFlyoutBase_FlyoutClosed; +} + +private void RadFlyoutBase_FlyoutCreated(FlyoutCreatedEventArgs e) +{ + if (e.Parent == this && e.Content is MyFlyout flyout && flyout.Result == DialogResult.OK) + { + // ... + } +} + +private void RadFlyoutBase_FlyoutClosed(FlyoutClosedEventArgs e) +{ + if (e.Parent == this && e.Content is MyFlyout flyout && flyout.Result == DialogResult.OK) + { + // ... + } +} +``` + +Ensure you unregister your handlers from the event on Dispose or deconstructor! + +```csharp +~AccountManagerPage() +{ + RadFlyoutBase.FlyoutCreated += RadFlyoutBase_FlyoutCreated; + RadFlyoutBase.FlyoutClosed += RadFlyoutBase_FlyoutClosed; +} +``` + +## Use the UI as dialog + +Use the static `RadDialogBase.Show<>()` or `RadDialogBase.Show()` methods to open a dialog. This will use the provided istance or create a new one of the provided type. + +```csharp +var flyout = RadDialogBase.Show(radListView_Accounts, strTitle, svgSymbol); +if (flyout.Result == DialogResult.OK) +{ + // ... +} +``` + +### Events for prepair & result callback + +There are some static events you can use to initialize a flyout or get back the some values. + +```csharp +public AccountManagerPage() +{ + RadDialogBase.DialogLoading += RadDialogBase_DialogLoading; + RadDialogBase.DialogClosed += RadDialogBase_DialogClosed; +} + +private void RadDialogBase_DialogLoading(DialogLoadingEventArgs e) +{ + if (RadFlyoutBase.ParentContext == this && e.Content is MyFlyout flyout) + { + // ... + } +} + +private void RadDialogBase_DialogClosed(DialogClosedEventArgs e) +{ + if (RadFlyoutBase.ParentContext == this && e.Content is MyFlyout flyout && flyout.Result == DialogResult.OK) + { + // ... + } +} +``` + +Ensure you unregister your handlers from the event on Dispose or deconstructor! + +```csharp +~AccountManagerPage() +{ + RadDialogBase.DialogLoading -= RadDialogBase_DialogLoading; + RadDialogBase.DialogClosed -= RadDialogBase_DialogClosed; +} +```