public void PermanentlyDeleteFiles(List <PlaylistItem> itemsToDelete) { var fileDeleteCount = 0; foreach (var playlistItem in itemsToDelete) { if (this.playingItem != null && this.playingItem.FullPath.Equals(playlistItem.FullPath)) { if (playlistItem.FileType == FileTypes.Pictures) { this.window.ImageViewer.Source = null; this.currentImage = null; GC.Collect(); } else { this.window.UriPlayer.Clear(); this.window.UriPlayer.Visibility = Visibility.Hidden; this.window.LogoViewer.Visibility = Visibility.Hidden; } this.playingItem = null; ResetTitle(); } this.window.PanelPlaylist.ListPlaylist.Remove(playlistItem); try { File.Delete(playlistItem.FullPath); fileDeleteCount++; } catch (Exception) { this.EventC.SetEvent(new EventText("File could not be deleted: " + playlistItem.FullPath, 3, EventType.Delayed)); } } this.EventC.SetEvent(new EventText(fileDeleteCount + " files permanently deleted", 3, EventType.Delayed)); }
private void ImageLoaded(Controls.Images.ImpImage bitmap) { ImpDatabase.FileOpened(this.loadingItem); this.playingItem = this.loadingItem; //loadingItem = null; this.itemOnPlayer = this.playingItem; this.window.PanelPlaylist.ListPlaylist.PlayingThis(this.playingItem); this.window.UriPlayer.Clear(); this.currentImage = bitmap; this.window.ImageViewer.ImageSource = bitmap; this.window.ImageViewer.Visibility = Visibility.Visible; this.window.UriPlayer.Visibility = Visibility.Hidden; this.window.LogoViewer.Visibility = Visibility.Hidden; this.window.ImageViewer.Stretch = Stretch.Uniform; this.window.ImageViewer.StretchDirection = StretchDirection.Both; this.AllowedStyles = PlayerStyle.PictureViewer; this.window.ViewerBottom.Visibility = Visibility.Visible; this.window.PlayerBottom.Visibility = Visibility.Hidden; this.imageController.ImageChanged(); SetPlayingTitle(); }