示例#1
0
        public BuffersWindow()
        {
            // language stuff needs to happen before InitializeComponent
            if (!settings.DontShowFirstTimeWizard)
            {
                // find out what language was used in the installer and use it for the first time wizard and everything else
                SetThreadToInstallationLanguage();
                DisplayFirstTimeWizard();
            }
            else
            {
                // if a language code is set in settings, set it on the thread
                if (settings.UILanguageCode != 0)
                {
                    Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(settings.UILanguageCode);
                }
            }
            InitializeComponent();
            InitializeTrayIcon();
            Commands                 = new Dictionary <string, HotkeyCommandBase>();
            playbackManager          = new PlaybackManager(settings.OutputDeviceID, settings.UseDirectSound);
            playbackManager.OnError += new PlaybackManager.PlaybackManagerErrorHandler(StreamingError);

            SetupFormEventHandlers();
            Buffers          = new BufferListCollection();
            _playQueueBuffer = new BufferList("Play Queue", false);
            Buffers.Add(_playQueueBuffer);
            Buffers.Add(new PlaylistContainerBufferList("Playlists", false));
            spotify = SpotifyClient.Instance;
            _trayIconMenuManager      = new TrayIconMenuManager(Buffers, Commands, _trayIcon);
            settings.PropertyChanged += new PropertyChangedEventHandler(OnUserSettingChange);
        }
        private BufferList CreateSearchBuffer(Search search)
        {
            buffers.Add(new SearchBufferList(search));
            buffers.CurrentListIndex = buffers.Count - 1;
            var searchBuffer = buffers.CurrentList;

            return(searchBuffer);
        }
示例#3
0
        private void LoadPlaylist(BufferItem item)
        {
            PlaylistBufferItem pbi = item as PlaylistBufferItem;

            _output.OutputMessage(StringStore.LoadingPlaylist, false);
            var playlist = SpotifyController.GetPlaylist(pbi.Model.Pointer, true);

            buffers.Add(new PlaylistBufferList(playlist));
            buffers.CurrentListIndex = buffers.Count - 1;
            var playlistBuffer = buffers.CurrentList;

            _output.OutputMessage(playlistBuffer.ToString(), false);
            _output.OutputMessage(String.Format("{0} {1}", playlist.TrackCount, StringStore.TracksLoaded), false);
            var tracks = playlist.GetTracks();

            tracks.ForEach(t =>
            {
                playlistBuffer.Add(new TrackBufferItem(t));
            });
        }