/// <summary>
        /// Scia open API run example
        /// DO NOT PLAY WITH GUI ELEMENTS HERE.
        /// It is not done run on GUI main thread
        /// </summary>
        /// <param name="env">Data for from calculation</param>
        /// <returns></returns>
        private object SciaOpenApiWorker(SCIA.OpenAPI.Environment env)
        {
            OpenApiSimpleExampleContext APIContext = new OpenApiSimpleExampleContext()
            {
                A             = this.A,
                B             = this.B,
                C             = this.C,
                SlabThickness = this.SlabThickness,
                LoadValue     = this.LoadValue,
                ConcreteGrade = this.ConcreteGrade,
                SteelGrade    = this.SteelGrade,
                SteelProfile  = this.SteelProfile
            };

            env.RunSCIAEngineer(SCIA.OpenAPI.Environment.GuiMode.ShowWindowShow);
            SciaFileGetter fileGetter = new SciaFileGetter();
            var            esaFile    = fileGetter.PrepareBasicEmptyFile(env.AppTempPath);

            if (!File.Exists(esaFile))
            {
                throw new InvalidOperationException($"File from manifest resource is not created ! Temp: {env.AppTempPath}");
            }
            EsaProject project = env.OpenProject(esaFile);



            OpenAPISimpleExample.CreateModel(project.Model, APIContext);
            project.Model.RefreshModel_ToSCIAEngineer();
            project.RunCalculation();
            return(OpenAPISimpleExample.ReadResults(project.Model, APIContext));
        }
        /// <summary>
        /// This method represented advance use of OpenAPI, initialization of environment is done on background thanks to Context, EmptyFile is generated on backround and used than follows creation of model, linear calculation and reading results
        /// </summary>
        private static object SCIAOpenAPIWorker(SCIA.OpenAPI.Environment env)
        {
            #region Run SCIA Engineer
            //Run SCIA Engineer application
            bool openedSE = env.RunSCIAEngineer(SCIA.OpenAPI.Environment.GuiMode.ShowWindowShow);
            if (!openedSE)
            {
                throw new InvalidOperationException($"Cannot run SCIA Engineer");
            }
            #endregion
            #region Open Project Template file
            SciaFileGetter fileGetter = new SciaFileGetter();
            var            EsaFile    = fileGetter.PrepareBasicEmptyFile(@"C:/TEMP/");//path where the template file "template.esa" is created
            if (!File.Exists(EsaFile))
            {
                throw new InvalidOperationException($"File from manifest resource is not created ! Temp: {env.AppTempPath}");
            }

            EsaProject proj = env.OpenProject(EsaFile);
            if (proj == null)
            {
                throw new InvalidOperationException($"File from manifest resource is not opened ! Temp: {env.AppTempPath}");
            }
            #endregion

            CreateModel(proj.Model);
            #region  ---------- Calculation----------
            #region Send Model to SCIA Engineer
            //Refresh model in SCIA Engineer from local ADM
            proj.Model.RefreshModel_ToSCIAEngineer();
            #endregion
            #region Calculate

            // Run calculation
            proj.RunCalculation();
            Console.WriteLine($"My model calculate");
            OpenApiE2EResults storage = new OpenApiE2EResults();
            #endregion
            #endregion
            #region  ---------- Results -------------
            //Initialize Results API
            using (ResultsAPI resultsApi = proj.Model.InitializeResultsAPI())
            {
                if (resultsApi == null)
                {
                    return(storage);
                }
                {
                    OpenApiE2EResult beamB1InnerForLc = new OpenApiE2EResult("beamB1InnerForcesLC1")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Beam,
                            EntityName  = beamName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_1D,
                            ResultType  = eResultType.eFemBeamInnerForces,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    beamB1InnerForLc.Result = resultsApi.LoadResult(beamB1InnerForLc.ResultKey);
                    storage.SetResult(beamB1InnerForLc);
                }
                {
                    OpenApiE2EResult beamB1IDeformationLc = new OpenApiE2EResult("beamB1DeformationsLC1")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Beam,
                            EntityName  = beamName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_1D,
                            ResultType  = eResultType.eFemBeamDeformation,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    beamB1IDeformationLc.Result = resultsApi.LoadResult(beamB1IDeformationLc.ResultKey);
                    storage.SetResult(beamB1IDeformationLc);
                }
                {
                    OpenApiE2EResult beamB1RelIDeformationLc = new OpenApiE2EResult("beamB1RelativeDeformationsLC1")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Beam,
                            EntityName  = beamName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_1D,
                            ResultType  = eResultType.eFemBeamRelativeDeformation,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    beamB1RelIDeformationLc.Result = resultsApi.LoadResult(beamB1RelIDeformationLc.ResultKey);
                    storage.SetResult(beamB1RelIDeformationLc);
                }
                {
                    OpenApiE2EResult beamInnerForcesCombi = new OpenApiE2EResult("beamInnerForcesCombi")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Beam,
                            EntityName  = beamName,
                            CaseType    = eDsElementType.eDsElementType_Combination,
                            CaseId      = C1Id,
                            Dimension   = eDimension.eDim_1D,
                            ResultType  = eResultType.eFemBeamInnerForces,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    beamInnerForcesCombi.Result = resultsApi.LoadResult(beamInnerForcesCombi.ResultKey);
                    storage.SetResult(beamInnerForcesCombi);
                }


                {
                    OpenApiE2EResult slabInnerForces = new OpenApiE2EResult("slabInnerForces")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Slab,
                            EntityName  = SlabName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_2D,
                            ResultType  = eResultType.eFemInnerForces,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    slabInnerForces.Result = resultsApi.LoadResult(slabInnerForces.ResultKey);
                    storage.SetResult(slabInnerForces);
                }
                {
                    OpenApiE2EResult slabDeformations = new OpenApiE2EResult("slabDeformations")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Slab,
                            EntityName  = SlabName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_2D,
                            ResultType  = eResultType.eFemDeformations,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    slabDeformations.Result = resultsApi.LoadResult(slabDeformations.ResultKey);
                    storage.SetResult(slabDeformations);
                }
                {
                    OpenApiE2EResult slabStresses = new OpenApiE2EResult("slabStresses")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Slab,
                            EntityName  = SlabName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_2D,
                            ResultType  = eResultType.eFemStress,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    slabStresses.Result = resultsApi.LoadResult(slabStresses.ResultKey);
                    storage.SetResult(slabStresses);
                }
                {
                    OpenApiE2EResult slabStrains = new OpenApiE2EResult("slabStrains")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Slab,
                            EntityName  = SlabName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_2D,
                            ResultType  = eResultType.eFemStrains,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    slabStrains.Result = resultsApi.LoadResult(slabStrains.ResultKey);
                    storage.SetResult(slabStrains);
                }
                {
                    OpenApiE2EResult slabInnerForcesExtended = new OpenApiE2EResult("slabInnerForcesExtended")
                    {
                        ResultKey = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Slab,
                            EntityName  = SlabName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_2D,
                            ResultType  = eResultType.eFemInnerForces_Extended,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        }
                    };
                    slabInnerForcesExtended.Result = resultsApi.LoadResult(slabInnerForcesExtended.ResultKey);
                    storage.SetResult(slabInnerForcesExtended);
                }

                //{
                //    OpenApiE2EResult reactions = new OpenApiE2EResult("ReactionsN1")
                //    {
                //        ResultKey = new ResultKey
                //        {
                //            CaseType = eDsElementType.eDsElementType_LoadCase,
                //            CaseId = Lc1Id,
                //            EntityType = eDsElementType.eDsElementType_Node,
                //            EntityName = "n1",
                //            Dimension = eDimension.eDim_reactionsPoint,
                //            ResultType = eResultType.eReactionsNodes,
                //            CoordSystem = eCoordSystem.eCoordSys_Global
                //        }
                //    };
                //    reactions.Result = resultsApi.LoadResult(reactions.ResultKey);
                //    storage.SetResult(reactions);
                //}
                //{
                //    OpenApiE2EResult reactions = new OpenApiE2EResult("ReactionsSu1")
                //    {
                //        ResultKey = new ResultKey
                //        {
                //            CaseType = eDsElementType.eDsElementType_LoadCase,
                //            CaseId = Lc1Id,
                //            EntityType = eDsElementType.eDsElementType_PointSupportPoint,
                //            EntityName = "Su1",
                //            Dimension = eDimension.eDim_reactionsPoint,
                //            ResultType = eResultType.eResultTypeReactionsSupport0D,
                //            CoordSystem = eCoordSystem.eCoordSys_Global,

                //        }
                //    };
                //    reactions.Result = resultsApi.LoadResult(reactions.ResultKey);
                //    storage.SetResult(reactions);
                //}
                //{
                //    OpenApiE2EResult ReactionslinSupBeam = new OpenApiE2EResult("ReactionslinSupBeam")
                //    {
                //        ResultKey = new ResultKey
                //        {
                //            EntityType = eDsElementType.eDsElementType_LineSupportLine,
                //            EntityName = "linSupBeam",
                //            Dimension = eDimension.eDim_reactionsLine,
                //            CoordSystem = eCoordSystem.eCoordSys_Global,
                //            CaseType = eDsElementType.eDsElementType_LoadCase,
                //            CaseId = Lc1Id,
                //            ResultType = eResultType.eResultTypeReactionsSupport1D,

                //        }
                //    };
                //    ReactionslinSupBeam.Result = resultsApi.LoadResult(ReactionslinSupBeam.ResultKey);
                //    storage.SetResult(ReactionslinSupBeam);
                //}

                return(storage);
            }
            #endregion
        }