Пример #1
0
        private void button_find_Click(object sender, EventArgs e)
        {
            label_rowCount.Text = "";

            if (CLocalSystem.LocalSystem.IsLogin)
            {
                IMonitorSystem system = comboBox_monitorSystem.SelectedItem as IMonitorSystem;
                if (system != null)
                {
                    IConfig config = comboBox_monitor.SelectedItem as IConfig;
                    if (config != null)
                    {
                        RefreshAlarmRecordList(system, config.Name, dateTimePicker_alarm.Value);

                        if (dataGridView_alarm_record.Rows.Count == 0)
                        {
                            BackPlayer.DefaultImage = null;
                        }

                        label_rowCount.Text = "查询结果:共 " + dataGridView_alarm_record.RowCount + " 条报警记录";

                        return;
                    }
                }
                dataGridView_alarm_record.Rows.Clear();

                label_rowCount.Text = "查询结果:共 " + dataGridView_alarm_record.RowCount + " 条报警记录";
            }
            else
            {
                MessageBox.Show("还未登录系统,不能进行查询!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        public void RefreshAlarmRecordList(IMonitorSystem system, string sender, DateTime date)
        {
            dataGridView_alarm_record.Rows.Clear();
            CleanupAlarmRecordInfo();

            string path = mAlarmInfoRootPath + "\\" + system.Name + "\\" + sender + "\\" + date.ToString("yyyy-MM-dd");

            if (System.IO.Directory.Exists(path))
            {
                string[] files = Directory.GetFiles(path, "*.xml");
                if (files != null && files.Length > 0)
                {
                    object[]   row_params = new object[6];
                    int        index      = 0;
                    IAlarmInfo alarmInfo;

                    for (int i = 0; i < files.Length; i++)
                    {
                        alarmInfo = CAlarmInfo.LoadFromFile(files[i]);
                        if (alarmInfo != null)
                        {
                            row_params[0] = Convert.ToString(++index);
                            row_params[1] = alarmInfo;
                            row_params[2] = alarmInfo.GetAlarmType();
                            row_params[3] = alarmInfo.AlarmTime.ToString("yyyy-MM-dd HH:mm:ss");
                            row_params[4] = alarmInfo.TransactTime.ToString("yyyy-MM-dd HH:mm:ss");
                            row_params[5] = alarmInfo.Transactor;

                            dataGridView_alarm_record.Rows.Add(row_params);
                        }
                    }
                }
            }
        }
Пример #3
0
        private void DoRemoteSystemStateChanged(IMonitorSystemContext context, string name, MonitorSystemState state)
        {
            IMonitorSystem system = comboBox_monitorSystem.SelectedItem as IMonitorSystem;

            if (system != null && system.Name.Equals(name))
            {
                InitMonitorList(context);
            }
        }
Пример #4
0
        private void comboBox_monitorSystem_SelectedIndexChanged(object sender, EventArgs e)
        {
            IMonitorSystem system = comboBox_monitorSystem.SelectedItem as IMonitorSystem;

            if (system != null)
            {
                InitMonitorList(system.SystemContext);
            }
        }
Пример #5
0
        private bool DoShowLoginFormEvent(IMonitorSystem system, ref LoginInfo loginInfo)
        {
            if (ShowDialog(system))
            {
                loginInfo.username = UserName;
                loginInfo.password = Password;

                return(true);
            }
            return(false);
        }
Пример #6
0
        public static bool CheckSystemLogin(IMonitorSystem system)
        {
            IRemoteSystem rs = system as IRemoteSystem;

            if (rs != null)
            {
                return(CheckRemoteSystemLogin(rs));
            }
            else
            {
                return(CheckLocalSystemLogin());
            }
        }
Пример #7
0
        public static bool ShowLoginDialog(IMonitorSystem system)
        {
            if (system == null)
            {
                return(false);
            }

            if (OnShowLoginFormEvent != null)
            {
                LoginInfo loginInfo = new LoginInfo();

                if (OnShowLoginFormEvent(system, ref loginInfo))
                {
                    return(system.Login(loginInfo.username, loginInfo.password, false));
                }
            }
            return(false);
        }
Пример #8
0
        public bool ShowDialog(IMonitorSystem system)
        {
            IRemoteSystem rs = system as IRemoteSystem;

            if (rs != null)
            {
                Text = "远程系统登录 ";
            }
            else
            {
                Text = "本地系统登录 ";
            }

            textBox_username.Text = rs != null ? rs.Config.UserName : "";
            textBox_password.Text = "";

            return(ShowDialog() == DialogResult.OK);
        }