private void OpenCliFormClosed(object sender, FormClosedEventArgs e) { var albumsReader = new AlbumListReader(); this.albums = albumsReader.GetAlbums(); this.openInSpotifyLogic.ShuffleAlbums(); var openCliForm = sender as OpenCliForm; openCliForm.FormClosed -= this.OpenCliFormClosed; }
public TrayApplicationContext() { // Initialize Tray Icon this.contextMenu = new ContextMenu(new MenuItem[] { new MenuItem("Open next album", this.OpenRandomAlbumClicked), new MenuItem("-"), new MenuItem("Random", this.OptionRandomClicked), new MenuItem("Shuffle", this.OptionShuffleClicked), new MenuItem("-"), new MenuItem("Update album list", this.UpdateAlbumListClicked), new MenuItem("-"), new MenuItem("Generate playlist", this.GeneratePlaylistClicked), new MenuItem("Add track(s) from clipboard to blacklist", this.AddTracksToBlacklistClicked), new MenuItem("-"), new MenuItem("Exit", this.Exit) }); this.trayIcon = new NotifyIcon() { Icon = Resources.random_album_icon, ContextMenu = contextMenu, Visible = true }; this.contextMenu.MenuItems[3].Checked = true; this.trayIcon.DoubleClick += this.TrayIconDoubleClick; this.openInBrowser = bool.Parse(ConfigurationManager.AppSettings["OpenInBrowser"]); this.browserPath = ConfigurationManager.AppSettings["BrowserPath"]; var albumsReader = new AlbumListReader(); this.albums = albumsReader.GetAlbums(); this.openInSpotifyLogic = new OpenInSpotifyLogic { Albums = this.albums, NextMode = NextMode.Shuffle }; this.openInSpotifyLogic.ShuffleAlbums(); }