public void start(string eq_id)
 {
     bcApp = BCApplication.getInstance();
     //eqpt = bcApp.SCApplication.getEQObjCacheManager().getEquipmentByEQPTID(eq_id);
     lbl_ID_Value.Text = eq_id;
     initialDataBinding();
 }
Ejemplo n.º 2
0
        private void initialVhEvent(BCApplication _bcApp)
        {
            _bcApp.TestGuideSectionSearch += _bcApp_TestGuideSectionSearch;
            //sc.AVEHICLE vh_1 = _bcApp.SCApplication.VehicleBLL.cache.getVhByID("B7_OHBLOOP_CR1");
            //event_id = this.Name;
            //vh_1.addEventHandler(event_id
            //                    , nameof(vh_1.VhPositionChangeEvent)
            //                    , (s1, e1) =>
            //                    {
            //                        updateVehiclePosition_vh1(vh1_position, s1 as sc.AVEHICLE);
            //                    });
            ////vh_1.addEventHandler(event_id
            ////        , nameof(vh_1.VhStatusChangeEvent)
            ////        , (s1, e1) =>
            ////        {

            ////        });
            ////updateVehicleStatus_vh1(vh1, vh_1);

            //sc.AVEHICLE vh_2 = _bcApp.SCApplication.VehicleBLL.cache.getVhByID("B7_OHBLOOP_CR2");
            //event_id = this.Name;
            //vh_2.addEventHandler(event_id
            //                    , nameof(vh_2.VhPositionChangeEvent)
            //                    , (s1, e1) =>
            //                    {
            //                        updateVehiclePosition_vh1(vh2_position, s1 as sc.AVEHICLE);
            //                    });
            ////updateVehicleStatus_vh1(vh2, vh_2);
        }
