Exemplo n.º 1
0
        public void LoadDemo(string id)
        {
            Cookbook.IRecipe recipe = Cookbook.Locate.GetRecipe(id);
            var avaPlot1            = this.Find <ScottPlot.Avalonia.AvaPlot>("AvaPlot1");
            var imagePlot1          = this.Find <Image>("imagePlot");

            this.Find <TextBlock>("DemoNameLabel").Text    = recipe.Title;
            this.Find <TextBlock>("SourceCodeLabel").Text  = "Source Code";
            this.Find <TextBox>("DescriptionTextbox").Text = recipe.Description;
            string sourceCode = Cookbook.Locate.RecipeSourceCode(id);

            this.Find <TextBox>("SourceTextBox").Text = sourceCode;

            avaPlot1.Reset();
            imagePlot1.IsVisible = false;
            avaPlot1.IsVisible   = true;
            recipe.ExecuteRecipe(avaPlot1.plt);
            avaPlot1.Render();
        }
Exemplo n.º 2
0
        public void LoadDemo(string id)
        {
            Cookbook.IRecipe recipe = Cookbook.Locate.GetRecipe(id);
            var avaPlot1            = this.Find <ScottPlot.Avalonia.AvaPlot>("AvaPlot1");
            var imagePlot1          = this.Find <Image>("imagePlot");

            this.Find <TextBlock>("DemoNameLabel").Text    = recipe.Title;
            this.Find <TextBlock>("SourceCodeLabel").Text  = "Source Code";
            this.Find <TextBox>("DescriptionTextbox").Text = recipe.Description;
            string source = Recipes is null ? Cookbook.RecipeJson.NotFoundMessage : Recipes[id].Code;

            this.Find <TextBox>("SourceTextBox").Text = source.Replace("\n", Environment.NewLine);

            avaPlot1.Reset();
            imagePlot1.IsVisible = false;
            avaPlot1.IsVisible   = true;
            recipe.ExecuteRecipe(avaPlot1.Plot);
            avaPlot1.Refresh();
        }