From 741e42315e866861214f24dee0d5dc0b2e7a7929 Mon Sep 17 00:00:00 2001 From: Bensong Liu <bensl@microsoft.com> Date: Tue, 20 Oct 2020 17:58:39 +0800 Subject: [PATCH] revert previous change: removed explicit argument spec --- activity.hpp | 33 ++++++++++----------------------- xaml-template.hpp | 1 + xaml.gen.example.cc | 3 +-- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/activity.hpp b/activity.hpp index 3b0d343..932fd7f 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 ee39922..6c27599 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 b0f8618..6909e9d 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; -- GitLab