public void SetOptionAndUpdatePreview <T>(T value, IOption option, string preview) { if (option is Option <T> ) { Options = Options.WithChangedOption((Option <T>)option, value); } else if (option is PerLanguageOption <T> ) { Options = Options.WithChangedOption((PerLanguageOption <T>)option, Language, value); } else { throw new InvalidOperationException("Unexpected option type"); } UpdateDocument(preview); }
internal OptionSet ApplyChangedOptions(OptionSet optionSet) { foreach (var optionKey in this.Options.GetChangedOptions(_originalOptions)) { optionSet = optionSet.WithChangedOption(optionKey, this.Options.GetOption(optionKey)); } return(optionSet); }
public override OptionSet WithChangedOption(OptionKey optionAndLanguage, object value) { return(new DocumentOptionSet(_backingOptionSet.WithChangedOption(optionAndLanguage, value), _language)); }