Ejemplo n.º 3
0
 public MaintainDeviceForm(BCMainForm _mainForm)
 {
     InitializeComponent();
     mainForm       = _mainForm;
     bcApp          = mainForm.BCApp;
     timer1.Enabled = true;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// A0.04
        /// </summary>
        /// <param name="bcApp"></param>
        /// <param name="targetFormType"></param>
        public static void updateUIDisplayByAuthority(BCApplication bcApp, object targetFormType)
        {
            //PropertyDescriptorCollection properties =
            //TypeDescriptor.GetProperties(targetFormType);
            BindingFlags flag = BindingFlags.Instance | BindingFlags.NonPublic;

            MemberInfo[] memberInfos = targetFormType.GetType().GetMembers(flag);
            //MemberInfo[] memberInfos = typeof(BCMainForm).GetMembers(flag);

            var typeSwitch = new com.mirle.ibg3k0.bc.winform.BCMainForm.TypeSwitch()
                             .Case((System.Windows.Forms.ToolStripMenuItem tsm, bool tf) => { tsm.Enabled = tf; })
                             .Case((System.Windows.Forms.ComboBox cb, bool tf) => { cb.Visible = tf; })
                                                                                                                       //A0.05 .Case((System.Windows.Forms.Button btn, bool tf) => { btn.Enabled = tf; })
                             .Case((CCWin.SkinControl.SkinButton btn, bool tf) => { btn.Enabled = tf; })               //A0.05
                             .Case((System.Windows.Forms.TableLayoutPanel tblay, bool tf) => { tblay.Enabled = tf; }); //A0.08

            foreach (MemberInfo memberInfo in memberInfos)
            {
                Attribute AuthorityCheck = memberInfo.GetCustomAttribute(typeof(AuthorityCheck));
                if (AuthorityCheck != null)
                {
                    string attribute_FUNName = ((AuthorityCheck)AuthorityCheck).FUNCode;
                    //ToolStripMenuItem tsl = (ToolStripMenuItem)((FieldInfo)memberInfo).GetValue(this);
                    FieldInfo info = (FieldInfo)memberInfo;
                    if (bcApp.SCApplication.UserBLL.checkUserAuthority(bcApp.LoginUserID, attribute_FUNName))
                    {
                        typeSwitch.Switch(info.GetValue(targetFormType), true);
                    }
                    else
                    {
                        typeSwitch.Switch(info.GetValue(targetFormType), false);
                    }
                }
            }
        }
 public static void showMsgBox_Info(IWin32Window _from, string txt)
 {
     MessageBox.Show(_from, txt
                     , BCApplication.getMessageString("INFO")
                     , MessageBoxButtons.OK
                     , MessageBoxIcon.Information);
 }
Ejemplo n.º 6
0
        private void UpdBtn_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }
            string func_code = FuncCodeTBx.Text.Trim();
            string func_name = FuncNameTBx.Text.Trim();

            if (!checkInputData())
            {
                return;
            }

            Boolean updSuccess =
                bcApp.SCApplication.UserBLL.updateFunctionCodeByCode(func_code, func_name);

            if (updSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("UPDATE_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("UPDATE_SUCCESS"));
                Refresh();
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("UPDATE_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("UPDATE_FAILED"));
            }
        }
        private void AddBtn_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_USER_MANAGEMENT))
            {
                return;
            }
            string user_group = this.UserGroupTbx.Text.Trim();

            if (!checkInputData())
            {
                return;
            }

            Boolean createSuccess = bcApp.SCApplication.UserBLL.addUserGroup(user_group);

            if (createSuccess)
            {
                //MessageBox.Show(this, BCApplication.getMessageString("CREATE_SUCCESS"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("CREATE_SUCCESS"));
                Refresh();
            }
            else
            {
                //MessageBox.Show(this, BCApplication.getMessageString("CREATE_FAILED"));
                BCUtility.showMsgBox_Info(this, BCApplication.getMessageString("CREATE_FAILED"));
            }
        }
        public ReserveSectionInfoForm(BCMainForm _form)
        {
            InitializeComponent();
            form = _form;
            //uctlReserveSectionView1.Start(form.BCApp);
            bcApp = _form.BCApp;
            uctlReserveSectionView1.Start(bcApp);

            List <string> lstVh = new List <string>();

            lstVh.Add(string.Empty);
            lstVh.AddRange(bcApp.SCApplication.VehicleBLL.loadAllVehicle().
                           Select(vh => sc.Common.SCUtility.Trim(vh.VEHICLE_ID, true)).
                           ToList());
            string[] allVh = lstVh.ToArray();
            BCUtility.setComboboxDataSource(cmb_vh_ids, allVh);


            List <AADDRESS> allAddress_obj = bcApp.SCApplication.MapBLL.loadAllAddress();

            string[] allAdr_ID = allAddress_obj.Select(adr => adr.ADR_ID).ToArray();
            BCUtility.setComboboxDataSource(cmb_adr_id, allAdr_ID);

            List <ASECTION> sections = bcApp.SCApplication.SectionBLL.cache.GetSections();

            string[] allSec_ID = sections.Select(sec => sec.SEC_ID).ToArray();
            BCUtility.setComboboxDataSource(cmb_reserve_section, allSec_ID.ToArray());

            cmb_fork_dir.DataSource      = Enum.GetValues(typeof(HltDirection)).Cast <HltDirection>();
            cmb_sensor_dir.DataSource    = Enum.GetValues(typeof(HltDirection)).Cast <HltDirection>();
            cmb_vh_fork_dir.DataSource   = Enum.GetValues(typeof(HltDirection)).Cast <HltDirection>();
            cmb_vh_sensor_dir.DataSource = Enum.GetValues(typeof(HltDirection)).Cast <HltDirection>();
            //bcApp.SCApplication.ReserveBLL.ReserveStatusChange += ReserveBLL_ReserveStatusChange;
        }
        public EngineerForm(BCMainForm _mainForm)
        {
            InitializeComponent();
            mainForm = _mainForm;
            bcApp    = mainForm.BCApp;
            string[] allAdr = loadAllAdr();
            cmb_fromAdr.DataSource = allAdr;
            cmb_fromAdr.AutoCompleteCustomSource.AddRange(allAdr);
            cmb_fromAdr.AutoCompleteMode   = AutoCompleteMode.Suggest;
            cmb_fromAdr.AutoCompleteSource = AutoCompleteSource.ListItems;
            cmb_toAdr.DataSource           = allAdr.ToArray();
            cmb_toAdr.AutoCompleteCustomSource.AddRange(allAdr);
            cmb_toAdr.AutoCompleteMode   = AutoCompleteMode.Suggest;
            cmb_toAdr.AutoCompleteSource = AutoCompleteSource.ListItems;
            cmb_startAdr.DataSource      = allAdr.ToArray();
            cmb_startAdr.AutoCompleteCustomSource.AddRange(allAdr);
            cmb_startAdr.AutoCompleteMode   = AutoCompleteMode.Suggest;
            cmb_startAdr.AutoCompleteSource = AutoCompleteSource.ListItems;

            string[] allSec = bcApp.SCApplication.MapBLL.loadAllSection().Select(sec => sec.SEC_ID).ToArray();
            cmb_fromSection.DataSource = allSec;
            cmb_fromSection.AutoCompleteCustomSource.AddRange(allSec);
            cmb_fromSection.AutoCompleteMode   = AutoCompleteMode.Suggest;
            cmb_fromSection.AutoCompleteSource = AutoCompleteSource.ListItems;
        }
 public MPCInfoMsgDialog(BCMainForm mainForm)
 {
     InitializeComponent();
     this.mainForm = mainForm;
     bcApp         = mainForm.BCApp;
     commonInfo    = bcApp.SCApplication.getEQObjCacheManager().CommonInfo;
 }
        private void initialVhEvent(BCApplication _bcApp)
        {
            sc.AVEHICLE vh_1 = _bcApp.SCApplication.VehicleBLL.cache.getVhByID("B7_OHBLINE1_CR1");
            event_id = this.Name;
            vh_1.addEventHandler(event_id
                                 , nameof(vh_1.VhPositionChangeEvent)
                                 , (s1, e1) =>
            {
                updateVehiclePosition_vh1(vh1_position, s1 as sc.AVEHICLE);
            });
            //vh_1.addEventHandler(event_id
            //        , nameof(vh_1.VhStatusChangeEvent)
            //        , (s1, e1) =>
            //        {

            //        });
            //updateVehicleStatus_vh1(vh1, vh_1);

            sc.AVEHICLE vh_2 = _bcApp.SCApplication.VehicleBLL.cache.getVhByID("B7_OHBLINE1_CR2");
            event_id = this.Name;
            vh_2.addEventHandler(event_id
                                 , nameof(vh_2.VhPositionChangeEvent)
                                 , (s1, e1) =>
            {
                updateVehiclePosition_vh1(vh2_position, s1 as sc.AVEHICLE);
            });
            //updateVehicleStatus_vh1(vh2, vh_2);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Handles the Click event of the stopConnectionToolStripMenuItem1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void stopConnectionToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CONNECTION_MANAGEMENT))
            {
                return;
            }
            try
            {
                DialogResult confirmResult = MessageBox.Show(this, BCApplication.getMessageString("Confirm_STOP_CONNECTING"),
                                                             BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);
                if (confirmResult != System.Windows.Forms.DialogResult.Yes)
                {
                    return;
                }

                ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                System.Threading.ThreadPool.QueueUserWorkItem(
                    new System.Threading.WaitCallback(doStopConnection), progress);
                if (progress != null && !progress.IsDisposed)
                {
                    progress.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception:");
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Handles the FormClosing event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="FormClosingEventArgs"/> instance containing the event data.</param>
        private void BCMainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //TODO 確認Authority
            //if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_MASTER_PC))
            //{
            //    //e.Cancel = true;
            //    //return;
            //}
            DialogResult confirmResult = MessageBox.Show(this, "Do you want to close OHTC?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
            }
            if (e.Cancel == false)
            {
                try
                {
                    ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                    System.Threading.ThreadPool.QueueUserWorkItem(
                        new System.Threading.WaitCallback(doStopConnection), progress);
                    if (progress != null && !progress.IsDisposed)
                    {
                        progress.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Exception");
                }
            }
        }
Ejemplo n.º 14
0
 public ChartPopupForm(BCMainForm _form)
 {
     InitializeComponent();
     form = _form;
     //uctlReserveSectionView1.Start(form.BCApp);
     bcApp = _form.BCApp;
     uc_SP_Chart1.Start(bcApp);
 }
 public ChangePwdForm(BCMainForm _mainForm)
 {
     InitializeComponent();
     mainForm       = _mainForm;
     bcApp          = BCApplication.getInstance();
     this.Width     = 650; //A0.02
     base.TitleName = "Change Password";
 }
        /// <summary>
        /// Determines whether the specified bc application is login.
        /// </summary>
        /// <param name="bcApp">The bc application.</param>
        /// <returns>Boolean.</returns>
        public static Boolean isLogin(BCApplication bcApp)
        {
            string loginUserID = bcApp.LoginUserID;

            if (SCUtility.isEmpty(loginUserID))
            {
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// Logins as admin.
        /// </summary>
        /// <param name="bcApp">The bc application.</param>
        /// <returns>Boolean.</returns>
        public static Boolean loginAsAdmin(BCApplication bcApp)
        {
            UASUSR admin = bcApp.SCApplication.UserBLL.getAdminUser();

            if (admin == null)
            {
                return(false);
            }
            bcApp.login(admin);
            return(true);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Does the start connection.
        /// </summary>
        /// <param name="status">The status.</param>
        private void doStartConnection(object status)
        {
            ProgressBarDialog progress = status as ProgressBarDialog;

            progress.Begin();
            progress.SetText(BCApplication.getMessageString("START_CONNECTING"));
            bcApp.startProcess();

            //Do something...

            progress.End();
        }
        /// <summary>
        /// Does the login.
        /// </summary>
        /// <param name="window">The window.</param>
        /// <param name="bcApp">The bc application.</param>
        /// <param name="function_code">The function_code.</param>
        /// <param name="isForceChack">if set to <c>true</c> [is force chack].</param>
        /// <returns>Boolean.</returns>
        public static Boolean doLogin(System.Windows.Forms.IWin32Window window, BCApplication bcApp, string function_code, bool isForceChack)//A0.01
        {
            //return true;
            string  loginUserID = bcApp.LoginUserID;
            Boolean hasAuth     = false;

            if (!isForceChack && !SCUtility.isEmpty(loginUserID))
            {
                hasAuth = bcApp.SCApplication.UserBLL.checkUserAuthority(loginUserID, function_code);
            }

            if (hasAuth)
            {
                return(true);
            }

            //            LoginPopupForm loginForm = new LoginPopupForm(function_code);
            //如果已經有人登入了,就必須已切換帳號的方式再次登入
            LoginPopupForm loginForm = new LoginPopupForm(function_code, isForceChack ? false : BCUtility.isLogin(bcApp));

            System.Windows.Forms.DialogResult result = loginForm.ShowDialog(window);
            loginUserID = loginForm.getLoginUserID();
            string loginPassword = loginForm.getLoginPassword();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                loginForm.Dispose();
            }
            else
            {
                loginForm.Dispose();
                return(false);
            }
            Boolean loginSuccess = false;

            if (!SCUtility.isEmpty(loginUserID))
            {
                loginSuccess = bcApp.SCApplication.UserBLL.checkUserPassword(loginUserID, loginPassword);
            }
            if (loginSuccess)
            {
                bcApp.login(loginUserID);
                hasAuth = bcApp.SCApplication.UserBLL.checkUserAuthority(loginUserID, function_code);
            }

            if (!hasAuth)
            {
                MessageBox.Show(window, BCApplication.getMessageString("NO_AUTHORITY"),
                                BCApplication.getMessageString("WARNING"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            return(hasAuth);
        }
Ejemplo n.º 20
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);
            }
        }
        private async void button2_Click(object sender, EventArgs e)
        {
            DialogResult confirmResult = MessageBox.Show(this, "Do you want to reset current reserve section?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }
            await Task.Run(() => bcApp.SCApplication.ReserveBLL.RemoveAllReservedSections());

            bcf.App.BCFApplication.onInfoMsg("Fource release current vehicle reserve status success");
        }
        private Boolean checkInputData()
        {
            string user_group = this.UserGroupTbx.Text.Trim();

            if (SCUtility.isEmpty(user_group))
            {
                MessageBox.Show(this, BCApplication.getMessageString("USER_GROUP_CANNOT_BE_BLANK"),
                                BCApplication.getMessageString("WARNING"),
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 23
0
 public ProgressBarDialog(BCApplication bcApp)
 {
     this.bcApp = bcApp;
     InitializeComponent();
     //A0.01 SetStyle(ControlStyles.SupportsTransparentBackColor, true);
     m_processLbl.Text = string.Empty;
     //A0.01 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     //A0.01 this.Width = this.BackgroundImage.Width;
     //A0.01 this.Height = this.BackgroundImage.Height;
     //A0.01 this.TransparencyKey = Color.FromArgb(0, 112, 192);
     //A0.01 m_circularProgressBar1.BackColor = Color.Transparent;
     //A0.01 m_processLbl.BackColor = Color.Transparent;
 }
Ejemplo n.º 24
0
 public List <Address> loadAddresss(BCApplication bcApp)
 {
     try
     {
         DataTable dt    = bcApp.SCApplication.OHxCConfig.Tables["AADDRESS"];
         var       query = from c in dt.AsEnumerable()
                           select new Address(c.Field <string>("Id"), startToDouble(c.Field <string>("PositionX")), startToDouble(c.Field <string>("PositionY")));
         return(query.ToList());
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LoginPopupForm"/> class.
 /// </summary>
 /// <param name="function_code">The function_code.</param>
 /// <param name="withDifferentAccount">The with different account.</param>
 public LoginPopupForm(string function_code, Boolean withDifferentAccount)
 {
     InitializeComponent();
     this.function_code = function_code;
     bcApp = BCApplication.getInstance();
     if (withDifferentAccount)
     {
         this.Text = BCApplication.getMessageString("Login_With_Other_Account");
     }
     else
     {
         this.Text = BCApplication.getMessageString("Login");
     }
 }
Ejemplo n.º 26
0
 public List <Section> loadASection(BCApplication bcApp)
 {
     try
     {
         DataTable dt    = bcApp.SCApplication.OHxCConfig.Tables["ASECTION"];
         var       query = from c in dt.AsEnumerable()
                           select new Section(addresses, c.Field <string>("Id"), c.Field <string>("FromAddress"), c.Field <string>("ToAddress"));
         return(query.ToList());
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 27
0
        private Boolean checkInputData()
        {
            string func_code = FuncCodeTBx.Text.Trim();
            string func_name = FuncNameTBx.Text.Trim();

            if (SCUtility.isEmpty(func_code) || SCUtility.isEmpty(func_name))
            {
                MessageBox.Show(this, BCApplication.getMessageString("FUNCTION_CODE_NAME_CANNOT_BE_BLANK"),
                                BCApplication.getMessageString("WARNING"),
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
        private async void btn_resetReservedSectionByVh_Click(object sender, EventArgs e)
        {
            string       vh_id         = cmb_vh_ids.Text;
            DialogResult confirmResult = MessageBox.Show(this, $"Do you want to reset vh:{vh_id} current reserved section?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }
            await Task.Run(() => bcApp.SCApplication.ReserveBLL.RemoveAllReservedSectionsByVehicleID(vh_id));

            bcf.App.BCFApplication.onInfoMsg($"Fource release current vehicle:{vh_id} reserved status success");
        }
Ejemplo n.º 29
0
 //public uctlVehicle(Equipment eqpt, uctl_Map _uctl_Map)
 public uctlVehicle(AVEHICLE eqpt, uctl_Map _uctl_Map)
 {
     InitializeComponent();
     bcApp           = BCApplication.getInstance();
     this.eqpt       = eqpt;
     this.Uctl_Map   = _uctl_Map;
     m_iVhPt         = -1;
     m_iNum          = 0;
     this.p_Status   = E_MAP_VHSTS.enDisconnect;
     this.p_Presence = false;
     //registerEvent();
     _SetInitialRailToolTip();
     _SetRailToolTip();
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Handles the FormClosing event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="FormClosingEventArgs"/> instance containing the event data.</param>
        private void BCMainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //TODO 確認Authority
            //if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_MASTER_PC))
            //{
            //    //e.Cancel = true;
            //    //return;
            //}

            //1.初步詢問是否要關閉OHBC
            DialogResult confirmResult = MessageBox.Show(this, "Do you want to close OHTC?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            recordAction("Do you want to close OHTC?", confirmResult.ToString());
            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
                return;
            }

            if (!SCUtility.isMatche(bcApp.SCApplication.BC_ID, "ASE_LOOP"))
            {
                if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_SYSTEM, true))
                {
                    e.Cancel = true;
                    recordAction("Close Master PC, Authority Check...", "Failed !!");
                    return;
                }
            }
            recordAction("Close Master PC, Authority Check...", "Success !!");

            if (e.Cancel == false)
            {
                try
                {
                    ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                    System.Threading.ThreadPool.QueueUserWorkItem(
                        new System.Threading.WaitCallback(doStopConnection), progress);
                    if (progress != null && !progress.IsDisposed)
                    {
                        progress.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Exception");
                }
            }
        }