예제 #1
0
        private void lvVideoFiles_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            var selItems = lvVideoFiles.SelectedIndices;

            if (selItems == null || selItems.Count == 0)
            {
                return;
            }
            int           sel = selItems[0];
            VideoFileInfo vfi = _videoFiles[sel];

            PlayPreviewFile(vfi.FileFullName);
        }
예제 #2
0
        private void toolButtonAssociate_Click(object sender, EventArgs e)
        {
            _player.Stop();

            int            idxFile  = lvFiles.SelectedIndices[0];
            int            idxVideo = lvVideoFiles.SelectedIndices[0];
            NationFileInfo nfi      = _eegFiles[idxFile];
            VideoFileInfo  vfi      = _videoFiles[idxVideo];
            //xcg
            string vfidate = vfi.StartTime.ToString("yyyy:MM:dd");
            string nfidate = nfi.StartTime.ToString("yyyy:MM:dd");

            if (string.Equals(vfidate, nfidate))
            {
                bool          videoStartLate  = vfi.StartTime > nfi.StartTime;
                bool          videoStopBefore = (vfi.StartTime + vfi.Duration) < (nfi.StartTime + nfi.Duration);
                List <string> msg             = new List <string>();
                if (videoStartLate)
                {
                    msg.Add("视频开始时间晚于脑电开始时间");
                }
                if (videoStopBefore)
                {
                    msg.Add("视频结束时间早于脑电结束时间");
                }
                if (videoStartLate || videoStopBefore)
                {
                    MessageBox.Show(string.Join("\n", msg), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (MessageBox.Show(
                        string.Format("要关联脑电[{0}:{1}]和视频[{2}]吗?", nfi.SerialNo, nfi.Patient, vfi.StartTime.ToString("s").Replace('T', ' ')),
                        "关联视频", MessageBoxButtons.YesNo)
                    == System.Windows.Forms.DialogResult.Yes)
                {
                    File.Move(vfi.FileFullName, DefaultConfig.AssociatedVideoPath + @"\" + nfi.SerialNo + "_" + ((int)(nfi.StartTime - vfi.StartTime).TotalMilliseconds).ToString() + ".MP4");
                    RefreshFiles();
                }
            }
            //xcg
            else
            {
                MessageBox.Show("视频和脑电数据的记录日期不一样,无法进行关联!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        private void LoadVideoList()
        {
            if (!Directory.Exists(myController.CommonDataPool.VideoPath))
            {
                MessageBox.Show("文件夹:" + myController.CommonDataPool.VideoPath + " 不存在,请重新选择保存视频的文件夹");
                return;
            }
            _videoFiles.Clear();
            //DirectoryInfo diTop = new DirectoryInfo(DefaultConfig.VideoSegmentPath);
            DirectoryInfo diTop = new DirectoryInfo(myController.CommonDataPool.VideoPath);
            var           files = diTop.EnumerateFiles("*.MP4");

            foreach (var file in files)
            {
                try
                {
                    VideoFileInfo vfi = new VideoFileInfo(file.FullName);
                    _videoFiles.Add(vfi);
                }
                catch
                {
                }
            }
            _videoFiles.Sort(new VideoFileInfoComparer());
            lvVideoFiles.BeginUpdate();
            lvVideoFiles.Items.Clear();
            foreach (var vfi in _videoFiles)
            {
                ListViewItem lvi = new ListViewItem("");
                lvi.SubItems.Add(vfi.StartTime == null ? "" : vfi.StartTime.ToString("s").Replace('T', ' '));
                TimeSpan ts       = vfi.Duration;
                string   tsText   = (ts.Days * 24 + ts.Hours).ToString() + ts.ToString(@"\:mm\:ss");
                string   duration = tsText;
                lvi.SubItems.Add(duration);
                lvVideoFiles.Items.Add(lvi);
            }
            lvVideoFiles.EndUpdate();
        }