Beispiel #1
0
        void OnBuild()
        {
            // 开启Logging
            LoggingBegin();

            // 开始建立项目
            try
            {
                // 禁止按钮
                btnPrev.Enabled   = false;
                btnCancel.Enabled = false;
                btnOK.Enabled     = false;
                btnExit.Enabled   = false;

                // 创建项目转换器,关联项目配置,并绑定UI显示事件
                WizardConverter conv = new WizardConverter(_curConfig);
                conv.NotifyProcessEvent += new ResConverter.NotifyProcessHandler(conv_NotifyProcessEvent);
                conv.LoggingEvent       += new WizardConverter.MessageHandler(conv_LoggingEvent);
                conv.ErrorEvent         += new WizardConverter.MessageHandler(conv_ErrorEvent);

                // 启动一个线程来拷贝文件,防止UI死锁
                Thread t = new Thread(new ThreadStart(conv.Start));
                t.Start();
                while (!t.Join(100))
                {
                    Application.DoEvents();
                }

                // 建立完成,显示退出按钮
                btnOK.Hide();
                btnExit.BringToFront();
                btnExit.Show();
                btnExit.Enabled = true;

                ReportAppend("项目" + CurOP + "完毕!");
            }
            catch (System.Exception e)
            {
                // 显示错误原因
                ReportAppend(e.Message);

                // 恢复按钮
                btnCancel.Enabled = true;
                btnPrev.Enabled   = true;
            }

            // 结束Logging
            LoggingEnd();
        }
Beispiel #2
0
 void conv_LoggingEvent(WizardConverter sender, WizardConverter.MessageEventArgs e)
 {
     Logging(e.msg);
 }
Beispiel #3
0
 void conv_ErrorEvent(WizardConverter sender, WizardConverter.MessageEventArgs e)
 {
     ReportAppend(e.msg);
 }