環境ごとで動作を分けたい場合に。
まぁこれだけあってもどうしようもないんだけど
毎回忘れるのでメモ程度でお願いしますm(_ _)m
using Artech.Genexus.Common;
using Artech.Genexus.Common.Entities;
public bool ExTestCommand(CommandData data)
{
bool result = true;
// KBModel を取得
KBModel model = UIServices.KB.CurrentModel;
if (model != null)
{
// Gxモデルを取得
GxModel gxModel = UIServices.KB.WorkingEnvironment.TargetModel.GetAs<GxModel>();
// 環境のジェネレーター情報を取得
int generator = gxModel.Environment.Generator;
switch (generator)
{
case (int)GeneratorType.JavaWeb: // 12
CommonServices.Output.AddLine("Java Web!");
break;
case (int)GeneratorType.CSharpWeb: // 15
CommonServices.Output.AddLine("CSharp Web!");
break;
}
}
return result;
}