예제 #1
0
        /// <summary>
        /// Closes the video
        /// </summary>
        /// <param name="button">Button to set styles to</param>
        public void Close(Button button)
        {
            this.SwitchButtonStyle(button);

            if (CheckException.CheckNull(this.MainScreenInstance.video))
            {
                HolderForm.NullVideoAndForm(this.MainScreenInstance.video.DirectVideo);
            }

            if (CheckException.CheckNull(this.MainScreenInstance.audio))
            {
                this.MainScreenInstance.audio.DirectAudio.Dispose();
                this.MainScreenInstance.audio = null;
            }

            this.MainScreenInstance.GetSlider().Value   = 0;
            this.MainScreenInstance.GetSlider().Enabled = false;
            this.MainScreenInstance.timerForProgress.Stop();
            this.MainScreenInstance.timerForSubsSync.Stop();
            this.MainScreenInstance.GetLabel().Text = string.Empty;
        }
예제 #2
0
 public void Open(string path)
 {
     try
     {
         if (this.MainScreenInstance.video == null)
         {
             this.MainScreenInstance.subtitles.UnLoad();
             this.MainScreenInstance.video = new Video(path, false, 800, 600);
             this.MainScreenInstance.video.Start();
             this.MainScreenInstance.timerForProgress.Start();
             this.MainScreenInstance.timerForProgress.Start();
             this.MainScreenInstance.video.DirectVideo.Ending += this.MainScreenInstance.DirectVideo_Ending;
             this.MainScreenInstance.GetSlider().Enabled       = true;
             AudioControl.VolumeInit(this.MainScreenInstance.video.DirectVideo.Audio, this.MainScreenInstance.AudioControl.VolumeProgress);
             this.MainScreenInstance.video.DirectVideo.Ending += this.MainScreenInstance.ClearTimers;
             this.MainScreenInstance.video.PathToSource        = path;
         }
         else
         {
             this.MainScreenInstance.subtitles.UnLoad();
             HolderForm.NullVideoAndForm(this.MainScreenInstance.video.DirectVideo);
             this.MainScreenInstance.video = null;
             this.MainScreenInstance.video = new Video(path, false, 800, 600);
             this.MainScreenInstance.video.Start();
             this.MainScreenInstance.timerForProgress.Start();
             this.MainScreenInstance.timerForProgress.Start();
             this.MainScreenInstance.GetSlider().Enabled = true;
             AudioControl.VolumeInit(this.MainScreenInstance.video.DirectVideo.Audio, this.MainScreenInstance.AudioControl.VolumeProgress);
             this.MainScreenInstance.video.DirectVideo.Ending += this.MainScreenInstance.ClearTimers;
             this.MainScreenInstance.video.PathToSource        = path;
         }
     }
     catch (Microsoft.DirectX.DirectXException)
     {
         try
         {
             if (this.MainScreenInstance.audio == null)
             {
                 this.MainScreenInstance.subtitles.UnLoad();
                 this.MainScreenInstance.audio = new Audio(path);
                 this.MainScreenInstance.audio.Start();
                 this.MainScreenInstance.timerForProgress.Start();
                 this.MainScreenInstance.timerForProgress.Start();
                 this.MainScreenInstance.GetSlider().Enabled = true;
                 AudioControl.VolumeInit(this.MainScreenInstance.audio.DirectAudio, this.MainScreenInstance.AudioControl.VolumeProgress);
             }
             else
             {
                 this.MainScreenInstance.subtitles.UnLoad();
                 this.MainScreenInstance.audio = null;
                 this.MainScreenInstance.audio = new Audio(path);
                 this.MainScreenInstance.audio.Start();
                 this.MainScreenInstance.timerForProgress.Start();
                 this.MainScreenInstance.timerForProgress.Start();
                 this.MainScreenInstance.GetSlider().Enabled = true;
                 AudioControl.VolumeInit(this.MainScreenInstance.audio.DirectAudio, this.MainScreenInstance.AudioControl.VolumeProgress);
             }
         }
         catch (Microsoft.DirectX.DirectXException)
         {
             MessageBox.Show(TypeExpecption, "Warning");
         }
     }
 }