Ejemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            tbHost.Text               = SnapSettings.Server;
            tbControlPort.Text        = SnapSettings.ControlPort.ToString(CultureInfo.CurrentCulture);
            tbPlayerPort.Text         = SnapSettings.PlayerPort.ToString(CultureInfo.CurrentCulture);
            cbAutoLaunch.IsChecked    = SnapSettings.LaunchesOnWindowsStartup();
            lbVersion.Content         = string.Format("{0}: {1}", Snapcast.ProductName, Snapcast.Version);
            cbAutoReconnect.IsChecked = SnapSettings.AutoReconnect;

            System.Tuple <AppTheme, Accent> activeTheme = ThemeManager.DetectAppStyle(Application.Current);

            m_AvailableThemes  = ThemeManager.AppThemes.ToArray();
            m_AvailableAccents = ThemeManager.Accents.ToArray();

            for (int i = 0; i < m_AvailableThemes.Length; i++)
            {
                cbTheme.Items.Add(m_AvailableThemes[i].Name);
                if (m_AvailableThemes[i].Name == activeTheme.Item1.Name)
                {
                    cbTheme.SelectedIndex = i;
                }
            }

            for (int i = 0; i < m_AvailableAccents.Length; i++)
            {
                cbAccent.Items.Add(m_AvailableAccents[i].Name);
                if (m_AvailableAccents[i].Name == activeTheme.Item2.Name)
                {
                    cbAccent.SelectedIndex = i;
                }
            }

            foreach (string s in m_DismissMethods)
            {
                cbDismiss.Items.Add(s);
            }

            cbDismiss.SelectedIndex = (int)SnapSettings.SnapControlDismissMethod;
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            tbHost.Text               = SnapSettings.Server;
            tbControlPort.Text        = SnapSettings.ControlPort.ToString(CultureInfo.CurrentCulture);
            tbPlayerPort.Text         = SnapSettings.PlayerPort.ToString(CultureInfo.CurrentCulture);
            cbAutoLaunch.IsChecked    = SnapSettings.LaunchesOnWindowsStartup();
            lbVersion.Content         = string.Format("{0}: {1}", Snapcast.ProductName, Snapcast.Version);
            cbAutoReconnect.IsChecked = SnapSettings.AutoReconnect;

            m_NotificationBehaviourRadioButtons.Add(SnapSettings.ENotificationBehaviour.Default, rbDefault);
            m_NotificationBehaviourRadioButtons.Add(SnapSettings.ENotificationBehaviour.AutoDismiss, rbAutoDismiss);
            m_NotificationBehaviourRadioButtons.Add(SnapSettings.ENotificationBehaviour.Disabled, rbDisable);

            m_DeviceMissingBehaviourRadioButtons.Add(SnapSettings.EDeviceMissingBehaviour.Default, rbMissingDeviceError);
            m_DeviceMissingBehaviourRadioButtons.Add(SnapSettings.EDeviceMissingBehaviour.RetrySilent, rbMissingDeviceRetry);

            m_NotificationBehaviourRadioButtons[SnapSettings.NotificationBehaviour].IsChecked   = true;
            m_DeviceMissingBehaviourRadioButtons[SnapSettings.DeviceMissingBehaviour].IsChecked = true;

            tbAutoDismissSeconds.Text      = SnapSettings.NotificationAutoDismissSeconds.ToString();
            tbAutoDismissSeconds.IsEnabled = (bool)rbAutoDismiss.IsChecked;

            tbMissingDeviceRetrySeconds.Text      = SnapSettings.DeviceMissingRetryIntervalSeconds.ToString();
            tbMissingDeviceRetrySeconds.IsEnabled = (bool)rbMissingDeviceRetry.IsChecked;

            tbMissingDeviceExpiryDays.Text = SnapSettings.DeviceMissingExpiryDays.ToString();

            cbHideOfflineClients.IsChecked = SnapSettings.HideOfflineClients;

            foreach (RadioButton rb in m_NotificationBehaviourRadioButtons.Values)
            {
                rb.Checked += rbNotificationBehaviourGroup_CheckChanged;
            }

            foreach (RadioButton rb in m_DeviceMissingBehaviourRadioButtons.Values)
            {
                rb.Checked += rbDeviceMissingBehaviourGroup_CheckChanged;
            }


            System.Tuple <AppTheme, Accent> activeTheme = ThemeManager.DetectAppStyle(Application.Current);

            m_AvailableThemes  = ThemeManager.AppThemes.ToArray();
            m_AvailableAccents = ThemeManager.Accents.ToArray();

            for (int i = 0; i < m_AvailableThemes.Length; i++)
            {
                cbTheme.Items.Add(m_AvailableThemes[i].Name);
                if (m_AvailableThemes[i].Name == activeTheme.Item1.Name)
                {
                    cbTheme.SelectedIndex = i;
                }
            }

            for (int i = 0; i < m_AvailableAccents.Length; i++)
            {
                cbAccent.Items.Add(m_AvailableAccents[i].Name);
                if (m_AvailableAccents[i].Name == activeTheme.Item2.Name)
                {
                    cbAccent.SelectedIndex = i;
                }
            }

            foreach (string s in m_DismissMethods)
            {
                cbDismiss.Items.Add(s);
            }

            cbDismiss.SelectedIndex = (int)SnapSettings.SnapControlDismissMethod;
        }