Ejemplo n.º 1
0
 private void TimerForVideoProgress_Tick(object sender, EventArgs e)
 {
     if (CheckException.CheckNull(this.video) ||
         CheckException.CheckNull(this.audio))
     {
         if (CheckException.CheckNull(this.video) &&
             CheckException.CheckNull(this.video.DirectVideo))
         {
             HolderForm.HandleVideoProgress(this.VideoSlider, this.video.DirectVideo);
         }
         else if (CheckException.CheckNull(this.audio) &&
                  CheckException.CheckNull(this.audio.DirectAudio))
         {
             HolderForm.HandleAudioProgress(this.VideoSlider, this.audio.DirectAudio);
         }
         else
         {
             this.timerForSubs.Stop();
             this.timerForSubsSync.Stop();
             this.timerForProgress.Stop();
         }
     }
     else
     {
         this.timerForSubs.Stop();
         this.timerForSubsSync.Stop();
         this.timerForProgress.Stop();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Slider moves, video changes appropriately
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CustomSlider1_MouseClick(object sender, MouseEventArgs e)
        {
            if (CheckException.CheckNull(this.video))
            {
                HolderForm.HandleBarMovemenetVideo(
                    this.VideoSlider, this.video.DirectVideo);
            }

            if (CheckException.CheckNull(this.audio))
            {
                HolderForm.HandleBarMovementAudio(
                    this.VideoSlider, this.audio.DirectAudio);
            }
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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");
         }
     }
 }