67 lines
1.9 KiB
C#
67 lines
1.9 KiB
C#
using TemuKJD.KJDForms.BaseForms;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace TemuKJD
|
|
{
|
|
public partial class InitForm : LRBaseForm
|
|
{
|
|
public InitForm()
|
|
{
|
|
InitializeComponent();
|
|
|
|
Load += InitForm_Load;
|
|
}
|
|
|
|
private void InitForm_Load(object sender, EventArgs e)
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
while (!Work.Initialization.IsCheckFilesFinish || !Program.IsInit)
|
|
{
|
|
Thread.Sleep(10);
|
|
|
|
Invoke(new Action(() =>
|
|
{
|
|
this.progressBarX1.Value = Work.Initialization.InitPercent;
|
|
this.progressBarX1.Maximum = 50;
|
|
}));
|
|
}
|
|
Invoke(new Action(() =>
|
|
{
|
|
try
|
|
{
|
|
if (!Work.Initialization.IsCheckFilesSuccesss)
|
|
{
|
|
BaseMsgForm.ShowError("文件初始化失败,请检查是否有程序占用并使用管理员权限运行本程序!");
|
|
Process.GetCurrentProcess().Kill();
|
|
}
|
|
|
|
this.Hide();
|
|
new MainForm().ShowDialog();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
BaseMsgForm.ShowError(ex.Message);
|
|
Process.GetCurrentProcess().Kill();
|
|
}
|
|
}));
|
|
});
|
|
}
|
|
|
|
private void InitForm_FormClosed(object sender, FormClosedEventArgs e)
|
|
{
|
|
Process.GetCurrentProcess().Kill();
|
|
}
|
|
}
|
|
}
|