예제 #1
0
파일: FormPlayer.cs 프로젝트: VPKSoft/vamp
        volatile bool statisticsLoaded        = false; // to indicate that the video statistics were loaded from the database
                                                       // END: These are valid parameters for the VlcControl.SetMedia() method overloads..


        /// <summary>
        /// Initialize the VlcControl with a FileInfo class instance.
        /// </summary>
        /// <param name="file">A FileInfo class instance to initialize the VlcControl with.</param>
        /// <param name="formPlayer">An instance of the FormPlayer class if one was created.</param>
        /// <param name="options">These are "command line arguments" given to the VlcControl as with the VLC Media Player.</param>
        /// <returns>True if the VlcControl.SetMedia() call was successful, otherwise false (an exception occurred).</returns>
        public static bool InitPlayerForm(FileInfo file, out FormPlayer formPlayer, params string[] options)
        {
            try
            {
                // create a new instance of the FormPlayer form..
                FormPlayer frm = new FormPlayer
                {
                    // set the form's statistic field's value with value gotten
                    // from the database with the file's full name..
                    statistic = Database.GetStatistic(file.FullName)
                };

                // execute a playback dialog if the video was not watched to the end..
                long position = FormDialogSelectPlaybackPosition.Execute(frm.statistic);
                frm.statistic.Position = position; // give a playback position to the video playback form..
                frm.statisticsLoaded   = true;     // indicate to the form that the video file statistics have been loaded..

                frm.options = options;
                frm.file    = file;
                formPlayer  = frm; // set the out parameter's value..
                frm.Show();
                return(true);
            }
            catch (Exception ex)
            {
                // log the exception..
                ExceptionLogger.LogError(ex);

                formPlayer = null; // set the out parameter's value..
                return(false);
            }
        }
예제 #2
0
파일: FormPlayer.cs 프로젝트: VPKSoft/vamp
        /// <summary>
        /// Initialize the VlcControl for the first time to avoid load delay.
        /// </summary>
        /// <returns>True if the form initialization was successful, otherwise false (an exception occurred).</returns>
        public static bool InitPlayerForm()
        {
            try
            {
                // create a new instance of the FormPlayer form..
                FormPlayer frm = new FormPlayer
                {
                    options = new string[] { }
                };
                frm.tmMain.Enabled       = false; // no timers this time..
                frm.tmWindRewind.Enabled = false; // .. again no timers this time..
                frm.DoDispose();                  // dispose..
                return(true);
            }
            catch (Exception ex)
            {
                // log the exception..
                ExceptionLogger.LogError(ex);

                return(false);
            }
        }
예제 #3
0
파일: FormPlayer.cs 프로젝트: VPKSoft/vamp
        /// <summary>
        /// Initialize the VlcControl with an Uri class instance.
        /// </summary>
        /// <param name="uri">An Uri class instance to initialize the VlcControl with.</param>
        /// <param name="formPlayer">An instance of the FormPlayer class if one was created.</param>
        /// <param name="options">These are "command line arguments" given to the VlcControl as with the VLC Media Player.</param>
        /// <returns>True if the VlcControl.SetMedia() call was successful, otherwise false (an exception occurred).</returns>
        public static bool InitPlayerForm(Uri uri, out FormPlayer formPlayer, params string[] options)
        {
            try
            {
                // create a new instance of the FormPlayer form..
                FormPlayer frm = new FormPlayer
                {
                    options = options,
                    uri     = uri
                };
                formPlayer = frm; // set the out parameter's value..
                frm.Show();
                return(true);
            }
            catch (Exception ex)
            {
                // log the exception..
                ExceptionLogger.LogError(ex);

                formPlayer = null; // set the out parameter's value..
                return(false);
            }
        }