Esempio n. 1
0
 /// <summary>
 /// Make of a copy of the model.
 /// </summary>
 public ServerEntry(ServerList parent, ServerEntry model, int index = 0, bool selected = false)
 {
     m_Parent          = parent;
     Hostname          = model.Hostname;
     Port              = model.Port;
     EncryptedPassword = model.EncryptedPassword;
     ItemIndex         = index;
     IsSelected        = selected;
 }
Esempio n. 2
0
 public ServerEntry(ServerList parent, string hostname, int port, string encryptedPassword, int index = 0, bool selected = false)
 {
     m_Parent          = parent;
     Hostname          = hostname;
     Port              = port;
     EncryptedPassword = encryptedPassword;
     ItemIndex         = index;
     IsSelected        = selected;
 }
Esempio n. 3
0
        public SettingsWindow(DataModel dataModel)
        {
            InitializeComponent();
            ServerList  = new ServerList();
            DataContext = this;
            m_DataModel = dataModel;
            LoadSettings();

            ServerList.PropertyChanged += new PropertyChangedEventHandler(OnServerListChanged);
        }
Esempio n. 4
0
        private void LoadSettings()
        {
            m_UpdateIntervalEntry.Text    = Settings.Default.ViewUpdateInterval.ToString();
            m_NetworkTimeoutEntry.Text    = Settings.Default.NetworkTimeout.ToString();
            m_ReconnectIntervalEntry.Text = Settings.Default.ReconnectInterval.ToString();
            m_WheelVolumeStepEntry.Text   = Settings.Default.VolumeAdjustmentStep.ToString();
            m_WheelSongPositioningModeIsPercent.IsChecked = Settings.Default.MouseWheelAdjustsSongPositionInPercent;
            m_WheelSongPositioningModeIsSeconds.IsChecked = !m_WheelSongPositioningModeIsPercent.IsChecked;
            m_WheelSongPositioningPercentEntry.Text       = Settings.Default.MouseWheelAdjustsSongPositionPercentBy.ToString();
            m_WheelSongPositioningSecondsEntry.Text       = Settings.Default.MouseWheelAdjustsSongPositionSecondsBy.ToString();
            m_EnableVolumeControl.IsChecked        = Settings.Default.EnableVolumeControl;
            m_UseAlbumArtist.IsChecked             = Settings.Default.UseAlbumArtist;
            m_SortAlbumsByDate.IsChecked           = Settings.Default.AlbumSortingMode == AlbumSortingMode.ByDate.ToString();
            m_SortAlbumsByDirectory.IsChecked      = Settings.Default.AlbumSortingMode == AlbumSortingMode.ByDirectory.ToString();
            m_SortAlbumsByName.IsChecked           = m_SortAlbumsByDate.IsChecked != true && m_SortAlbumsByDirectory.IsChecked != true;
            m_QuickSearchTabIsVisible.IsChecked    = Settings.Default.QuickSearchTabIsVisible;
            m_AdvancedSearchTabIsVisible.IsChecked = Settings.Default.AdvancedTabIsVisible;
            m_ArtistListTabIsVisible.IsChecked     = Settings.Default.ArtistListTabIsVisible;
            m_ArtistTreeTabIsVisible.IsChecked     = Settings.Default.ArtistTreeTabIsVisible;
            m_GenreListTabIsVisible.IsChecked      = Settings.Default.GenreListTabIsVisible;
            m_GenreTreeTabIsVisible.IsChecked      = Settings.Default.GenreTreeTabIsVisible;
            m_FilesystemTabIsVisible.IsChecked     = Settings.Default.FilesystemTabIsVisible;
            m_StreamsTabIsVisible.IsChecked        = Settings.Default.StreamsTabIsVisible;
            m_PlaylistsTabIsVisible.IsChecked      = Settings.Default.PlaylistsTabIsVisible;
            SelectDefaultMusicCollectionTab(Settings.Default.DefaultMusicCollectionTab);
            ServerList.Deserialize(Settings.Default.Servers);
            OnServerListChanged(null, null);

            m_SendToPlaylistMethodAddAsNext.IsChecked      = Settings.Default.SendToPlaylistMethod == SendToPlaylistMethod.AddAsNext.ToString();
            m_SendToPlaylistMethodReplaceAndPlay.IsChecked = Settings.Default.SendToPlaylistMethod == SendToPlaylistMethod.ReplaceAndPlay.ToString();
            m_SendToPlaylistMethodAppend.IsChecked         = !m_SendToPlaylistMethodAddAsNext.IsChecked.Value && !m_SendToPlaylistMethodReplaceAndPlay.IsChecked.Value;

            string formats = "";

            foreach (string s in Settings.Default.AlbumDateFormats)
            {
                if (formats.Length > 0)
                {
                    formats += ";";
                }

                formats += s;
            }

            m_DateFormatsEntry.Text = formats;
        }
