Esempio n. 1
0
        public LocalPlaylists(IHelper aHelper, bool aAddOptionPage)
        {
            iLock = new object();

            iOptionSaveDirectory = new OptionFolderPath("playlistpath", "Local playlist path", "Path where local playlists are saved", Path.Combine(aHelper.DataPath.FullName, "Playlists"));

            if (aAddOptionPage)
            {
                // create the options page
                OptionPage optionPage = new OptionPage("Local Playlists");
                optionPage.Add(iOptionSaveDirectory);
                aHelper.AddOptionPage(optionPage);
            }
            else
            {
                aHelper.AddOption(iOptionSaveDirectory);
            }

            // listen for changes to the save directory option
            iOptionSaveDirectory.EventValueChanged += SaveDirectoryChanged;

            // initialise as being in its error state
            iPlaylists = null;
            iWrapped   = new LocalPlaylistsRootError(kRootId);
            iWrapped.EventContentUpdated += ContentUpdated;
            iWrapped.EventContentAdded   += ContentAdded;
            iWrapped.EventContentRemoved += ContentRemoved;

            Refresh();
        }
Esempio n. 2
0
        private void InitialisePlaylistFolder()
        {
            try
            {
                iPlaylists = new LocalPlaylistsRoot(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);
            }
            else
            {
                iWrapped = new LocalPlaylistsRootError(kRootId);
            }

            iWrapped.EventContentUpdated += ContentUpdated;
            iWrapped.EventContentAdded   += ContentAdded;
            iWrapped.EventContentRemoved += ContentRemoved;
        }
Esempio n. 3
0
        public LocalPlaylistsRoot(LocalPlaylistCreator aCreator, OptionFolderPath aOptionSaveDirectory)
        {
            iLock                = new object();
            iCreator             = aCreator;
            iOptionSaveDirectory = aOptionSaveDirectory;

            // initialise as being in its error state
            iPlaylists = null;
            iWrapped   = new LocalPlaylistsRootError(kRootId);
            iWrapped.EventContentUpdated += ContentUpdated;
            iWrapped.EventContentAdded   += ContentAdded;
            iWrapped.EventContentRemoved += ContentRemoved;

            Refresh();
        }