add Pilz.UI.Telerik & Pilz.UI.Telerik.SymbolFactory
This commit is contained in:
86
Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.cs
Normal file
86
Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using Pilz.UI.Telerik;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
using Telerik.WinControls.UI.SplashScreen;
|
||||
using static Telerik.WinControls.UI.PopupEditorNotificationData;
|
||||
|
||||
namespace Pilz.UI.Telerik.Dialogs
|
||||
{
|
||||
public partial class FlyoutDialogBase : UserControl
|
||||
{
|
||||
public static RadSvgImage? CancelSvg { get; set; } = null;
|
||||
public static RadSvgImage? ConfirmSvg { get; set; } = null;
|
||||
|
||||
public DialogResult Result { get; protected set; }
|
||||
|
||||
protected bool ActionPanelVisible
|
||||
{
|
||||
get => panel_ActionButtons.Visible;
|
||||
set => panel_ActionButtons.Visible = value;
|
||||
}
|
||||
|
||||
protected bool CancelButtonEnable
|
||||
{
|
||||
get => radButton_Cancel.Enabled;
|
||||
set => radButton_Cancel.Enabled = value;
|
||||
}
|
||||
|
||||
protected bool ConfirmButtonEnable
|
||||
{
|
||||
get => radButton_Confirm.Enabled;
|
||||
set => radButton_Confirm.Enabled = value;
|
||||
}
|
||||
|
||||
protected FlyoutDialogBase()
|
||||
{
|
||||
InitializeComponent();
|
||||
ParentChanged += FlyoutDialogBase_ParentChanged;
|
||||
|
||||
// SVG Symbols
|
||||
radButton_Cancel.SvgImage = CancelSvg;
|
||||
radButton_Confirm.SvgImage = ConfirmSvg;
|
||||
}
|
||||
|
||||
private void FlyoutDialogBase_ParentChanged(object? sender, EventArgs e)
|
||||
{
|
||||
var frm = FindForm();
|
||||
if (frm != null)
|
||||
frm.AcceptButton = radButton_Confirm;
|
||||
}
|
||||
|
||||
protected void Close(DialogResult result)
|
||||
{
|
||||
Result = result;
|
||||
|
||||
if (FindForm() is DialogBaseForm dialogForm)
|
||||
dialogForm.Close();
|
||||
else
|
||||
CloseFlyout();
|
||||
}
|
||||
|
||||
private void RadButton_Confirm_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ValidateOK())
|
||||
Close(DialogResult.OK);
|
||||
}
|
||||
|
||||
private void RadButton_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close(DialogResult.Cancel);
|
||||
}
|
||||
|
||||
protected virtual bool ValidateOK()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user