Skip to content
Snippets Groups Projects
Commit 741e4231 authored by Bensong Liu's avatar Bensong Liu
Browse files

revert previous change: removed explicit argument spec

parent 7fd539d6
No related branches found
No related tags found
1 merge request!1Allow explicit arg
......@@ -34,16 +34,13 @@ namespace CIS {
inputSettings[k] = v;
}
void explicitSetRawArgument(string argTypeInXaml, string argValueInCSharp) {
explicitArgType = argTypeInXaml;
explicitArgValue = argValueInCSharp;
throw std::runtime_error("NotSupported! Activity seems doesn't support custom type inputSettings at all. Refer to commit 7fd539d6d5f6b102337da9591217b781cb71ced9 if we get new info and want to support it again. ");
}
private:
string displayName, className, entityName;
string taskId;
std::unordered_map<string, string> inputSettings;
string explicitArgType, explicitArgValue;
auto inputSettingsToCodelines() const {
// Convert InputSettings Dictionary to C# code.
std::list<string> inputSettingStrings;
......@@ -54,29 +51,19 @@ namespace CIS {
return rlib::string(templates::ACTIVITY_DICT_TEMPLATE_UNESCAPED).replace_once("__TEMPLATE_ARG_DictLines", inputSettingsString);
}
auto generateXaml() const {
rlib::string xamlCode = templates::ACTIVITY_XAML_TEMPLATE;
string argType, argValue;
if(explicitArgType.empty() && explicitArgValue.empty()) {
// no explicit argument specified.
if(inputSettings.empty()) {
// Also no inputSettings.
xamlCode = templates::ACTIVITY_XAML_TEMPLATE_WITHOUT_INPUTSETTINGS;
}
else {
// Generate inputSettings.
argType = templates::ACTIVITY_DICT_TYPENAME;
argValue = inputSettingsToCodelines();
}
rlib::string xamlCode;
if(inputSettings.empty()) {
// Also no inputSettings.
xamlCode = templates::ACTIVITY_XAML_TEMPLATE_WITHOUT_INPUTSETTINGS;
}
else {
// Use explicit argument.
argType = explicitArgType;
argValue = explicitArgValue;
// Generate inputSettings.
xamlCode = templates::ACTIVITY_XAML_TEMPLATE;
xamlCode.replace("__TEMPLATE_ARG_TypeName", templates::ACTIVITY_DICT_TYPENAME);
xamlCode.replace_once("__TEMPLATE_ARG_TypeValue", Utility::HtmlEscapeString(inputSettingsToCodelines()));
}
xamlCode.replace("__TEMPLATE_ARG_TypeName", argType);
xamlCode.replace_once("__TEMPLATE_ARG_TypeValue", Utility::HtmlEscapeString(argValue));
xamlCode.replace_once("__TEMPLATE_ARG_ClassName", this->className);
xamlCode.replace_once("__TEMPLATE_ARG_DisplayName", this->displayName);
xamlCode.replace_once("__TEMPLATE_ARG_TaskId", this->taskId);
......
......@@ -24,6 +24,7 @@ R"XAMLTL( <mwcwa:ControlledActivity ClassName="__TEMPLATE_ARG_ClassName" Disp
</mwcwa:ControlledActivity>
)XAMLTL";
// This 2 variable below were designed to support custom TypeArguments type, but CIS seems not support it...
constexpr auto ACTIVITY_DICT_TYPENAME = "scg:Dictionary(x:String, x:String)";
constexpr auto ACTIVITY_DICT_TEMPLATE_UNESCAPED =
R"XAMLTL( new Dictionary<string, string>()
......
......@@ -32,8 +32,7 @@ auto complexExample() {
DEFINE_ACTIVITY(TSConfigAndInterop, "PreRteg.InitiateBareMetalComplete")
// All Names of activity should not contain quotation mark (")
Activity OneMoreMagicActivity("MyName Contains Symbols: {(<&>)}", "FleetAGC.Workflow.Magic");
OneMoreMagicActivity.explicitSetRawArgument("x:Boolean", "(0b_1100_1000 | 0b_1000_0001 == 201)");
Activity OneMoreMagicActivity("MyName Contains Symbols: {(&)} <>", "FleetAGC.Workflow.Magic");
auto block1 = SCS >> (SearchAnalytics | (SearchFarms >> (ClassisSearchUX | ModernSearch)));
auto block3 = Loki >> Yggdrasil >> OfficeGraph;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment