private void btnStopClick(object sender, RoutedEventArgs e) { isPlaying = false; btnPlayPause.IsChecked = false; ReplaySDK.PlayM4_Stop(_port); ReplaySDK.PlayM4_CloseFile(_port); ReplaySDK.PlayM4_FreePort(_port); replayerSlider.Value = 0; this.pbReplay.Image = null; TBTotalTime.Text = TimeSpan.FromSeconds(0).ToString(); TBpassedTime.Text = TimeSpan.FromSeconds(0).ToString(); }
void timer_Tick(object sender, EventArgs e) { var time = (double)ReplaySDK.PlayM4_GetPlayedTime(_port); TBpassedTime.Text = TimeSpan.FromSeconds(time).ToString(); replayerSlider.Value = time; position = ReplaySDK.PlayM4_GetPlayPos(_port); if (position == 1) { isPlaying = false; btnPlayPause.IsChecked = false; timer.Stop(); ReplaySDK.PlayM4_Stop(_port); ReplaySDK.PlayM4_CloseFile(_port); ReplaySDK.PlayM4_FreePort(_port); this.pbReplay.Image = null; replayerSlider.Value = 0; TBTotalTime.Text = TimeSpan.FromSeconds(0).ToString(); TBpassedTime.Text = TimeSpan.FromSeconds(0).ToString(); if (!(bool)checkBoxPlayLocalFile.IsChecked) { var viewModel = DataContext as DataReplayerViewModel; if (viewModel != null) { if (viewModel.MoveToNextVideo()) { btnPlayPause.IsChecked = true; //viewModel.SelectedVideo != null string directory = string.Format(@"c:\{0}", viewModel.SelectedVideo.Directory); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } string file = string.Format(@"c:\{0}", viewModel.SelectedVideo.FullPath); if (!File.Exists(file)) { DownloadAndPlayVideoFile(viewModel.SelectedVideo.Address, file); } else { PlayVideoFile(file); } } } } } }