private void playStatePicture_Click(object sender, EventArgs e) { Logger.Debug("playStatePicture clicked"); if (videoPlayer.PlayState == GenericPlayerControl.PlayStates.Transitioning) // if we're transition, it takes a while to stop _hourGlass = new HourGlass(); if (videoPlayer.PlayState == GenericPlayerControl.PlayStates.Playing || videoPlayer.PlayState == GenericPlayerControl.PlayStates.Transitioning) { videoPlayer.Pause(); } else if (videoPlayer.PlayState == GenericPlayerControl.PlayStates.Stopped) { // we hit the end of the clip so let's start at the beginning before playing // we do this seek request manually so the playhead immediately jumps to 0 _hourGlass.Dispose(); SeekToPosition(_currentHighlight.StartTime.TotalSeconds); tickBoxLocationsTimer.Enabled = true; videoPlayer.Play(); } else { videoPlayer.Play(); } }
private void removeHighlightPictureButtonControl_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to remove this highlight?" + Environment.NewLine + Environment.NewLine + "You can get it back by rescanning your videos.", "Remove highlight?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; if ((_currentHighlight.SaveWorker != null && _currentHighlight.SaveWorker.PublishWorkerResult == PublishWorker.PublishWorkerResults.NotFinished) || (_currentHighlight.FacebookShareWorker != null && _currentHighlight.FacebookShareWorker.PublishWorkerResult == PublishWorker.PublishWorkerResults.NotFinished)) { if (MessageBox.Show("This highlight is currently being published." + Environment.NewLine + Environment.NewLine + "Would you like to cancel publishing and remove the highlight?", "Cancel publishing?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { using (_hourGlass = new HourGlass()) { if (_currentHighlight.SaveWorker != null) { _currentHighlight.SaveWorker.CancelAsync(); while (_currentHighlight.SaveWorker.IsBusy) { Application.DoEvents(); } } if (_currentHighlight.FacebookShareWorker != null) { _currentHighlight.FacebookShareWorker.CancelAsync(); while (_currentHighlight.FacebookShareWorker.IsBusy) { Application.DoEvents(); } } } } else return; } HighlightRemoved(sender, new HighlightEventArgs(_currentHighlight)); if (MainModel.HighlightObjects.Count == 1) { nextHighlightPictureButtonControl.Enabled = false; previousHighlightPictureButtonControl.Enabled = false; } // move on to next one var newIndex = _currentHighlightIndex; if (newIndex == MainModel.HighlightObjects.Count) // we deleted the last one newIndex = 0; // move to front if (MainModel.HighlightObjects.Count == 0) // no highlights left { Close(); } else { CurrentHighlightIndex = newIndex; } }
private void HighlightDetailsForm_FormClosing(object sender, FormClosingEventArgs e) { using (_hourGlass = new HourGlass()) { tickBoxLocationsTimer.Enabled = false; _videoPlayerSeekHelper.Cancel(); Settings.Default.Save(); // save sizing settings if (closeDetailsTutorialBubble.Visible) closeDetailsTutorialBubble_Advance(null, EventArgs.Empty); } }