Common.Forms.ModelessForm modifications.

This commit is contained in:
Milan Hanajik 2023-11-28 14:27:21 +01:00
parent 2c6e5d3367
commit 401828d4c6

View File

@ -1,4 +1,7 @@
using System;
///
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
@ -53,20 +56,20 @@ namespace Common.Forms
public event EventHandler<MessageEventArgs> UpdateMessageHandler;
void OnUpdateMessage(object sender, MessageEventArgs args)
{
if (args.Message != null) label1.Text = args.Message;
if (args != null && args.Message != null) label1.Text = args.Message;
}
/// <summary>
/// Called from the state machine when an operation forces a modeless dialog close.
/// </summary>
public static void CloseForm()
public void CloseForm()
{
if (CloseFormHandler == null) return;
try { CloseFormHandler(null, null); }
catch (Exception) { }
}
static public event EventHandler<EventArgs> CloseFormHandler;
public event EventHandler<EventArgs> CloseFormHandler;
void OnCloseForm(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;