/// <summary> /// Opens the control panel view. /// </summary> /// <param name="tab">The control panel tab to switch to</param> private void OpenControlPanel(ControlPanel.Tab tab = Stoffi.ControlPanel.Tab.General) { InitControlPanel(); MusicPanel.Visibility = System.Windows.Visibility.Collapsed; var elements = new FrameworkElement[] { FileTracks, HistoryTracks, QueueTracks, RadioTracks, SoundCloudTracks, JamendoTracks, YouTubeTracks, VideoContainer, VisualizerContainer }; foreach (FrameworkElement element in elements) if (element != null && element != FileTracks) element.Visibility = Visibility.Collapsed; foreach (DictionaryEntry pltl in PlaylistTrackLists) if (pltl.Value != null) ((ViewDetails)pltl.Value).Visibility = Visibility.Collapsed; if (!MainContainer.Children.Contains(ControlPanel)) MainContainer.Children.Add(ControlPanel); PlaybackControls.Search.IsEnabled = false; ControlPanel.SwitchTab(tab); }
/// <summary> /// Initializes the control panel control. /// </summary> private void InitControlPanel() { if (ControlPanel != null) return; Cursor = Cursors.Wait; ControlPanel = new ControlPanel(); ControlPanel.ParentWindow = this; ControlPanel.Services.BrowserBorder.Child = null; ContentContainer.Children.Add(ControlPanel.Services.Browser); ContentContainer.Children.Remove(ControlPanel.Services.Browser); ControlPanel.Services.BrowserBorder.Child = ControlPanel.Services.Browser; ControlPanel.InitShortcuts(); ControlPanel.Sources.AddFileClick += new RoutedEventHandler(AddFile_Click); ControlPanel.Sources.AddFolderClick += new RoutedEventHandler(AddFolder_Click); ControlPanel.Sources.IgnoreFileClick += new RoutedEventHandler(IgnoreFile_Click); ControlPanel.Sources.IgnoreFolderClick += new RoutedEventHandler(IgnoreFolder_Click); Cursor = Cursors.Arrow; }