Exemplo n.º 1
0
        int targetVideoLen; //number of video frames;

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Public Constructor:
        /// Initialize Component
        /// Initialize mainWindow and controller
        /// Set the initial text of FileNameLabel
        /// Initialize Video Preview Component
        /// </summary>
        public ConflictWindow()
        {
            InitializeComponent();

            mainWindow = Program.getMainWindow();
            controller = MainWindow.controller;

            warningLabel.Hide();

            sourceFileNameLabel.Text = "";
            targetFileNameLabel.Text = "";

            targetMd = new MediaDetClass();
            sourceMd = new MediaDetClass();
            sourcePreviewer = new VideoPreview("tmp");
            targetPreviewer = new VideoPreview("tmp");

            successful = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Public Constructor:
        /// Initialize Component inside Conflict Preview Window
        /// Initialize video preview components
        /// Initialize various variables in Conflict Preview Window
        /// Load the picture/video accordingly
        /// </summary>
        /// <param name="source">source file full path</param>
        /// <param name="target">target file full path</param>
        /// <param name="confWin">Form from which this from is accessed</param>
        public ConflictPreviewWindow(string source, string target, Form confWin)
        {
            InitializeComponent();

            sourceMd = new MediaDetClass();
            targetMd = new MediaDetClass();
            sourcePreviewer = new VideoPreview("tmp");
            targetPreviewer = new VideoPreview("tmp");

            this.WindowState = FormWindowState.Maximized;
            this.sourceTitle.Text = "Source: " + Path.GetFileNameWithoutExtension(source);
            this.targetTitle.Text = "Target: " + Path.GetFileNameWithoutExtension(target);
            this.sourcePathName=source;
            this.targetPathName=target;
            this.Text = "Conflicted: " + Path.GetFileNameWithoutExtension(source);
            conflict = confWin;

            if (Photo.isPhoto(source) && Photo.isPhoto(target))
            {
                try
                {
                    this.sourcePicture.Image = Image.FromFile(source);
                }
                catch (Exception pe)
                {
                    this.sourcePicture.Image = global::DoubleSnap.Properties.Resources.no_preview;
                }
                try
                {
                    this.targetPicture.Image = Image.FromFile(target);
                }
                catch (Exception pe)
                {
                    this.targetPicture.Image = global::DoubleSnap.Properties.Resources.no_preview;
                }
            }
            else if (Video.isVideoPreviewable(source) && Video.isVideoPreviewable(target))
            {
                try
                {
                    sourcePreviewer.deleteTmpBmpFiles(MainWindow.storagePath);
                    sourceMd.Filename = sourcePathName;
                    sourceMd.CurrentStream = 0;
                    sourceVideoLen = (int)sourceMd.StreamLength;
                    sourcePicture.Image = global::DoubleSnap.Properties.Resources.hover_mouse;
                }
                catch (Exception pe) { sourcePicture.Image = global::DoubleSnap.Properties.Resources.no_preview;
                }

                try
                {
                    targetPreviewer.deleteTmpBmpFiles(MainWindow.storagePath2);
                    targetMd.Filename = targetPathName;
                    targetMd.CurrentStream = 0;
                    targetVideoLen = (int)targetMd.StreamLength;
                    targetPicture.Image = global::DoubleSnap.Properties.Resources.hover_mouse;
                }
                catch (Exception pe)
                {
                    targetPicture.Image = global::DoubleSnap.Properties.Resources.no_preview;
                     }

            }
            else
            {
               sourcePicture.Image = global::DoubleSnap.Properties.Resources.no_preview;
               targetPicture.Image = global::DoubleSnap.Properties.Resources.no_preview;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Private method to show the next the video frame
        /// </summary>
        /// <param name="box">picture box to show the video frame</param>
        /// <param name="mdex">mdex</param>
        /// <param name="previewer">previewer</param>
        /// <param name="len">length</param>
        /// <param name="str">string</param>
        private void showNextFrame(PictureBox box, MediaDetClass mde,
            VideoPreview previewer, int len, string str)
        {
            previewer.setNextFrame(len);

            if (box.Image != null)
                box.Image.Dispose();
            //  Console.WriteLine(box.ToString());
            previewer.deleteTmpBmpFiles(str);
            //   Console.WriteLine("hhkhkh");
            try
            {
                box.Image = new Bitmap(previewer.newBitmapPath(mde, str));
            }
            catch (Exception pe)
            {
                box.Image = global::DoubleSnap.Properties.Resources.no_preview;
            }
        }