86 lines
2.2 KiB
C#
86 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Specialized;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Microsoft.Win32;
|
|
using System.IO;
|
|
using System.Diagnostics;
|
|
using System.Web;
|
|
using System.Deployment.Application;
|
|
using System.Threading;
|
|
|
|
|
|
namespace RunUpdateExe
|
|
{
|
|
public partial class WaiteFrom : Form
|
|
{
|
|
|
|
//private MainForm _MainForm;
|
|
private string _WaiteMessage = "";
|
|
private static WaiteFrom frmWaite = null;
|
|
|
|
private WaiteFrom()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public static WaiteFrom GetInstance()
|
|
{
|
|
if (frmWaite == null || frmWaite.IsDisposed)
|
|
{
|
|
frmWaite = new WaiteFrom();
|
|
}
|
|
return frmWaite;
|
|
}
|
|
|
|
private void SetWaiteMessage()
|
|
{
|
|
WaiteMessage.Text = this._WaiteMessage;
|
|
if (WaiteMessage.Width >= 200)
|
|
{
|
|
this.Width = WaiteMessage.Width + 50;
|
|
}
|
|
this.BackgroundImageLayout = ImageLayout.Stretch;
|
|
WaiteMessage.Left = (this.Width - WaiteMessage.Width) / 2;
|
|
WaiteMessage.Visible = true;
|
|
this.BringToFront();
|
|
WaiteMessage.Refresh();
|
|
}
|
|
|
|
public void ShowMessage(string Message)
|
|
{
|
|
_WaiteMessage = Message;
|
|
progressWaite.Height = 0;
|
|
progressWaite.Value = 0;
|
|
SetWaiteMessage();
|
|
}
|
|
public void ShowMessage(string Message,UInt16 ProgressValue)
|
|
{
|
|
if (ProgressValue>100)
|
|
{
|
|
ProgressValue = 100;
|
|
}
|
|
_WaiteMessage = Message;
|
|
progressWaite.Height = 0;
|
|
progressWaite.Value = ProgressValue;
|
|
SetWaiteMessage();
|
|
}
|
|
private void WaiteFrom_Shown(object sender, EventArgs e)
|
|
{
|
|
//_MainForm = this.Owner as MainForm;
|
|
//_MainForm.Visible = false;
|
|
//SetWaiteMessage();
|
|
}
|
|
|
|
private void WaiteFrom_FormClosed(object sender, FormClosedEventArgs e)
|
|
{
|
|
//if (_MainForm != null)
|
|
// _MainForm.Visible = true;
|
|
}
|
|
|
|
}
|
|
} |