当前位置: 首页>>代码示例>>C#>>正文


C# ICommandContext.GetCommandParameter方法代码示例

本文整理汇总了C#中ICommandContext.GetCommandParameter方法的典型用法代码示例。如果您正苦于以下问题:C# ICommandContext.GetCommandParameter方法的具体用法?C# ICommandContext.GetCommandParameter怎么用?C# ICommandContext.GetCommandParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICommandContext的用法示例。


在下文中一共展示了ICommandContext.GetCommandParameter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public IDataEntity Run(ICommandContext commandContext)
        {
            //
            //  dataEntities contains all necessary input data entities
            //
            var dataEntities = commandContext.GetDataEntity<Plugin_v2_Dependency_Entities>();
            //var services = commandContext.GetService<Plugin_v2_Dependency_Services>();
            var services = commandContext.Get<Plugin_v2_Dependency_Services>();
            IMeasurementPropertiesEntity measurementPropertiesEntity = services.MeasurementPropertiesService.GetProperties(dataEntities.ModelEntity, activeProperties: true);

            var generalProperty = new List<double>();
            foreach (IMeasurementPropertyEntity measurementPropertyEntity in measurementPropertiesEntity.Properties)
            {
                generalProperty.AddRange(measurementPropertyEntity.Y);
            }

            //
            // Get parameters
            //
            var parameter1 = commandContext.GetCommandParameter<string>("parameter1");
            var parameter2 = commandContext.GetCommandParameter<string>("parameter2");
            var material1 = commandContext.GetCommandParameter<string>("material1");
            var material2 = commandContext.GetCommandParameter<string>("material2");
            var threshold = commandContext.GetCommandParameter<double>("threshold");

            double[] materialRange1 = services.MaterialPropertiesService.CalcRange(dataEntities.ModelEntity, material1, generalProperty.ToArray());
            double[] materialRange2 = services.MaterialPropertiesService.CalcRange(dataEntities.ModelEntity, material2, generalProperty.ToArray());

            double nominal1 = dataEntities.ModelEntity.GetParameterNominal(parameter1);
            double nominal2 = dataEntities.ModelEntity.GetParameterNominal(parameter2);

            double resultValue1;
            double resultValue2;
            // algorithm logic (materialRange1, materialRange2, nominal1, nominal2
            if (threshold < 0.5)
            {
                resultValue1 = 0.1;
                resultValue2 = 0.4;
            }
            else
            {
                resultValue1 = 0.8;
                resultValue2 = 0.9;
            }
            // ==> results
            // value of parameter 1
            // value of parameter 2

            dataEntities.ResultParameters.ParametersValues.Add(parameter1, resultValue1);
            dataEntities.ResultParameters.ParametersValues.Add(parameter2, resultValue2);

            return dataEntities.ResultParameters;
        }
开发者ID:constructor-igor,项目名称:TechSugar,代码行数:53,代码来源:PluginB_v2.cs

示例2: Run

        public IDataEntity Run(ICommandContext commandContext)
        {
            var dataEntities = commandContext.GetDataEntity<PluginMessageToHistoryEntities>();
            var message = commandContext.GetCommandParameter<string>("message");

            dataEntities.ModelDataEntity.History += message;
            return null;
        }
开发者ID:constructor-igor,项目名称:TechSugar,代码行数:8,代码来源:PluginMessageToModelHistory.cs

示例3: Run

        public IDataEntity Run(ICommandContext commandContext)
        {
            var dataEntities = commandContext.Get<PluginSaveModelToFileEntities>();
            var filePath = commandContext.GetCommandParameter<string>("file");

            var dataProvider = commandContext.Get<IDataProvider<IModelDataEntity>>();
            dataProvider.ExportToFile(filePath, dataEntities.ModelDataEntity);
            return null;
        }
开发者ID:constructor-igor,项目名称:TechSugar,代码行数:9,代码来源:PluginSaveModelToFile.cs

示例4: Run

        public IDataEntity Run(ICommandContext commandContext)
        {
            var model = commandContext.GetDataEntity<IModelDataEntity>();
            var materialName = commandContext.GetCommandParameter<string>("material");
            DataEntityContainer rangeEntity = commandContext.GetDataParameter("range");
            var range = rangeEntity.DataAs<double[]>();

            return new DataEntityContainer("material_range", CalcRange(model, materialName, range));
        }
开发者ID:constructor-igor,项目名称:TechSugar,代码行数:9,代码来源:MaterialsPropertiesCommand.cs

示例5: Run

 public IDataEntity Run(ICommandContext commandContext)
 {
     // get input data
     var model = commandContext.GetDataEntity<IModelDataEntity>();
     // get input parameters
     bool activeProperties = commandContext.GetCommandParameter<bool>("active");
     
     return GetProperties(model, activeProperties);
 }
开发者ID:constructor-igor,项目名称:TechSugar,代码行数:9,代码来源:MeasurementPropertiesCommand.cs

示例6: Run

        public IDataEntity Run(ICommandContext commandContext)
        {
            //
            //  Get model
            //
            var model = commandContext.GetDataEntity<IModelDataEntity>();

            //
            // Get active only measurement properties
            //
            var measurementPropertiesEntity = commandContext.RunCommand("model_get_measurement_properties", "active=true") as IMeasurementPropertiesEntity;

            var generalProperty = new List<double>();
            foreach (IMeasurementPropertyEntity measurementPropertyEntity in measurementPropertiesEntity.Properties)
            {
                generalProperty.AddRange(measurementPropertyEntity.Y);
            }

            //
            // Get parameters
            //
            var parameter1 = commandContext.GetCommandParameter<string>("parameter1");
            var parameter2 = commandContext.GetCommandParameter<string>("parameter2");
            var material1 = commandContext.GetCommandParameter<string>("material1");
            var material2 = commandContext.GetCommandParameter<string>("material2");
            var threshold = commandContext.GetCommandParameter<double>("threshold");

            string commandParameters = String.Format("material={0}", material1);
            var materialRange = new DataEntityContainer("range", generalProperty.ToArray());
            var materialProperties = commandContext.RunCommand("get_material_properties", commandParameters, materialRange) as DataEntityContainer;
            var materialRanges1 = materialProperties.DataAs<double[]>();

            commandParameters = String.Format("material={0}", material2);
            materialProperties = commandContext.RunCommand("get_material_properties", commandParameters, materialRange) as DataEntityContainer;
            var materialRanges2 = materialProperties.DataAs<double[]>();

            double nominal1 = model.GetParameterNominal(parameter1);
            double nominal2 = model.GetParameterNominal(parameter2);

            double resultValue1;
            double resultValue2;
            // algorithm logic (materialRange1, materialRange2, nominal1, nominal2
            if (threshold < 0.5)
            {
                resultValue1 = 0.1;
                resultValue2 = 0.4;
            }
            else
            {
                resultValue1 = 0.8;
                resultValue2 = 0.9;
            }
            // ==> results
            // value of parameter 1
            // value of parameter 2

            var modelParametersDataEntity = new ModelParametersDataEntity();
            modelParametersDataEntity.ParametersValues.Add(parameter1, resultValue1);
            modelParametersDataEntity.ParametersValues.Add(parameter2, resultValue2);

            return modelParametersDataEntity;
        }
开发者ID:constructor-igor,项目名称:TechSugar,代码行数:62,代码来源:PluginB_v1.cs


注:本文中的ICommandContext.GetCommandParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。