void InitSource() { var sources = new List <object> { "Embedded", "Custom", }; var customSourceItem = new EditorSettingsItemViewModel(null, "Custom source", "") { IsVisible = false, Action = (string value) => Markdown = value, }; var sourceTypeItem = new PickerSettingsViewModel(null, "Source", sources, "Embedded") { Action = (object value) => { var isCustom = $"{value}" == "Custom"; customSourceItem.IsVisible = false; switch ($"{value}") { case "Embedded": Markdown = embeded; break; case "Custom": customSourceItem.IsVisible = true; Markdown = customSourceItem.Value; break; } } }; SourceCard = new SettingsCardViewModel("Source") { Items = new ObservableCollection <SettingsItemViewModel> { sourceTypeItem, customSourceItem, } }; }
void InitSettings() { BasicSettings = new SettingsCardViewModel("Basic settings") { Items = new ObservableCollection <SettingsItemViewModel> { new SwitchSettingsItemViewModel(this, "Dark mode") { Action = (bool value) => isDarkTheme = value, }, new SwitchSettingsItemViewModel(this, "Use emoji and smiley extension") { Action = (bool value) => themeTemplate.UseEmojiAndSmileyExtension = value, }, new StepperSettingsItemViewModel(this, "Vertical spacing", (int)themeTemplate.VerticalSpacing) { Action = (int value) => themeTemplate.VerticalSpacing = value, }, new StepperSettingsItemViewModel(this, "Margin", (int)themeTemplate.Margin) { Action = (int value) => themeTemplate.Margin = value, } } }; ParagraphSettings = new SettingsCardViewModel("Paragraph settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Paragraph, showBorderSize: false)), }; Heading1Settings = new SettingsCardViewModel("Heading1 settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Heading1)), }; Heading2Settings = new SettingsCardViewModel("Heading2 settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Heading2)), }; Heading3Settings = new SettingsCardViewModel("Heading3 settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Heading3)), }; Heading4Settings = new SettingsCardViewModel("Heading4 settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Heading4)), }; Heading5Settings = new SettingsCardViewModel("Heading5 settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Heading5)), }; Heading6Settings = new SettingsCardViewModel("Heading6 settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Heading6)), }; CodeSettings = new SettingsCardViewModel("Code settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Code, showBorderSize: false)), }; QuoteSettings = new SettingsCardViewModel("Quote settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Quote)), }; LinkSettings = new SettingsCardViewModel("Link settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetMarkdownStyleSettings(themeTemplate.Link, showBorderSize: false)) { new SwitchSettingsItemViewModel(this, "YouTube preview") { Action = (bool value) => themeTemplate.Link.LoadYouTubePreview = value, }, new SwitchSettingsItemViewModel(this, "Use autolinks") { Action = (bool value) => themeTemplate.Link.UseAutolinksExtension = value, }, new EntrySettingsItemViewModel(this, "Open link title", themeTemplate.Link.OpenLinkSheetTitle) { Action = (string value) => themeTemplate.Link.OpenLinkSheetTitle = value, }, new EntrySettingsItemViewModel(this, "Open link cancel", themeTemplate.Link.OpenLinkSheetCancel) { Action = (string value) => themeTemplate.Link.OpenLinkSheetCancel = value, }, } }; UnorderedListSettings = new SettingsCardViewModel("Unordered list settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetListStyleSettings(themeTemplate.UnorderedList)), }; OrderedListSettings = new SettingsCardViewModel("Ordered list settings") { Items = new ObservableCollection <SettingsItemViewModel>(GetListStyleSettings(themeTemplate.OrderedList)), }; }