Exemple #1
0
        private void LockSystem()
        {
            try
            {
                this.Visibility = System.Windows.Visibility.Hidden;
                //Check_Connection _lock = new Check_Connection();
                frmLogOn _lock = new frmLogOn();
                //_lock.c_isLogin = false;
                _lock.Owner = Window.GetWindow(this);
                //_lock.Title = "Hệ thống đã bị khóa";
                _lock.ShowDialog();

                this.Visibility = System.Windows.Visibility.Visible;
                this.Focus();
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #2
0
        private void mainGridView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Left && e.Clicks == 2)
                {
                    string id   = mainGridView.GetRowCellValue(mainGridView.FocusedRowHandle, "id").ToString();
                    string time = mainGridView.GetRowCellValue(mainGridView.FocusedRowHandle, "time").ToString();

                    if (!string.IsNullOrEmpty(id))
                    {
                        string selectpoint = mainGridView.GetRowCellValue(mainGridView.FocusedRowHandle, "point").ToString();
                        //如果是自动挂接记录跳转到分站定义界面
                        if (selectpoint == "未定义")
                        {
                            AutomaticArticulatedDeviceInfo tempautoInfo = automaticArticulatedDeviceInfo.Find(a => a.DeviceOnlyCode == id);
                            //var fzh = mainGridView.GetRowCellValue(mainGridView.FocusedRowHandle, "fzh").ToString();
                            //var fzharr = fzh.Split('/');
                            if (tempautoInfo != null)
                            {
                                Jc_DevInfo tempdev       = devAllList.Find(a => a.Bz4 == tempautoInfo.DeviceModel);
                                int        devPropertyId = 0;
                                int        deviceId      = 0;
                                if (tempdev != null)
                                {
                                    devPropertyId = tempdev.Type;
                                    deviceId      = int.Parse(tempdev.Devid);
                                }

                                int resultIsMaster = MasterManagement.IsMaster();//等于0,表示正常
                                if (resultIsMaster == 1)
                                {
                                    DevExpress.XtraEditors.XtraMessageBox.Show("当前非主控电脑,请确认本机是否为主控并检查本机网络是否正常!");
                                    return;
                                }
                                if (resultIsMaster == 2)
                                {
                                    DevExpress.XtraEditors.XtraMessageBox.Show("连接服务器失败,请检查网络是否正常!");
                                    return;
                                }
                                if (resultIsMaster == 3)
                                {
                                    DevExpress.XtraEditors.XtraMessageBox.Show("获取当前主机是否为主控主机失败,详细见日志!");
                                    return;
                                }

                                frmLogOn loginForm = new frmLogOn(false);
                                loginForm.ShowDialog();
                                if (LoginManager.isLoginSuccess)//登录成功
                                {
                                    CFPointMrgFrame defineform = new CFPointMrgFrame(tempautoInfo.StationNumber, tempautoInfo.ChanelNumber, tempautoInfo.AddressNumber, devPropertyId, deviceId);
                                    defineform.Show();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex.Message + "\r\n" + ex.TargetSite);
            }
        }