private void LoadMedia(string filename) { FullScreenImage.Visibility = Visibility.Collapsed; FullScreenMedia.Visibility = Visibility.Visible; FullScreenMedia.Source = new Uri(filename); FullScreenMedia.Play(); }
private void Pause() { if (FullScreenImage.Visibility == Visibility.Visible) { if (imageTimer.IsEnabled) { imageTimer.Stop(); } else { HideError(); imageTimer.Start(); } } else { if (GetMediaState(FullScreenMedia) == MediaState.Play) { FullScreenMedia.Pause(); } else { HideError(); FullScreenMedia.Play(); } } }
private void PromtDeleteCurrentMedia() { var dial = new PromptDialog("Delete file?", " Type yes or ok if you want to delete " + mediaFiles[currentItem] + " file", "yes,ok"); if (dial.ShowDialog() == true) { String fileToDelete = mediaFiles[currentItem]; // remove filename from list so we don`t use it again if (algorithm == PreferenceManager.ALGORITHM_RANDOM) { if (lastMedia.IndexOf(fileToDelete) >= currentLastMediaItem) { currentLastMediaItem--; } lastMedia.Remove(fileToDelete); } mediaFiles.RemoveAt(currentItem); PrevMediaItem(); try { File.Delete(fileToDelete); } catch { Pause(); //pause screensaver MessageBox.Show(this, "Can not delete " + fileToDelete + " ! Please check it and delete manualy!", "Can not delete file!", MessageBoxButton.OK, MessageBoxImage.Error); Pause(); //unpause } File.AppendAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PhotoVideoScreensaver_deletedFiles.log"), DateTime.Now + ": " + fileToDelete + Environment.NewLine); //you can add here anything you want. } else { if (FullScreenImage.Visibility == Visibility.Visible) { imageTimer.Start(); // start timer because we stoped it on Delete key press } if (FullScreenMedia.Visibility == Visibility.Visible) { FullScreenMedia.Play(); // start again because we paused it on Delete key press } } }
private void PromtDeleteCurrentMedia() { var dial = new PromptDialog("Delete file?", " Type yes or ok if you want to delete " + mediaFiles[currentItem] + " file", "yes,ok"); /*if ( * MessageBox.Show(this, "You want to delete " + mediaFiles[currentItem] + " file?", "Delete file?", * MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)*/ if (dial.ShowDialog() == true) { String fileToDelete = mediaFiles[currentItem]; // remove filename from list so we don`t use it again if (algorithm == PreferenceManager.ALGORITHM_RANDOM) { lastMedia.Remove(fileToDelete); } mediaFiles.RemoveAt(currentItem); PrevMediaItem(); try { File.Delete(fileToDelete); } catch { Pause(); //pause screensaver MessageBox.Show(this, "Can not delete " + fileToDelete + " ! Please check it and delete manualy!", "Can not delete file!", MessageBoxButton.OK, MessageBoxImage.Error); Pause(); //unpause } File.AppendAllText("deletedFiles.log", fileToDelete + Environment.NewLine); //you can add here anything you want. } else { if (FullScreenImage.Visibility == Visibility.Visible) { imageTimer.Start(); // start timer because we stoped it on Delete key press } if (FullScreenMedia.Visibility == Visibility.Visible) { FullScreenMedia.Play(); // start again because we paused it on Delete key press } } }
private void PromtDeleteCurrentMedia() { if ( MessageBox.Show(this, "You want to delete " + mediaFiles[currentItem] + " file?", "Delete file?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { String fileToDelete = mediaFiles[currentItem]; // remove filename from list so we don`t use it again if (algorithm == PreferenceManager.ALGORITHM_RANDOM) { lastMedia.Remove(fileToDelete); } mediaFiles.RemoveAt(currentItem); PrevMediaItem(); try { File.Delete(fileToDelete); } catch { Pause(); //pause screensaver MessageBox.Show(this, "Can not delete " + fileToDelete + " ! Please check it and delete manualy!", "Can not delete file!", MessageBoxButton.OK, MessageBoxImage.Error); Pause(); //unpause } } else { if (FullScreenImage.Visibility == Visibility.Visible) { imageTimer.Start(); // start timer because we stoped it on Delete key press } if (FullScreenMedia.Visibility == Visibility.Visible) { FullScreenMedia.Play(); // start again because we paused it on Delete key press } } }