天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

84 lines
2.4 KiB

using System;
using System.ComponentModel;
using System.Windows.Forms;
using Model;
using QMAPP.WinForm.Common;
namespace QMAPP.WinForm
{
public partial class FormSplash : Form
{
private BackgroundWorker _bgw;
public FormSplash()
{
InitializeComponent();
_bgw = new BackgroundWorker
{
WorkerReportsProgress = true,
};
_bgw.DoWork += _bgw_DoWork;
_bgw.RunWorkerCompleted += _bgw_RunWorkerCompleted;
_bgw.ProgressChanged += _bgw_ProgressChanged;
}
private void _bgw_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
lblLog.Text = e.UserState.ToString();
}
private void _bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
DialogResult = DialogResult.OK;
}
private void _bgw_DoWork(object sender, DoWorkEventArgs e)
{
try
{
// GlobalConfig.MainSetting = GlobalConfig.GetConfigValues<MainSetting>(GlobalConfig.MainSettingFileName);
_bgw.ReportProgress(25,"载入配置信息...");
global.UpdateSetting = GlobalConfig.GetConfigValues<UpdateSetting>(GlobalConfig.UpdateFileName);
_bgw.ReportProgress(75, "查找程序更新...");
var serverUrl = $"http://{global.UpdateSetting.更新服务器地址}:{global.UpdateSetting.更新服务器端口}/";
var updateXmlFileName = global.UpdateSetting.;
var updater = new AutoUpdater();
if (updater.CheckUpdateLoad(serverUrl, updateXmlFileName))
{
Application.Exit();
}
_bgw.ReportProgress(100, "载入基础数据...");
_bgw.ReportProgress(100, "开始启动程序...");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void FormLogin_Load(object sender, EventArgs e)
{
}
private void FormSplash_Shown(object sender, EventArgs e)
{
_bgw.RunWorkerAsync();
}
private void lbClose_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Close();
}
}
}