Пример #1
0
        public PrintForm(GateRecord gateRecord)
        {
            InitializeComponent();
            //加载内容
            richEditControl1.Document.LoadDocument("printTemplate.rtf", DocumentFormat.Rtf);
            richEditControl1.Document.ReplaceAll(new Regex("#name#"), string.IsNullOrEmpty(gateRecord.name) ? "" : gateRecord.name);
            richEditControl1.Document.ReplaceAll(new Regex("#sex#"), string.IsNullOrEmpty(gateRecord.sex) ? "" : gateRecord.sex);
            richEditControl1.Document.ReplaceAll(new Regex("#birth_date#"), gateRecord.birth_date == null ? "" : gateRecord.birth_date.ToString());
            richEditControl1.Document.ReplaceAll(new Regex("#nationality#"), string.IsNullOrEmpty(gateRecord.nationality) ? "" : gateRecord.nationality);
            richEditControl1.Document.ReplaceAll(new Regex("#id_code#"), string.IsNullOrEmpty(gateRecord.id_code) ? "" : gateRecord.id_code);
            richEditControl1.Document.ReplaceAll(new Regex("#destination#"), string.IsNullOrEmpty(gateRecord.issue_place) ? "" : gateRecord.issue_place);

            string retport_content = gateRecord.report_content;

            if (string.IsNullOrEmpty(retport_content))
            {
                richEditControl1.Document.ReplaceAll(new Regex("#questionone#"), "");
                richEditControl1.Document.ReplaceAll(new Regex("#questiononeanswer#"), "");
                richEditControl1.Document.ReplaceAll(new Regex("#questiontwo#"), "");
                richEditControl1.Document.ReplaceAll(new Regex("#questiontwoanswer#"), "");
                richEditControl1.Document.ReplaceAll(new Regex("#questionthreeanswer#"), "");
            }
            else
            {
                string[] questions   = retport_content.Split(new char[] { ';' });
                string[] questionone = questions[0].Split(new char[] { ':' });
                richEditControl1.Document.ReplaceAll(new Regex("#questionone#"), questionone[0]);
                richEditControl1.Document.ReplaceAll(new Regex("#questiononeanswer#"), questionone[1]);
                string[] questiotwo = questions[1].Split(new char[] { ':' });
                richEditControl1.Document.ReplaceAll(new Regex("#questiontwo#"), questiotwo[0]);
                richEditControl1.Document.ReplaceAll(new Regex("#questiontwoanswer#"), questiotwo[1]);
                string[] questiothree = questions[2].Split(new char[] { '|' });
                string   display      = "";
                for (int i = 0; i < questiothree.Length; i++)
                {
                    string[] arr = questiothree[i].Split(new char[] { ':' });
                    if (arr[1] == "1")
                    {
                        display += "√ " + arr[0];
                    }
                    else
                    {
                        display += "× " + arr[0];
                    }
                    display += "        ";
                }

                richEditControl1.Document.ReplaceAll(new Regex("#questionthreeanswer#"), display);
            }


            richEditControl1.Document.ReplaceAll(new Regex("#temperature#"), gateRecord.temperature.ToString());
        }
Пример #2
0
        public void viewVideo()
        {
            Monitor monitor = new Monitor();

            monitor.gateNo = comboBox__channel.SelectedIndex + 1;
            playbackControler.setMonitor(monitor);
            GateRecord gateRecord = new GateRecord();
            DateTime   dt         = DateTime.Parse(dateTimePicker_startTime.Text + " " + dateTimePicker_startTime_time.Text);
            DateTime   dt1        = DateTime.Parse(dateTimePicker_endTime.Text + " " + dateTimePicker_endTime_time.Text);

            gateRecord.nvr_begintime = dt;
            gateRecord.nvr_endtime   = dt1;
            playbackControler.play(gateRecord);
        }
        public ClearanceVideoReplayForm(DataRow dr)
        {
            InitializeComponent();

            ICustomsCMS server = XmlRpcInstance.getInstance();

            playbackControler = new H264Controler(this.searchVideoPlayWnd, server);
            playbackControler.setToolStripStatusLabel(this.toolStripStatusLabel);
            bool isSuccess = playbackControler.init();

            if (!isSuccess)
            {
                System.Environment.Exit(0);
            }

            gateRecord = new ModelHandler <GateRecord>().FillModel(dr);
            Monitor monitor = new Monitor();

            monitor.gateNo = gateRecord.gate_id;
            playbackControler.setMonitor(monitor);

            playbackControler.play(gateRecord);
        }
Пример #4
0
        public bool play(GateRecord gateRecord)
        {
            //if device did not login,login first
            if (this.monitor != null && this.monitor.nvrDevice != null && this.monitor.nvrDevice.userID <= 0)
            {
                bool loginSuccess = this.login();
                if (!loginSuccess)
                {
                    return(false);
                }
            }
            if (m_nNetPlayHandle == 0)
            {
                H264_DVR_FINDINFO info = new H264_DVR_FINDINFO();

                //test by dyl
                info.nChannelN0 = monitor.channel; //channel No.
                info.nFileType  = 0;               //file type
                DateTime nvr_begintime = gateRecord.nvr_begintime;
                //DateTime nvr_begintime = DateTime.Parse("2014-12-30 21:30:00");
                info.startTime.dwYear   = nvr_begintime.Year;
                info.startTime.dwMonth  = nvr_begintime.Month;
                info.startTime.dwDay    = nvr_begintime.Day;
                info.startTime.dwHour   = nvr_begintime.Hour;
                info.startTime.dwMinute = nvr_begintime.Minute;
                info.startTime.dwSecond = nvr_begintime.Second;

                DateTime nvr_endtime = gateRecord.nvr_endtime;
                //DateTime nvr_endtime = DateTime.Parse("2014-12-30 22:30:00");
                info.endTime.dwYear   = nvr_endtime.Year;
                info.endTime.dwMonth  = nvr_endtime.Month;
                info.endTime.dwDay    = nvr_endtime.Day;
                info.endTime.dwHour   = nvr_endtime.Hour;
                info.endTime.dwMinute = nvr_endtime.Minute;
                info.endTime.dwSecond = nvr_endtime.Second;
                info.hWnd             = (uint)this.pictureBox.Handle;

                XMSDK.fDownLoadPosCallBack DownloadCallback = new XMSDK.fDownLoadPosCallBack(DownLoadPosCallback);
                XMSDK.fRealDataCallBack    realDataCallBack = new XMSDK.fRealDataCallBack(RealDataCallBack);

                m_nNetPlayHandle = XMSDK.H264_DVR_PlayBackByTimeEx(monitor.nvrDevice.userID, ref info, null, this.pictureBox.Handle.ToInt32(),
                                                                   null, this.pictureBox.Handle.ToInt32());

                if (m_nNetPlayHandle <= 0)
                {
                    int    iLastErr = XMSDK.H264_DVR_GetLastError();
                    string str      = "H264_DVR_PlayBackByTimeEx failed, 错误号= " + iLastErr + "!播放失败!"; //播放失败
                    MessageBox.Show(str);
                    m_nNetPlayHandle = 0;
                    return(false);
                }
            }
            else
            {
                if (m_bPauseNetPlay)
                {
                    XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_CONTINUE, 0);
                    m_bPauseNetPlay = !m_bPauseNetPlay;
                }
                XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_FAST, 0);
                m_nFastTypeNet = 0;
                m_nSlowTypeNet = 0;
            }
            return(true);
        }