Esempio n. 5
0
 private void OnDeleteServerClicked(object sender, RoutedEventArgs e)
 {
     ServerList.RemoveSelected();
 }
Esempio n. 6
0
 private void OnAddServerClicked(object sender, RoutedEventArgs e)
 {
     ServerList.Add("localhost", 6600, "");
     m_ServerSettings.ScrollIntoView(ServerList.SelectedServer);
 }
Esempio n. 7
0
        private void SaveSettings()
        {
            AlbumSortingMode albumSortingMode;

            if (m_SortAlbumsByDate.IsChecked == true)
            {
                albumSortingMode = AlbumSortingMode.ByDate;
            }
            else if (m_SortAlbumsByDirectory.IsChecked == true)
            {
                albumSortingMode = AlbumSortingMode.ByDate;
            }
            else
            {
                albumSortingMode = AlbumSortingMode.ByName;
            }

            string servers         = ServerList.Serialize();
            bool   reconnectNeeded =
                m_UseAlbumArtist.IsChecked != Settings.Default.UseAlbumArtist ||
                albumSortingMode.ToString() != Settings.Default.AlbumSortingMode ||
                m_DateFormatsEntry.Text != StringCollectionAsString(Settings.Default.AlbumDateFormats) ||
                servers != Settings.Default.Servers;

            Settings.Default.Servers              = servers;
            Settings.Default.ViewUpdateInterval   = Utils.StringToInt(m_UpdateIntervalEntry.Text, 500);
            Settings.Default.NetworkTimeout       = Utils.StringToInt(m_NetworkTimeoutEntry.Text, 10);
            Settings.Default.ReconnectInterval    = Utils.StringToInt(m_ReconnectIntervalEntry.Text, 10);
            Settings.Default.VolumeAdjustmentStep = Utils.StringToInt(m_WheelVolumeStepEntry.Text, 5);
            Settings.Default.MouseWheelAdjustsSongPositionInPercent = m_WheelSongPositioningModeIsPercent.IsChecked.Value;
            Settings.Default.MouseWheelAdjustsSongPositionPercentBy = Utils.StringToInt(m_WheelSongPositioningPercentEntry.Text, 5);
            Settings.Default.MouseWheelAdjustsSongPositionSecondsBy = Utils.StringToInt(m_WheelSongPositioningSecondsEntry.Text, 5);
            Settings.Default.EnableVolumeControl       = m_EnableVolumeControl.IsChecked == true;
            Settings.Default.UseAlbumArtist            = m_UseAlbumArtist.IsChecked == true;
            Settings.Default.AlbumSortingMode          = albumSortingMode.ToString();
            Settings.Default.AlbumDateFormats          = StringAsStringCollection(m_DateFormatsEntry.Text);
            Settings.Default.QuickSearchTabIsVisible   = m_QuickSearchTabIsVisible.IsChecked == true;
            Settings.Default.ArtistListTabIsVisible    = m_ArtistListTabIsVisible.IsChecked == true;
            Settings.Default.ArtistTreeTabIsVisible    = m_ArtistTreeTabIsVisible.IsChecked == true;
            Settings.Default.GenreListTabIsVisible     = m_GenreListTabIsVisible.IsChecked == true;
            Settings.Default.GenreTreeTabIsVisible     = m_GenreTreeTabIsVisible.IsChecked == true;
            Settings.Default.FilesystemTabIsVisible    = m_FilesystemTabIsVisible.IsChecked == true;
            Settings.Default.AdvancedTabIsVisible      = m_AdvancedSearchTabIsVisible.IsChecked == true;
            Settings.Default.StreamsTabIsVisible       = m_StreamsTabIsVisible.IsChecked == true;
            Settings.Default.PlaylistsTabIsVisible     = m_PlaylistsTabIsVisible.IsChecked == true;
            Settings.Default.DefaultMusicCollectionTab = SelectedDefaultMusicCollectionTab().ToString();

            if (m_SendToPlaylistMethodAddAsNext.IsChecked == true)
            {
                Settings.Default.SendToPlaylistMethod = SendToPlaylistMethod.AddAsNext.ToString();
            }
            else if (m_SendToPlaylistMethodReplaceAndPlay.IsChecked == true)
            {
                Settings.Default.SendToPlaylistMethod = SendToPlaylistMethod.ReplaceAndPlay.ToString();
            }
            else
            {
                Settings.Default.SendToPlaylistMethod = SendToPlaylistMethod.Append.ToString();
            }

            Settings.Default.InitialSetupDone = true;
            Settings.Default.Save();

            m_DataModel.MainWindow.SettingsChanged(reconnectNeeded);
        }