예제 #1
0
        public FrmMain()
        {
            InitializeComponent();
            CancellationTokenSource cts = new CancellationTokenSource();

            new Task(() => {
                FrmWaiting frmw = new FrmWaiting();
                frmw.setTitle("正在初始化主程序...");
                frmw.Show();
                while (!cts.Token.IsCancellationRequested)
                {
                    Application.DoEvents();
                    Thread.Sleep(50);
                }
                frmw.Close();
                Activate();
            }, cts.Token).Start();
            try {
                //Your code here
                CheckForIllegalCrossThreadCalls = false;
                mteMain      = new UserWidget.MessageTreeEdit();
                mteMain.Dock = DockStyle.Fill;
                panelMessageEditor.Controls.Add(mteMain);
                frmRX = new FrmSignalReceive();
                Logger.logUDF("程序库已经成功的加载了", "Main");
                Thread.Sleep(5500);//等待静态类的加载
            } catch (Exception ex) {
                Logger.logError(ex);
            } finally {
                cts.Cancel();//不论如何最后关闭导入进度条
            }
        }
예제 #2
0
        private void loadIDEAndShow()
        {
            CancellationTokenSource cts = new CancellationTokenSource();

            new Task(() => {
                FrmWaiting frmw = new FrmWaiting();
                frmw.setTitle("正在初始化Javascript IDE ......");
                frmw.Show();
                while (!cts.Token.IsCancellationRequested)
                {
                    Application.DoEvents();
                    Thread.Sleep(50);
                }
                frmw.Close();
            }, cts.Token).Start();
            try {
                JavascriptIDE.IDEForm.Show();
            } catch (Exception ex) {
                errorReport("初始化IDE错误");
                Logger.logError(ex);
            } finally {
                cts.Cancel();//不论如何最后关闭导入进度条
            }
        }