public UsersSettingsControlViewModel()
        {
            this.ExplicitUserRoleRequirements = new GenericToggleSettingsOptionControlViewModel(MixItUp.Base.Resources.ExplicitUserRoleRequirements,
                                                                                                ChannelSession.Settings.ExplicitUserRoleRequirements, (value) => { ChannelSession.Settings.ExplicitUserRoleRequirements = value; }, MixItUp.Base.Resources.ExplicitUserRoleRequirementsTooltip);

            this.ClearMixerUserData = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.ClearMixerUserDataHeader, MixItUp.Base.Resources.ClearMixerUserData, this.CreateCommand(async(parameter) =>
            {
                if (await DialogHelper.ShowConfirmation(MixItUp.Base.Resources.ClearAllMixerUserDataWarning))
                {
                    ChannelSession.Settings.ClearMixerUserData();
                    await ChannelSession.SaveSettings();
                    GlobalEvents.RestartRequested();
                }
            }));

            this.ClearUserData = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.ClearAllUserDataHeader, MixItUp.Base.Resources.ClearUserData, this.CreateCommand(async(parameter) =>
            {
                if (await DialogHelper.ShowConfirmation(MixItUp.Base.Resources.ClearAllUserDataWarning))
                {
                    await ChannelSession.Settings.ClearAllUserData();
                    await ChannelSession.SaveSettings();
                    GlobalEvents.RestartRequested();
                }
            }));

            this.RefreshTitleList();

            this.AddCommand = this.CreateCommand(async(parameter) =>
            {
                if (string.IsNullOrEmpty(this.TitleName))
                {
                    await DialogHelper.ShowMessage(Resources.CreateTitleErrorNoTitle);
                    return;
                }

                if (this.CanSelectMinimumMonths && this.MinimumMonths < 0)
                {
                    await DialogHelper.ShowMessage(Resources.CreateTitleErrorInvalidMonths);
                    return;
                }

                if (this.Titles.Any(t => t.Name.Equals(this.TitleName)))
                {
                    await DialogHelper.ShowMessage(Resources.CreateTitleErrorDuplicateTitle);
                    return;
                }

                UserTitleViewModel existingTitle = this.Titles.FirstOrDefault(t => t.Role.Equals(this.SelectedRole));
                if (existingTitle != null)
                {
                    if (existingTitle.Role == UserRoleEnum.Follower || existingTitle.Role == UserRoleEnum.Subscriber)
                    {
                        if (existingTitle.Months == this.MinimumMonths)
                        {
                            await DialogHelper.ShowMessage(Resources.CreateTitleErrorDuplicateRoleMonths);
                            return;
                        }
                    }
                    else
                    {
                        await DialogHelper.ShowMessage(Resources.CreateTitleErrorDuplicateRole);
                        return;
                    }
                }

                ChannelSession.Settings.UserTitles.Add(new UserTitleModel(this.TitleName, this.SelectedRole, this.MinimumMonths));
                this.RefreshTitleList();
            });
        }
        public UsersSettingsControlViewModel()
        {
            this.ClearMixerUserData = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.ClearMixerUserDataHeader, MixItUp.Base.Resources.ClearMixerUserData, this.CreateCommand(async(parameter) =>
            {
                if (await DialogHelper.ShowConfirmation(MixItUp.Base.Resources.ClearAllMixerUserDataWarning))
                {
                    ChannelSession.Settings.ClearMixerUserData();
                    await ChannelSession.SaveSettings();
                    GlobalEvents.RestartRequested();
                }
            }));

            this.ClearUserData = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.ClearAllUserDataHeader, MixItUp.Base.Resources.ClearUserData, this.CreateCommand(async(parameter) =>
            {
                if (await DialogHelper.ShowConfirmation(MixItUp.Base.Resources.ClearAllUserDataWarning))
                {
                    await ChannelSession.Settings.ClearAllUserData();
                    await ChannelSession.SaveSettings();
                    GlobalEvents.RestartRequested();
                }
            }));

            this.RefreshTitleList();

            this.AddCommand = this.CreateCommand(async(parameter) =>
            {
                if (string.IsNullOrEmpty(this.TitleName))
                {
                    await DialogHelper.ShowMessage("A name for the title must be specified");
                    return;
                }

                if (this.CanSelectMinimumMonths && this.MinimumMonths < 0)
                {
                    await DialogHelper.ShowMessage("A valid amount of months for the title must be specified");
                    return;
                }

                if (this.Titles.Any(t => t.Name.Equals(this.TitleName)))
                {
                    await DialogHelper.ShowMessage("A title with the same name already exists");
                    return;
                }

                UserTitleViewModel existingTitle = this.Titles.FirstOrDefault(t => t.Role.Equals(this.SelectedRole));
                if (existingTitle != null)
                {
                    if (existingTitle.Role == UserRoleEnum.Follower || existingTitle.Role == UserRoleEnum.Subscriber)
                    {
                        if (existingTitle.Months == this.MinimumMonths)
                        {
                            await DialogHelper.ShowMessage("A title with the same role & months already exists");
                            return;
                        }
                    }
                    else
                    {
                        await DialogHelper.ShowMessage("A title with the same role already exists");
                        return;
                    }
                }

                ChannelSession.Settings.UserTitles.Add(new UserTitleModel(this.TitleName, this.SelectedRole, this.MinimumMonths));
                this.RefreshTitleList();
            });
        }
        public AdvancedSettingsControlViewModel()
        {
            this.BackupSettings = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.BackupYourCurrentSettings, MixItUp.Base.Resources.BackupSettings, this.CreateCommand(async() =>
            {
                string filePath = ChannelSession.Services.FileService.ShowSaveFileDialog(ChannelSession.Settings.Name + "." + SettingsV3Model.SettingsBackupFileExtension);
                if (!string.IsNullOrEmpty(filePath))
                {
                    await ChannelSession.Services.Settings.SavePackagedBackup(ChannelSession.Settings, filePath);
                }
            }));

            this.RestoreSettings = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.RestoreASettingsBackup, MixItUp.Base.Resources.RestoreSettings, this.CreateCommand(async() =>
            {
                string filePath = ChannelSession.Services.FileService.ShowOpenFileDialog(string.Format("Mix It Up Settings V2 Backup (*.{0})|*.{0}|All files (*.*)|*.*", SettingsV3Model.SettingsBackupFileExtension));
                if (!string.IsNullOrEmpty(filePath))
                {
                    Result <SettingsV3Model> result = await ChannelSession.Services.Settings.RestorePackagedBackup(filePath);
                    if (result.Success)
                    {
                        ChannelSession.AppSettings.BackupSettingsFilePath  = filePath;
                        ChannelSession.AppSettings.BackupSettingsToReplace = ChannelSession.Settings.ID;
                        GlobalEvents.RestartRequested();
                    }
                    else
                    {
                        await DialogHelper.ShowMessage(result.Message);
                    }
                }
            }));

            this.AutomaticBackupRate = new GenericComboBoxSettingsOptionControlViewModel <SettingsBackupRateEnum>(MixItUp.Base.Resources.AutomatedSettingsBackupRate, EnumHelper.GetEnumList <SettingsBackupRateEnum>(),
                                                                                                                  ChannelSession.Settings.SettingsBackupRate, (value) => { ChannelSession.Settings.SettingsBackupRate = value; });

            this.AutomaticBackupLocation = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.AutomatedSettingsBackupLocation, MixItUp.Base.Resources.SetLocation, this.CreateCommand(() =>
            {
                string folderPath = ChannelSession.Services.FileService.ShowOpenFolderDialog();
                if (!string.IsNullOrEmpty(folderPath) && Directory.Exists(folderPath))
                {
                    ChannelSession.Settings.SettingsBackupLocation = folderPath;
                    this.NotifyPropertyChanged("AutomaticBackupLocationFolderPath");
                }
            }));

            this.InstallationFolder = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.AccessTheFolderWhereMixItUpIsInstalled, MixItUp.Base.Resources.InstallationFolder, this.CreateCommand(() =>
            {
                ProcessHelper.LaunchFolder(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
            }));

            this.DiagnosticLogging = new GenericToggleSettingsOptionControlViewModel(MixItUp.Base.Resources.DiagnosticLogging, ChannelSession.AppSettings.DiagnosticLogging,
                                                                                     (value) => { ChannelSession.AppSettings.DiagnosticLogging = value; }, MixItUp.Base.Resources.DiagnosticLoggingToolip);

            this.RunNewUserWizard = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.ReRunNewUserWizard, MixItUp.Base.Resources.NewUserWizard, this.CreateCommand(async() =>
            {
                if (await DialogHelper.ShowConfirmation(Resources.RunNewUserWizardWarning))
                {
                    ChannelSession.Settings.ReRunWizard = true;
                    GlobalEvents.RestartRequested();
                }
            }));

            this.DeleteSettings = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.DeleteCurrentSettingsData, MixItUp.Base.Resources.DeleteSettings, this.CreateCommand(async() =>
            {
                if (await DialogHelper.ShowConfirmation(Resources.DeleteSettingsWarning))
                {
                    ChannelSession.AppSettings.SettingsToDelete = ChannelSession.Settings.ID;
                    GlobalEvents.RestartRequested();
                }
            }));
        }
        public AdvancedSettingsControlViewModel()
        {
            this.BackupSettings = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.BackupYourCurrentSettings, MixItUp.Base.Resources.BackupSettings, this.CreateCommand(async(parameter) =>
            {
                string filePath = ChannelSession.Services.FileService.ShowSaveFileDialog(ChannelSession.Settings.Name + "." + SettingsV3Model.SettingsBackupFileExtension);
                if (!string.IsNullOrEmpty(filePath))
                {
                    await ChannelSession.Services.Settings.SavePackagedBackup(ChannelSession.Settings, filePath);
                }
            }));

            this.RestoreSettings = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.RestoreASettingsBackup, MixItUp.Base.Resources.RestoreSettings, this.CreateCommand(async(parameter) =>
            {
                string filePath = ChannelSession.Services.FileService.ShowOpenFileDialog(string.Format("Mix It Up Settings V2 Backup (*.{0})|*.{0}|All files (*.*)|*.*", SettingsV3Model.SettingsBackupFileExtension));
                if (!string.IsNullOrEmpty(filePath))
                {
                    Result <SettingsV3Model> result = await ChannelSession.Services.Settings.RestorePackagedBackup(filePath);
                    if (result.Success)
                    {
                        ChannelSession.AppSettings.BackupSettingsFilePath  = filePath;
                        ChannelSession.AppSettings.BackupSettingsToReplace = ChannelSession.Settings.ID;
                        GlobalEvents.RestartRequested();
                    }
                    else
                    {
                        await DialogHelper.ShowMessage(result.Message);
                    }
                }
            }));

            this.AutomaticBackupRate = new GenericComboBoxSettingsOptionControlViewModel <SettingsBackupRateEnum>(MixItUp.Base.Resources.AutomatedSettingsBackupRate, EnumHelper.GetEnumList <SettingsBackupRateEnum>(),
                                                                                                                  ChannelSession.Settings.SettingsBackupRate, (value) => { ChannelSession.Settings.SettingsBackupRate = value; });

            this.AutomaticBackupLocation = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.AutomatedSettingsBackupLocation, MixItUp.Base.Resources.SetLocation, this.CreateCommand((parameter) =>
            {
                string folderPath = ChannelSession.Services.FileService.ShowOpenFolderDialog();
                if (!string.IsNullOrEmpty(folderPath) && Directory.Exists(folderPath))
                {
                    ChannelSession.Settings.SettingsBackupLocation = folderPath;
                }
                return(Task.FromResult(0));
            }));

            this.InstallationFolder = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.AccessTheFolderWhereMixItUpIsInstalled, MixItUp.Base.Resources.InstallationFolder, this.CreateCommand((parameter) =>
            {
                ProcessHelper.LaunchFolder(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
                return(Task.FromResult(0));
            }));

            this.DiagnosticLogging = new GenericToggleSettingsOptionControlViewModel(MixItUp.Base.Resources.DiagnosticLogging, ChannelSession.AppSettings.DiagnosticLogging,
                                                                                     (value) => { ChannelSession.AppSettings.DiagnosticLogging = value; }, MixItUp.Base.Resources.DiagnosticLoggingToolip);

            this.RunNewUserWizard = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.ReRunNewUserWizard, MixItUp.Base.Resources.NewUserWizard, this.CreateCommand(async(parameter) =>
            {
                if (await DialogHelper.ShowConfirmation("Mix It Up will restart and the New User Wizard will be re-run when you log in. This will allow you to re-import your data, which could duplicate and overwrite your Commands & User data. Are you sure you wish to do this?"))
                {
                    ChannelSession.Settings.ReRunWizard = true;
                    GlobalEvents.RestartRequested();
                }
            }));

            this.DeleteSettings = new GenericButtonSettingsOptionControlViewModel(MixItUp.Base.Resources.DeleteCurrentSettingsData, MixItUp.Base.Resources.DeleteSettings, this.CreateCommand(async(parameter) =>
            {
                if (await DialogHelper.ShowConfirmation("This will completely delete the settings of the currently logged in account and is not reversible. Are you sure you wish to do this?"))
                {
                    ChannelSession.AppSettings.SettingsToDelete = ChannelSession.Settings.ID;
                    GlobalEvents.RestartRequested();
                }
            }));
        }