コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: pvandyk-tmt/ITS
        private void buttonShowVideo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (usingRemotePath || !File.Exists(mCaseInfo.Image1))
                {
                    mCaseInfo.Image1 = mCaseInfo.RemoteImage1;
                }
                else
                {
                    usingRemotePath = false;
                }

                string filePath = mCaseInfo.Image1;
                //string filePath = @"C:\ENC\LuAnn\Not Showing in Session\Img0178s.enc";

                var camera = CameraFactory.Find();
                if (camera == null)
                {
                    return;
                }

                Configuration configuration = new Configuration();

                string videoPath;
                videoPath = camera.ExtractInfringementVideo(filePath, configuration.GetDLLPath());
                if (videoPath != string.Empty)
                {
                    VideoViewer videoViewer = new VideoViewer();
                    videoViewer.LoadVideo(videoPath);
                    videoViewer.ShowDialog();
                    File.Delete(videoPath);
                }
                else
                {
                    MessageBox.Show("No Video File found.");
                }
            }
            catch (GatewayException gex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("Failed to load window from{0} - {1}", "OtherWindow", gex.Message));
                throw new Exception(String.Format("Failed to load window from{0} - {1}", "OtherWindow", gex.Message), gex);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("Failed to load window from{0} - {1}", "OtherWindow", ex.Message));
                throw new Exception(String.Format("Failed to load window from{0} - {1}", "OtherWindow", ex.Message), ex);
            }
        }