Exemplo n.º 1
0
        private IVideoSourceConfig GetBackPlayVSConfig(IVideoSourceConfig vsConfig, IAlarmInfo alarmInfo)
        {
            CVideoSourceConfig newVSConfig = vsConfig.Clone() as CVideoSourceConfig;

            if (newVSConfig != null)
            {
                newVSConfig.Name      = vsConfig.Name + "_BackPlay_" + newVSConfig.Handle;
                newVSConfig.StartTime = alarmInfo.AlarmTime.AddSeconds(-10);
                newVSConfig.StopTime  = alarmInfo.AlarmTime;
                newVSConfig.IsRecord  = false;
                newVSConfig.IsCycle   = false;
                newVSConfig.Enabled   = true;
            }

            IVideoSourceType vsType = vsConfig.SystemContext.VideoSourceTypeManager.GetConfig(vsConfig.Type);

            if (vsType != null)
            {
                string backPlayType = vsType.BackPlayType;
                if (!backPlayType.Equals(""))
                {
                    newVSConfig.Type     = backPlayType;
                    newVSConfig.FileName = "";
                }
            }
            return(newVSConfig);
        }
Exemplo n.º 2
0
        private void dataGridView_alarm_record_SelectionChanged(object sender, EventArgs e)
        {
            BackPlayer.Close();

            DataGridViewRow row = dataGridView_alarm_record.CurrentRow;

            if (row != null)
            {
                IAlarmInfo alarmInfo = row.Cells[1].Value as IAlarmInfo;
                if (alarmInfo != null)
                {
                    if (!alarmInfo.VideoSource.Equals(""))
                    {
                        IVideoSourceConfig vsConfig = alarmInfo.GetVideoSourceConfig();
                        if (vsConfig != null)
                        {
                            IVideoSourceConfig backVSConfig = GetBackPlayVSConfig(vsConfig, alarmInfo);
                            if (backVSConfig != null)
                            {
                                BackPlayer.Config       = backVSConfig;
                                BackPlayer.DefaultImage = alarmInfo.GetAlarmImage();

                                label_alarm_monitor.Text = alarmInfo.ToString();
                                label_alarm_type.Text    = alarmInfo.GetAlarmType();
                                label_alarm_time.Text    = alarmInfo.AlarmTime.ToString("yyyy年MM月dd日 HH时mm分ss秒");
                                label_transact_time.Text = alarmInfo.TransactTime.ToString("yyyy年MM月dd日 HH时mm分ss秒");
                                label_transact_user.Text = alarmInfo.Transactor;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void ToolStripMenuItem_clear_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView_alarm_record.CurrentRow;

            while (row != null)
            {
                IAlarmInfo alarmInfo = row.Cells[1].Value as IAlarmInfo;
                if (alarmInfo != null)
                {
                    if (alarmInfo.Delete())
                    {
                        dataGridView_alarm_record.Rows.Remove(row);
                    }
                }
                row = dataGridView_alarm_record.CurrentRow;
            }
            if (dataGridView_alarm_record.Rows.Count == 0)
            {
                BackPlayer.DefaultImage = null;
                BackPlayer.Config       = null;
            }
        }