void ReleaseDesignerOutlets() { if (TableView != null) { TableView.Dispose(); TableView = null; } if (BackgroundImageView != null) { BackgroundImageView.Dispose(); BackgroundImageView = null; } if (DetailLabel != null) { DetailLabel.Dispose(); DetailLabel = null; } if (ImageView != null) { ImageView.Dispose(); ImageView = null; } if (LineView != null) { LineView.Dispose(); LineView = null; } if (MoreButton != null) { MoreButton.Dispose(); MoreButton = null; } if (PlayButton != null) { PlayButton.Dispose(); PlayButton = null; } if (ShuffleButton != null) { ShuffleButton.Dispose(); ShuffleButton = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } }
private static void LoadModules(ModuleContainer moduleContainer) { //Global resource/s. var baseFont = new Font(AssPath + "/Resources/Fonts/SourceSansPro-Regular.otf"); baseFont.GetTexture(14).Smooth = false; //Modules /* Modules shouldn't depend on other modules unless absolutely neccessary. * Draw order is determined by the order they are added to the container. */ var pBar = new ProgressBar(); var songList = new SongList(baseFont); Audio.CurrentSongList = songList; var dragWindow = new DragWindow(); var playButton = new PlayButton(); var border = new Border(); var volumeControl = new VolumeControl(); var shuffle = new ShuffleButton(); var repeat = new RepeatButton(); var add = new AddSource(); var spriteBatch = new SpriteBatchMod(SpriteBatch); var search = new TextSearch(songList, baseFont); var hotkeys = new HotKeys(pBar, songList, volumeControl); moduleContainer.AddModule(pBar); moduleContainer.AddModule(songList); moduleContainer.AddModule(dragWindow); moduleContainer.AddModule(playButton); moduleContainer.AddModule(volumeControl); moduleContainer.AddModule(shuffle); moduleContainer.AddModule(repeat); moduleContainer.AddModule(add); moduleContainer.AddModule(spriteBatch); moduleContainer.AddModule(border); moduleContainer.AddModule(search); moduleContainer.AddModule(hotkeys); //Module specific resources songList.LoadFromMultipleDirectories(Config.musicDirectories); songList.SortByArtist(); //Remove duplicates. var duplicates = songList.GroupBy(x => x.Name).Where(x => x.Count() > 1); foreach (Song song in duplicates .SelectMany(duplicate => duplicate.Take(duplicate.Count() - 1))) { songList.Remove(song); } }
void ReleaseDesignerOutlets() { if (BufferedProgressSlider != null) { BufferedProgressSlider.Dispose(); BufferedProgressSlider = null; } if (NextButton != null) { NextButton.Dispose(); NextButton = null; } if (PlayingProgressSlider != null) { PlayingProgressSlider.Dispose(); PlayingProgressSlider = null; } if (PlayPauseButton != null) { PlayPauseButton.Dispose(); PlayPauseButton = null; } if (PreviousButton != null) { PreviousButton.Dispose(); PreviousButton = null; } if (QueueLabel != null) { QueueLabel.Dispose(); QueueLabel = null; } if (RepeatButton != null) { RepeatButton.Dispose(); RepeatButton = null; } if (ShuffleButton != null) { ShuffleButton.Dispose(); ShuffleButton = null; } if (SubtitleLabel != null) { SubtitleLabel.Dispose(); SubtitleLabel = null; } if (TimePlayedLabel != null) { TimePlayedLabel.Dispose(); TimePlayedLabel = null; } if (TimeTotalLabel != null) { TimeTotalLabel.Dispose(); TimeTotalLabel = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } if (TrackCoverImageView != null) { TrackCoverImageView.Dispose(); TrackCoverImageView = null; } }