Esempio n. 1
0
        public GeneralSettingsControlViewModel()
        {
            this.OptOutOfDataTracking = new GenericToggleSettingsOptionControlViewModel(MixItUp.Base.Resources.OptOutofDataTracking,
                                                                                        ChannelSession.Settings.OptOutTracking, (value) => { ChannelSession.Settings.OptOutTracking = value; }, MixItUp.Base.Resources.OptOutofDataTrackingTooltip);

            this.AutoLogIn = new GenericToggleSettingsOptionControlViewModel(MixItUp.Base.Resources.AutoLogInCurrentAccount,
                                                                             (ChannelSession.AppSettings.AutoLogInID == ChannelSession.Settings.ID),
                                                                             (value) => { ChannelSession.AppSettings.AutoLogInID = (value) ? ChannelSession.Settings.ID : Guid.Empty; },
                                                                             MixItUp.Base.Resources.AutoLogInCurrentAccountTooltip);

            this.PreviewProgram = new GenericToggleSettingsOptionControlViewModel(MixItUp.Base.Resources.UpdatePreviewProgram,
                                                                                  ChannelSession.AppSettings.PreviewProgram, (value) => { ChannelSession.AppSettings.PreviewProgram = value; }, MixItUp.Base.Resources.UpdatePreviewProgramTooltip);

            var languageOptions = EnumHelper.GetEnumList <LanguageOptions>().ToList();

            if (!ChannelSession.IsDebug())
            {
                languageOptions.Remove(LanguageOptions.Pseudo);
            }
            this.Language = new GenericComboBoxSettingsOptionControlViewModel <LanguageOptions>(MixItUp.Base.Resources.Language,
                                                                                                languageOptions.OrderBy(l => l.ToString()), ChannelSession.AppSettings.LanguageOption, (value) =>
            {
                ChannelSession.AppSettings.SettingsChangeRestartRequired = true;
                ChannelSession.AppSettings.LanguageOption = value;
            });

            this.DefaultStreamingSoftware = new GenericComboBoxSettingsOptionControlViewModel <StreamingSoftwareTypeEnum>(MixItUp.Base.Resources.DefaultStreamingSoftware,
                                                                                                                          new List <StreamingSoftwareTypeEnum>()
            {
                StreamingSoftwareTypeEnum.OBSStudio, StreamingSoftwareTypeEnum.XSplit, StreamingSoftwareTypeEnum.StreamlabsOBS
            },
                                                                                                                          ChannelSession.Settings.DefaultStreamingSoftware, (value) => { ChannelSession.Settings.DefaultStreamingSoftware = value; });

            string defaultAudioOption = SoundAction.DefaultAudioDevice;

            if (!string.IsNullOrEmpty(ChannelSession.Settings.DefaultAudioOutput))
            {
                defaultAudioOption = ChannelSession.Settings.DefaultAudioOutput;
            }

            List <string> audioOptions = new List <string>();

            audioOptions.Add(SoundAction.DefaultAudioDevice);
            audioOptions.AddRange(ChannelSession.Services.AudioService.GetOutputDevices());

            this.DefaultAudioOutput = new GenericComboBoxSettingsOptionControlViewModel <string>(MixItUp.Base.Resources.DefaultAudioOutput,
                                                                                                 audioOptions, defaultAudioOption, (value) =>
            {
                if (value.Equals(SoundAction.DefaultAudioDevice))
                {
                    ChannelSession.Settings.DefaultAudioOutput = null;
                }
                else
                {
                    ChannelSession.Settings.DefaultAudioOutput = value;
                }
            });
            this.DefaultAudioOutput.Width = 250;
        }
Esempio n. 2
0
        public ThemeSettingsControlViewModel()
        {
            this.ColorScheme = new GenericColorComboBoxSettingsOptionControlViewModel(MixItUp.Base.Resources.ColorScheme, ChannelSession.AppSettings.ColorScheme,
                                                                                      (value) =>
            {
                if (value != null)
                {
                    if (!string.Equals(ChannelSession.AppSettings.ColorScheme, value))
                    {
                        ChannelSession.AppSettings.SettingsChangeRestartRequired = true;
                    }
                    ChannelSession.AppSettings.ColorScheme = value;
                }
            });
            this.ColorScheme.RemoveNonThemes();

            this.BackgroundColor = new GenericComboBoxSettingsOptionControlViewModel <string>(MixItUp.Base.Resources.BackgroundColor, AvailableBackgroundColors, ChannelSession.AppSettings.BackgroundColor,
                                                                                              (value) =>
            {
                if (!string.Equals(ChannelSession.AppSettings.BackgroundColor, value))
                {
                    ChannelSession.AppSettings.SettingsChangeRestartRequired = true;
                }
                ChannelSession.AppSettings.BackgroundColor = value;
            });

            List <ThemeViewModel> themes = new List <ThemeViewModel>();

            foreach (var kvp in this.FullThemes)
            {
                themes.Add(new ThemeViewModel(kvp.Key, kvp.Value));
            }
            this.FullTheme = new GenericComboBoxSettingsOptionControlViewModel <ThemeViewModel>(MixItUp.Base.Resources.FullTheme, themes, themes.FirstOrDefault(t => t.Key.Equals(ChannelSession.AppSettings.FullThemeName)),
                                                                                                (value) =>
            {
                if (value != null)
                {
                    if (!string.Equals(ChannelSession.AppSettings.FullThemeName, value?.Key))
                    {
                        ChannelSession.AppSettings.SettingsChangeRestartRequired = true;
                    }
                    ChannelSession.AppSettings.FullThemeName = value?.Key;
                }
            });
        }