Esempio n. 1
0
        public blazorSessionService()
        {
            sessionNumber = ++sessionCounter;
            sessionTotal++;
            AnyUiDisplayContextHtml.addSession(sessionNumber);

            packages        = new PackageCentral();
            _packageCentral = packages;

            env = null;

            helper             = new DispEditHelperEntities();
            helper.levelColors = DispLevelColors.GetLevelColorsFromOptions(Options.Curr);
            // some functionality still uses repo != null to detect editMode!!
            repo            = new ModifyRepo();
            helper.editMode = editMode;
            helper.hintMode = hintMode;
            helper.repo     = repo;
            helper.context  = null;
            helper.packages = packages;

            stack17 = new AnyUiStackPanel()
            {
                Orientation = AnyUiOrientation.Vertical
            };

            if (env?.AasEnv?.AdministrationShells != null)
            {
                helper.DisplayOrEditAasEntityAas(packages, env.AasEnv,
                                                 env.AasEnv.AdministrationShells[0], editMode, stack17, hintMode: hintMode);
            }

            htmlDotnetThread = new Thread(AnyUiDisplayContextHtml.htmlDotnetLoop);
            htmlDotnetThread.Start();
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            //// env = new AdminShellPackageEnv("Example_AAS_ServoDCMotor_21.aasx");

            loadAasxFiles();
#if __test__PackageLogic
#else
            packages = new PackageCentral();
            // TODO (MIHO, 2021-06-07): how to initialize?
            packages.MainItem.TakeOver(env);

            helper             = new DispEditHelperEntities();
            helper.levelColors = DispLevelColors.GetLevelColorsFromOptions(Options.Curr);
            // some functionality still uses repo != null to detect editMode!!
            repo            = new ModifyRepo();
            helper.editMode = editMode;
            helper.hintMode = hintMode;
            helper.repo     = repo;
            helper.context  = null;
            helper.packages = packages;

            stack17             = new AnyUiStackPanel();
            stack17.Orientation = AnyUiOrientation.Vertical;

            helper.DisplayOrEditAasEntityAas(
                packages, env.AasEnv, env.AasEnv.AdministrationShells[0], editMode, stack17, hintMode: hintMode);

            AnyUi.AnyUiDisplayContextHtml.htmlDotnetThread.Start();
#endif

            //
            // Test for Blazor
            //

#if _not_enabled
            stack2 = JsonConvert.DeserializeObject <AnyUiStackPanel>(File.ReadAllText(@"c:\development\file.json"));
            var d = new JavaScriptSerializer();
            stack2 = d.Deserialize <AnyUiStackPanel>(File.ReadAllText(@"c:\development\file.json"));
            var parent = (Dictionary <string, object>)results["Parent"];
#endif

#if _not_enabled
            {
                string s = File.ReadAllText(@"c:\development\file.json");
                var    jsonSerializerSettings = new JsonSerializerSettings()
                {
                    TypeNameHandling = TypeNameHandling.All
                };
                stack2 = JsonConvert.DeserializeObject <AnyUiStackPanel>(s, jsonSerializerSettings);
            }
#endif

            if (true)
            {
                stack.Orientation = AnyUiOrientation.Vertical;

                var lab1 = new AnyUiLabel();
                lab1.Content    = "Hallo1";
                lab1.Foreground = AnyUiBrushes.DarkBlue;
                stack.Children.Add(lab1);

                var stck2 = new AnyUiStackPanel();
                stck2.Orientation = AnyUiOrientation.Horizontal;
                stack.Children.Add(stck2);

                var lab2 = new AnyUiLabel();
                lab2.Content    = "Hallo2";
                lab2.Foreground = AnyUiBrushes.DarkBlue;
                stck2.Children.Add(lab2);

                var stck3 = new AnyUiStackPanel();
                stck3.Orientation = AnyUiOrientation.Horizontal;
                stck2.Children.Add(stck3);

                var lab3 = new AnyUiLabel();
                lab3.Content    = "Hallo3";
                lab3.Foreground = AnyUiBrushes.DarkBlue;
                stck3.Children.Add(lab3);

                if (editMode)
                {
                    var tb = new AnyUiTextBox();
                    tb.Foreground = AnyUiBrushes.Black;
                    tb.Text       = "Initial";
                    stck2.Children.Add(tb);

                    var btn = new AnyUiButton();
                    btn.Content     = "Click me!";
                    btn.DisplayData = new BlazorDisplayData(lambda: (o) =>
                    {
                        if (o == btn)
                        {
                            Program.LogLine = "Hallo, Match zwischen Button und callback!";
                        }
                    });
                    stck3.Children.Add(btn);
                }
            }

            CreateHostBuilder(args).Build().Run();
        }