コード例 #1
0
        private void ListviewMarkdownHtml_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            RenderingSettingsItemContent.Children.Clear();

            var item = (RenderModel)((ListView)sender).SelectedItem;

            switch (item)
            {
            case CoreRenderModel coreRenderModel:
                var coreControl = new CoreControl();
                coreControl.Init(coreRenderModel);
                RenderingSettingsItemContent.Children.Add(coreControl);
                break;

            case EmphasisExtraRenderModel emphasisExtraModel:
                var emphasisExtraControl = new EmphasisExtraControl();
                emphasisExtraControl.Init(emphasisExtraModel);
                RenderingSettingsItemContent.Children.Add(emphasisExtraControl);
                break;

            case TableRenderModel tableModel:
                var tableControl = new TableControl();
                tableControl.Init(tableModel);
                RenderingSettingsItemContent.Children.Add(tableControl);
                break;

            case ListRenderModel listModel:
                var listControl = new ListControl();
                listControl.Init(listModel);
                RenderingSettingsItemContent.Children.Add(listControl);
                break;

            case MathRenderModel mathModel:
                var mathControl = new MathControl();
                mathControl.Init(mathModel);
                RenderingSettingsItemContent.Children.Add(mathControl);
                break;

            case SyntaxHighlightingRenderModel syntaxHighlightingModel:
                var syntaxHighlightingControl = new SyntaxHighlightingControl();
                syntaxHighlightingControl.Init(syntaxHighlightingModel);
                RenderingSettingsItemContent.Children.Add(syntaxHighlightingControl);
                break;

            case DiagramRenderModel diagramModel:
                var diagramControl = new DiagramControl();
                diagramControl.Init(diagramModel);
                RenderingSettingsItemContent.Children.Add(diagramControl);
                break;

            default:
                // TODO Error UI model does not exist
                // TODO Analytics
                break;
            }
        }