Exemple #1
0
        /// <summary>
        /// Calls the back do initialize.
        /// </summary>
        /// <param name="status">The status.</param>
        private void callBackDoInitialize(Object status)
        {
            ProgressBarDialog progress = status as ProgressBarDialog;

            Adapter.Invoke(new SendOrPostCallback((o1) =>
            {
                progress.Begin();
                progress.SetText("Initialize...");
            }), null);
            bcApp = BCApplication.getInstance(ServerName);

            try
            {
                bcApp.addUserToolStripStatusLabel(tssl_LoginUser_Value);
                bcApp.addRefreshUIDisplayFun(delegate(object o) { UpdateUIDisplayByAuthority(); });
                bcApp.SCApplication.loadECDataToSystem();
                line = bcApp.SCApplication.getEQObjCacheManager().getLine();
                ci   = bcApp.SCApplication.getEQObjCacheManager().CommonInfo;

                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    registerEvent();
                    initUI();
                }), null);

                //必須等到UI Event註冊完成後,才可以開啟通訊界面
                //bcApp.startProcess();
                bcApp.SCApplication.ParkBLL.setCurrentParkType();
                bcApp.SCApplication.CycleBLL.setCurrentCycleType();
                //line.addEventHandler(this.Name
                //, BCFUtility.getPropertyName(() => line.ServiceMode)
                //, (s1, e1) => { bcApp.SCApplication.FailOverService.ListenOrShutdownServerPort(); });
            }
            catch (Exception ex)
            {
                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    MessageBox.Show(this, ex.ToString());
                }), null);
                logger.Error(ex, "Exception");
            }
            finally
            {
                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    if (progress != null)
                    {
                        progress.End();
                    }
                }), null);
            }
        }