private void InitialisePlaylistFolder() { if (iPlaylists != null) { iPlaylists.Dispose(); iPlaylists = null; } try { iPlaylists = new LocalPlaylists(iOptionSaveDirectory.Value); } catch (Exception e) { UserLog.WriteLine(DateTime.Now + ": failed to initialise local playlist folder: " + e); iPlaylists = null; } iWrapped.EventContentUpdated -= ContentUpdated; iWrapped.EventContentAdded -= ContentAdded; iWrapped.EventContentRemoved -= ContentRemoved; if (iPlaylists != null) { iWrapped = new LocalPlaylistsRootOk(kRootId, iPlaylists, iCreator); } else { iWrapped = new LocalPlaylistsRootError(kRootId); } iWrapped.EventContentUpdated += ContentUpdated; iWrapped.EventContentAdded += ContentAdded; iWrapped.EventContentRemoved += ContentRemoved; }
public LocalPlaylistsRootOk(string aRootId, LocalPlaylists aPlaylists, LocalPlaylistCreator aCreator) { iPlaylists = aPlaylists; iPlaylists.EventPlaylistAdded += PlaylistAdded; iPlaylists.EventPlaylistRemoved += PlaylistRemoved; iPlaylists.EventPlaylistsChanged += PlaylistsChanged; iCreator = aCreator; iMetadata = new playlistContainer(); iMetadata.Id = aRootId; iMetadata.Title = aRootId; iMetadata.ChildCount = (int)iPlaylists.Count; iMetadata.Restricted = false; iMetadata.Searchable = true; }
public SaveSupport(HelperKinsky aHelper, SharedPlaylists aSharedPlaylists, OptionBool aOptionSharedPlaylists, LocalPlaylists aLocalPlaylists, OptionBool aOptionLocalPlaylists) { iInvoker = aHelper.Invoker; iOptionSaveLocation = new OptionString("savelocation", "Save Location", "Location to save playlists to", "Local Playlists"); aHelper.AddOption(iOptionSaveLocation); iOptionSaveLocation.EventValueChanged += SaveLocationChanged; iSharedPlaylists = aSharedPlaylists; iSharedPlaylists.EventContentAdded += PlaylistsChanged; iSharedPlaylists.EventContentRemoved += PlaylistsChanged; iSharedPlaylists.EventContentUpdated += PlaylistsChanged; iOptionSharedPlaylists = aOptionSharedPlaylists; iOptionSharedPlaylists.EventValueChanged += PlaylistsChanged; iLocalPlaylists = aLocalPlaylists; iOptionLocalPlaylists = aOptionLocalPlaylists; iOptionLocalPlaylists.EventValueChanged += PlaylistsChanged; PlaylistsChanged(this, EventArgs.Empty); }