/// <summary> /// Invoked when the property of the Settings manager changes. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private static void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { if (e.PropertyName == "MediaState") { RefreshSleepPrevention(); } }
/// <summary> /// Invoked when a property of SettingsManager changes. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { if (e.PropertyName == "CurrentEqualizerProfile") { Refresh(); } }
/// <summary> /// Invoked when the property of the Service manager changes. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private static void ServiceManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { if (e.PropertyName == "Linked" || e.PropertyName == "Synchronize") { RefreshSleepPrevention(); } }
/// <summary> /// Invoked when a property of the settings manager changes /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "Seek": UpdateInfo(); break; case "BufferSize": SongProgress.SecondValue = SettingsManager.BufferSize * (SongProgress.Maximum / 10.0); break; case "Volume": VolumeSlide.Value = SettingsManager.Volume; break; case "Shuffle": UpdateShuffle(); break; case "Repeat": UpdateRepeat(); break; case "CurrentTrack": UpdateInfo(); ClearBookmarks(); if (SettingsManager.CurrentTrack != null) { TrackData libraryTrack = MediaManager.GetLibrarySourceTrack(SettingsManager.CurrentTrack); if (libraryTrack.Bookmarks != null) { foreach (double b in libraryTrack.Bookmarks) { AddBookmark(b); } } } break; case "MediaState": switch (SettingsManager.MediaState) { case MediaState.Playing: PausePlayButton.Style = (Style)FindResource("PauseButtonStyle"); break; case MediaState.Paused: case MediaState.Stopped: PausePlayButton.Style = (Style)FindResource("PlayButtonStyle"); break; } break; } })); }
/// <summary> /// Invoked when a property of the settings manager changes. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { switch (e.PropertyName) { case "CurrentVisualizer": RefreshMeta(); break; } }
/// <summary> /// Invoked when a property of the SettingsMananger is changed. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private static void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { switch (e.PropertyName) { case "Plugins": SettingsManager.Plugins.CollectionChanged += new NotifyCollectionChangedEventHandler(Plugins_CollectionChanged); break; case "CurrentVisualizer": ActivateVisualizer(SettingsManager.CurrentVisualizer); break; } }
/// <summary> /// Invoked when a property of the settings manager changes /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "SoundCloudListConfig": Config = SettingsManager.SoundCloudListConfig; SettingsManager.SoundCloudListConfig.PropertyChanged += new PropertyChangedEventHandler(Config_PropertyChanged); break; } })); }
/// <summary> /// Invoked when a property of SettingsManager is changed. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { switch (e.PropertyName) { case "CurrentSelectedNavigation": TreeViewItem tvi = GetItem(SettingsManager.CurrentSelectedNavigation); if (tvi != null && !tvi.IsSelected) { tvi.IsSelected = true; tvi.Focus(); } RefreshVisualizerVisibility(); break; } }
/// <summary> /// Invoked when a property changes in the service manager. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void ServiceManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "DeviceName": DeviceName.Edited -= DeviceName_Edited; DeviceName.Text = e.NewValue as string; DeviceNameLoading.Visibility = Visibility.Collapsed; DeviceName.Visibility = Visibility.Visible; DeviceName.Edited += DeviceName_Edited; break; case "UserName": UserName.Text = e.NewValue as string; UserNameLoading.Visibility = Visibility.Collapsed; UserName.Visibility = Visibility.Visible; break; case "Linked": U.L(LogLevel.Debug, "CONTROL", "Detected change in service link state"); linkingCloud = false; RefreshServiceGUI(); break; case "Links": U.L(LogLevel.Debug, "CONTROL", "Detected change in links to third parties"); RefreshLinks(); CloudBrowserIsLoading = false; break; case "Synchronize": RefreshSyncGUI(); break; case "Connected": Connected.Visibility = ServiceManager.Connected ? Visibility.Visible : Visibility.Collapsed; Disconnected.Visibility = ServiceManager.Connected ? Visibility.Collapsed : Visibility.Visible; if (ServiceManager.Connected) { Connect(); } break; } })); }
/// <summary> /// Invoked when a property of the settings manager changes /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private static void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { switch (e.PropertyName) { case "UpgradePolicy": if (SettingsManager.UpgradePolicy == UpgradePolicy.Manual) { Stop(); } else { Start(); Probe(null); } break; } }
/// <summary> /// Invoked when a property of the settings manager changes /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "YouTubeListConfig": Config = SettingsManager.YouTubeListConfig; SettingsManager.YouTubeListConfig.PropertyChanged += new PropertyChangedEventHandler(Config_PropertyChanged); break; case "YouTubeFilter": if (String.IsNullOrWhiteSpace(SettingsManager.YouTubeListConfig.Filter)) { FillDefaultTracks(); } else { Search(SettingsManager.YouTubeListConfig.Filter); } break; } })); }
/// <summary> /// Invoked when a property of the settings manager is changed /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private static void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { if (Identity == null) return; // create query string switch (e.PropertyName) { case "Volume": if (SynchronizeConfiguration) PushConfigUpdate("volume", Convert.ToString(SettingsManager.Volume)); break; case "Repeat": if (SynchronizeConfiguration) PushConfigUpdate("repeat", SettingsManager.Repeat.ToString()); break; case "Shuffle": if (SynchronizeConfiguration) PushConfigUpdate("shuffle", SettingsManager.Shuffle ? "Random" : "Off"); break; case "MediaState": if (SynchronizeConfiguration) PushConfigUpdate("media_state", SettingsManager.MediaState == MediaState.Playing ? "Playing" : "Paused"); if (SettingsManager.MediaState == MediaState.Stopped) currentListen = null; if (SettingsManager.MediaState == MediaState.Playing && SettingsManager.CurrentTrack != null) { string path = SettingsManager.CurrentTrack.Path; if (listenQueue.ContainsKey(path)) { // listen has been submitted but no reply yet listenQueue[path] = new Tuple<bool, DateTime>(false, listenQueue[path].Item2); } else { if (idOfCurrentListen <= 0) { // no listen submitted yet stampOfCurrentListen = DateTime.Now; StartListen(); } else { // update listen to reflect new exepcted end time double pos = MediaManager.Position; double len = MediaManager.Length; DateTime expectedEnd = DateTime.UtcNow.AddSeconds(len - pos); UpdateListen(expectedEnd); } } } else if (SettingsManager.CurrentTrack != null) { string path = SettingsManager.CurrentTrack.Path; if (listenQueue.ContainsKey(path)) { // listen has been submitted but no reply yet DateTime stamp = listenQueue[path].Item2; TimeSpan diff = DateTime.Now - stamp; if (diff.TotalSeconds < minimumListenTime) listenQueue[path] = new Tuple<bool, DateTime>(true, stamp); } else { if (idOfCurrentListen <= 0) return; // update listen to reflect exepcted end time UpdateListen(DateTime.UtcNow); } } break; case "CurrentTrack": // TODO: we need to be able to properly serialize nested JSON stuff in PerformSyncOut() //if (SynchronizeConfiguration) // PushConfigUpdate("current_track", TrackToJSON(SettingsManager.CurrentTrack)); break; case "SyncPlaylists": SyncPlaylists(); break; case "SyncConfig": SyncConfig(); break; default: return; } }
/// <summary> /// Invoked when a property of the settings manager changes. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "DetailsPaneHeight": DetailsRow.Height = new GridLength(SettingsManager.DetailsPaneHeight); break; case "DetailsPaneVisible": UpdateVisibility("details"); break; case "MenuBarVisible": UpdateVisibility("menubar"); break; case "NavigationPaneWidth": NavigationColumn.Width = new GridLength(SettingsManager.NavigationPaneWidth); break; case "Language": CultureInfo ci = CultureInfo.GetCultureInfo(SettingsManager.Language); LanguageContext.Instance.Culture = ci; Thread.CurrentThread.CurrentUICulture = ci; RefreshStrings(); break; case "CurrentSelectedNavigation": SwitchNavigation(); break; case "CurrentTrack": if (SettingsManager.CurrentSelectedNavigation == "Video") if (SettingsManager.CurrentTrack == null) { InfoPaneTitle.Text = U.T("PlaybackEmpty"); InfoPaneSubtitle.Text = ""; } else { InfoPaneTitle.Text = SettingsManager.CurrentTrack.Title; InfoPaneSubtitle.Text = SettingsManager.CurrentTrack.Artist; } break; case "CurrentVisualizer": if (SettingsManager.CurrentSelectedNavigation == "Visualizer") { InfoPaneTitle.Text = VisualizerContainer.Title; InfoPaneSubtitle.Text = VisualizerContainer.Description; } UpdateSelectedVisualizer(); break; case "MediaState": switch (SettingsManager.MediaState) { case Core.MediaState.Playing: if (taskbarPlay != null) taskbarPlay.Icon = Properties.Resources.Pause; if (trayMenuPlay != null) trayMenuPlay.Header = "Pause"; if (jumpTaskPlay != null) jumpTaskPlay.Title = "Pause"; if (YouTubeManager.IsYouTube(SettingsManager.CurrentTrack) && VideoContainer != null) { if (VideoContainer.BrowserVisibility != Visibility.Visible) VideoContainer.BrowserVisibility = Visibility.Visible; } else if (VideoContainer != null) { if (VideoContainer.BrowserVisibility != Visibility.Collapsed) VideoContainer.BrowserVisibility = Visibility.Collapsed; } break; case Core.MediaState.Paused: case Core.MediaState.Stopped: if (taskbarPlay != null) taskbarPlay.Icon = Properties.Resources.Play; if (trayMenuPlay != null) trayMenuPlay.Header = "Play"; if (jumpTaskPlay != null) jumpTaskPlay.Title = "Play"; break; } break; case "QueueListConfig": QueueTracks.Config = SettingsManager.QueueListConfig; SettingsManager.QueueListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged); break; case "YouTubeListConfig": SettingsManager.YouTubeListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged); break; case "SoundCloudListConfig": SettingsManager.SoundCloudListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged); break; case "RadioListConfig": RadioTracks.Config = SettingsManager.RadioListConfig; SettingsManager.RadioListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged); break; case "JamendoListConfig": SettingsManager.JamendoListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged); break; case "DiscListConfig": DiscTracks.Config = SettingsManager.DiscListConfig; SettingsManager.DiscListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged); break; case "HistoryListConfig": HistoryTracks.Config = SettingsManager.HistoryListConfig; SettingsManager.HistoryListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged); break; case "FileListConfig": FileTracks.Config = SettingsManager.FileListConfig; SettingsManager.FileListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged); break; } })); }
/// <summary> /// Invoked when a property of the settings manager changes /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "SoundCloudListConfig": Config = SettingsManager.SoundCloudListConfig; SettingsManager.SoundCloudListConfig.PropertyChanged += new PropertyChangedEventHandler(Config_PropertyChanged); break; } })); }
/// <summary> /// Invoked when a property of SettingsManager is changed. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { switch (e.PropertyName) { case "CurrentSelectedNavigation": TreeViewItem tvi = GetItem(SettingsManager.CurrentSelectedNavigation); if (tvi != null && !tvi.IsSelected) { tvi.IsSelected = true; tvi.Focus(); } break; } }
/// <summary> /// Invoked when the property of the Settings manager changes. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private static void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { if (e.PropertyName == "MediaState") RefreshSleepPrevention(); }
/// <summary> /// Invoked when a property of the settings manager changes /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "SourceListConfig": Sources.List.Config = SettingsManager.SourceListConfig; break; case "FastStart": DoFastStart.IsChecked = SettingsManager.FastStart; break; case "ShowOSD": PrefOSD.IsChecked = SettingsManager.ShowOSD; break; case "OpenAddPolicy": OpenFileAddDescriptionConverter aconv = new OpenFileAddDescriptionConverter(); string apolicy = (string)aconv.Convert(SettingsManager.OpenAddPolicy, null, null, null); foreach (ComboBoxItem cbi in AddPolicyCombo.Items) { if ((string)cbi.Content == apolicy) { AddPolicyCombo.SelectedItem = cbi; break; } } break; case "OpenPlayPolicy": OpenFilePlayDescriptionConverter pconv = new OpenFilePlayDescriptionConverter(); string ppolicy = (string)pconv.Convert(SettingsManager.OpenPlayPolicy, null, null, null); foreach (ComboBoxItem cbi in PlayPolicyCombo.Items) { if ((string)cbi.Content == ppolicy) { PlayPolicyCombo.SelectedItem = cbi; break; } } break; case "SearchPolicy": SearchPolicyDescriptionConverter sconv = new SearchPolicyDescriptionConverter(); string spolicy = (string)sconv.Convert(SettingsManager.SearchPolicy, null, null, null); foreach (ComboBoxItem cbi in SearchPolicyCombo.Items) { if ((string)cbi.Content == spolicy) { SearchPolicyCombo.SelectedItem = cbi; break; } } break; case "UpgradePolicy": UpgradePolicyDescriptionConverter uconv = new UpgradePolicyDescriptionConverter(); string upolicy = (string)uconv.Convert(SettingsManager.UpgradePolicy, null, null, null); foreach (ComboBoxItem cbi in UpgradePolicyCombo.Items) { if ((string)cbi.Content == upolicy) { UpgradePolicyCombo.SelectedItem = cbi; break; } } break; } })); }
/// <summary> /// Invoked when a property of the settings manager changes /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "Seek": UpdateInfo(); break; case "BufferSize": SongProgress.SecondValue = SettingsManager.BufferSize; break; case "Volume": VolumeSlide.Value = SettingsManager.Volume; break; case "Shuffle": UpdateShuffle(); break; case "Repeat": UpdateRepeat(); break; case "CurrentTrack": UpdateInfo(); ClearBookmarks(); if (SettingsManager.CurrentTrack != null) { TrackData libraryTrack = MediaManager.GetLibrarySourceTrack(SettingsManager.CurrentTrack); if (libraryTrack.Bookmarks != null) foreach (double b in libraryTrack.Bookmarks) AddBookmark(b); } break; case "MediaState": switch (SettingsManager.MediaState) { case Core.MediaState.Playing: PausePlayButton.Style = (Style)FindResource("PauseButtonStyle"); break; case Core.MediaState.Paused: case Core.MediaState.Stopped: PausePlayButton.Style = (Style)FindResource("PlayButtonStyle"); break; } break; } })); }
/// <summary> /// Invoked when a property of the settings manager changes /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { switch (e.PropertyName) { case "YouTubeListConfig": Config = SettingsManager.YouTubeListConfig; SettingsManager.YouTubeListConfig.PropertyChanged += new PropertyChangedEventHandler(Config_PropertyChanged); break; case "YouTubeFilter": if (String.IsNullOrWhiteSpace(SettingsManager.YouTubeListConfig.Filter)) FillDefaultTracks(); else Search(SettingsManager.YouTubeListConfig.Filter); break; } })); }
/// <summary> /// Invoked when the property of the Service manager changes. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private static void ServiceManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { if (e.PropertyName == "Linked" || e.PropertyName == "Synchronize") RefreshSleepPrevention(); }
/// <summary> /// Invoked when a property of SettingsManager changes. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void SettingsManager_PropertyChanged(object sender, PropertyChangedWithValuesEventArgs e) { if (e.PropertyName == "CurrentEqualizerProfile") { Refresh(); } }