diff --git a/activity.hpp b/activity.hpp index 3b0d3431d135b8d34406fe91a49582e00b880827..932fd7fd84c1c606611575a63bf9fdf1e9ab3989 100644 --- a/activity.hpp +++ b/activity.hpp @@ -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); diff --git a/xaml-template.hpp b/xaml-template.hpp index ee3992236ac9b33b2d3fbd0a82afd76f902ae810..6c27599dac90702e0b34f36db6eddb412cbbe5fb 100644 --- a/xaml-template.hpp +++ b/xaml-template.hpp @@ -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>() diff --git a/xaml.gen.example.cc b/xaml.gen.example.cc index b0f8618cd063ad8d37ea72d2250559501875af64..6909e9d98e15df5b176ea4fca880f62af37f87dc 100644 --- a/xaml.gen.example.cc +++ b/xaml.gen.example.cc @@ -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;