diff --git a/Apewer.Windows/WinForm/Tray.cs b/Apewer.Windows/WinForm/Tray.cs index 8546e43..4a303af 100644 --- a/Apewer.Windows/WinForm/Tray.cs +++ b/Apewer.Windows/WinForm/Tray.cs @@ -76,7 +76,12 @@ namespace Apewer.WinForm } /// 获取 EXE 文件的图标。 - public static Icon GetExeIcon() => System.Drawing.Icon.ExtractAssociatedIcon(RuntimeUtility.ExecutablePath); + public static Icon GetExeIcon() + { + var exePath = RuntimeUtility.ExecutablePath; + var exeIcon = System.Drawing.Icon.ExtractAssociatedIcon(exePath); + return exeIcon; + } /// 获取 EXE 文件的图标。 /// @@ -258,6 +263,14 @@ namespace Apewer.WinForm action.Invoke(); } + /// + public void FormBeginInvoke(Action action) + { + if (action == null) return; + if (_form == null) return; + _form.BeginInvoke(action); + } + /// 显示对话框,并获取结果。 /// public DialogResult ShowDialog(CommonDialog dialog) @@ -287,6 +300,13 @@ namespace Apewer.WinForm Application.Exit(); } + /// + public void Exit(Action customExit) + { + if (!_disposed) Dispose(); + customExit.Invoke(); + } + #endregion #region run