public SettingsControlViewModel(Ratelimiter limitHandler, UpdateChecker updateChecker) { CheckForUpdate(updateChecker); RefreshLimits = new RelayCommand(async o => { try { var info = await limitHandler.GetImgurLimitInfo(); MaxClientLimit = info.Item1; MaxUserLimit = info.Item2; RemainingClientLimit = info.Item3; RemainingUserLimit = info.Item4; } catch (InvalidClientIDException) { MessageBox.Show("The provided Imgur ID is invalid. All subsequent API calls to the Imgur will fail.\nPlease change the Imgur ID and restart the program.", "ImageDownloader - Invalid Imgur ID"); MaxClientLimit = -1; MaxUserLimit = -1; RemainingClientLimit = -1; RemainingUserLimit = -1; } }); RestoreDefaults = new RelayCommand(o => { Settings.ResetDefaults(); LoadSettings.Execute(null); }); SaveSettings = new RelayCommand(o => { Settings.SetImgurClientID(string.IsNullOrWhiteSpace(ImgurSetting) ? string.Empty : ImgurSetting); Settings.SetFallbackHeight(FallbackImageDimensionsForNonsupportedImageTypes_Height); Settings.SetFallbackWidth(FallbackImageDimensionsForNonsupportedImageTypes_Width); var stringcollection = new StringCollection(); stringcollection.AddRange(SupportedExtensions.ToLower().Split(',')); Settings.SetSupportedExtensions(stringcollection); Settings.Save(); LoadSettings.Execute(null); }); LoadSettings = new RelayCommand(o => { ImgurSetting = Settings.GetImgurClientID(); FallbackImageDimensionsForNonsupportedImageTypes_Height = Settings.GetFallbackHeight(); FallbackImageDimensionsForNonsupportedImageTypes_Width = Settings.GetFallbackWidth(); var builder = new StringBuilder(); foreach (var ext in Settings.GetSupportedExtensions()) { builder.Append(ext); builder.Append(","); } SupportedExtensions = builder.ToString().TrimEnd(','); }); }