From 650fe9e42e3de66be29769da72cc755273246dd9 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期五, 12 九月 2025 16:23:04 +0800 Subject: [PATCH] 更新优化代码 --- DevApp/Gs.DevApp/UserControl/Toast.cs | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/Toast.cs b/DevApp/Gs.DevApp/UserControl/Toast.cs index f33d494..8f983db 100644 --- a/DevApp/Gs.DevApp/UserControl/Toast.cs +++ b/DevApp/Gs.DevApp/UserControl/Toast.cs @@ -1,28 +1,45 @@ 锘縰sing System; +using System.Configuration; using System.Drawing; using System.Windows.Forms; -namespace Gs.DevApp +namespace Gs.DevApp.UserControl { public partial class Toast : DevExpress.XtraEditors.XtraForm { private System.Windows.Forms.Timer tmr; private System.Windows.Forms.Timer tmr2; + /// <summary> /// /// </summary> /// <param name="it">1鎴愬姛锛�-1澶辫触</param> /// <param name="messageText"></param> - /// <param name="vanishingSeconds"></param> - public Toast(int it, string messageText, int vanishingSeconds = 2) + /// <param name="vanishingSeconds">鍔ㄧ敾寤堕暱鏃堕棿</param> + public Toast(int it, string messageText, int vanishingSeconds = 3) { InitializeComponent(); + try + { + string _vanishingSeconds = ConfigurationManager.AppSettings["ToastSeconds"]; + if (!string.IsNullOrEmpty(_vanishingSeconds)) + vanishingSeconds = int.Parse(_vanishingSeconds); + } + catch (Exception) + { + } System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Toast)); if (it > 0) - this.panel1.BackgroundImage = global::Gs.DevApp.Properties.Resources.ok123; + { + this.panel1.BackgroundImage = global::Gs.DevApp.Properties.Resources.ok10; + this.testo.Appearance.BackColor = System.Drawing.Color.SeaGreen; + } else - this.panel1.BackgroundImage = global::Gs.DevApp.Properties.Resources.error123; + { + this.panel1.BackgroundImage = global::Gs.DevApp.Properties.Resources.error10; + this.testo.Appearance.BackColor = System.Drawing.Color.Firebrick; + } double elapsedTime = 0; testo.Text = messageText; double vanishingMilliSeconds = vanishingSeconds * 1000; -- Gitblit v1.9.3