Get/Set Workflow Variable from uiTypeEditor

Gabe

I have created a custom ui editor to handle setting the value of a variable for my workflow. What I want to do is be able to get the value of any of the variables set for the workflow within the uieditor.

public class MyCustomEditor : UITypeEditor
{
   public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value){

       IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

       IBuildDefinition buildDefinition = (IBuildDefinition)provider.GetService(typeof(IBuildDefinition));

       // Variable set in the workflow metadata to use this ui editor
       MyCustomVariable variable = value as MyCustomVariable;

       // Tried getting it from the Process Parameters but the only thing in there was BuildSettings
       var processParms = WorkflowHelpers.DeserializeProcessParameters(buildDefinition.ProcessParameters);

       object obj;
       processParms.TryGetValue("BuildSettings", out obj);
       BuildSettings buildSettings = obj as BuildSettings;

       // I want to be able to access other variable for the workflow, everything above works. But MyCustomVariable is set in the Metadata to use this editor. I want to get the value of another variable in the workflow as well

      return variable;
   }
}
Gabe

I was wrong, when I was looking at ProcessParameters, the build definition had not yet been saved so that's why I was only seeing 'BuildSettings' Once I deserialize them on a saved BuildDefinition, I could see all the variables.

var processParms = WorkflowHelpers.DeserializeProcessParameters(buildDefinition.ProcessParameters);

object obj;
processParms.TryGetValue("MyOtherVariable", out obj);
MyOtherVariable myOtherVariable = obj as MyOtherVariable;

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

从uiTypeEditor获取/设置工作流变量

来自分类Dev

PropertyGrid UITypeEditor禁用单元格编辑

来自分类Dev

从uiTypeEditor获取/设置工作流变量

来自分类Dev

如何使用属性设置自定义UITypeEditor的属性

来自分类Dev

强制 UITypeEditor 显示 Enum 类型的初始值

来自分类Dev

TypeError:%d格式:必须为数字,而不是getset_descriptor

来自分类Dev

Bash: Update the parent variable from function variable

来自分类Dev

确定年龄的程序会给出有关getset_descriptor的错误?

来自分类Dev

Redis GETSET - “当键存在但不包含字符串值时返回错误。”

来自分类Dev

Access class variable from instance

来自分类Dev

Mutable variable is accessible from closure

来自分类Dev

Remove a substring from a bash variable

来自分类Dev

Trying to understand the Git Workflow

来自分类Dev

Single Sign On (SSO) - workflow

来自分类Dev

Pass variable from applescript to executable bash file

来自分类Dev

Variable from attribute only displays the first word

来自分类Dev

Reconstruct a categorical variable from dummies in pandas

来自分类Dev

Get data frame from character variable

来自分类Dev

How to execute a GDB command from a string variable?

来自分类Dev

Pulling variable length substring from middle of string

来自分类Dev

Excel: Get max value from variable range

来自分类Dev

Alfred Workflow Bash脚本失败

来自分类Dev

How to extract value of root variable from kernel commandline

来自分类Dev

Retrieving the value from a Selenium Webdriver WebElement field and passing it to a java variable

来自分类Dev

python:How to print the character from a variable with unicode string

来自分类Dev

SAS Macro to extract many variables from one variable

来自分类Dev

Store variable from one event handler to be used by another event handler

来自分类Dev

How to remove / dispose a broadcast variable from heap in Spark?

来自分类Dev

Seperate values with commas on one line from a variable BASH

Related 相关文章

  1. 1

    从uiTypeEditor获取/设置工作流变量

  2. 2

    PropertyGrid UITypeEditor禁用单元格编辑

  3. 3

    从uiTypeEditor获取/设置工作流变量

  4. 4

    如何使用属性设置自定义UITypeEditor的属性

  5. 5

    强制 UITypeEditor 显示 Enum 类型的初始值

  6. 6

    TypeError:%d格式:必须为数字,而不是getset_descriptor

  7. 7

    Bash: Update the parent variable from function variable

  8. 8

    确定年龄的程序会给出有关getset_descriptor的错误?

  9. 9

    Redis GETSET - “当键存在但不包含字符串值时返回错误。”

  10. 10

    Access class variable from instance

  11. 11

    Mutable variable is accessible from closure

  12. 12

    Remove a substring from a bash variable

  13. 13

    Trying to understand the Git Workflow

  14. 14

    Single Sign On (SSO) - workflow

  15. 15

    Pass variable from applescript to executable bash file

  16. 16

    Variable from attribute only displays the first word

  17. 17

    Reconstruct a categorical variable from dummies in pandas

  18. 18

    Get data frame from character variable

  19. 19

    How to execute a GDB command from a string variable?

  20. 20

    Pulling variable length substring from middle of string

  21. 21

    Excel: Get max value from variable range

  22. 22

    Alfred Workflow Bash脚本失败

  23. 23

    How to extract value of root variable from kernel commandline

  24. 24

    Retrieving the value from a Selenium Webdriver WebElement field and passing it to a java variable

  25. 25

    python:How to print the character from a variable with unicode string

  26. 26

    SAS Macro to extract many variables from one variable

  27. 27

    Store variable from one event handler to be used by another event handler

  28. 28

    How to remove / dispose a broadcast variable from heap in Spark?

  29. 29

    Seperate values with commas on one line from a variable BASH

热门标签

归档