Get WorkflowDesigner from a ModelItem










3















I am trying to create a custom IExpressionEditor. In order to new one up I need a WorkflowDesigner, All I have is the ModelItem representing my custom activity. Is it possible to access the WorkflowDesigner from a given ModelItem?



 List<ModelItem> variables = new List<ModelItem>();
List<ModelItem> nameSpaces = new List<ModelItem>();

// get the activity from the datacontext
CustomActivityDesigner cad = this.DataContext as CustomActivityDesigner;
// try to get the variables
// look for variables collection cant seem to find them
ModelProperty mp = cad.ModelItem.Properties["Variables"];

if(mp != null && mp.PropertyType == typeof(Collection<Variable>))

mp.Collection.ToList().ForEach(i => variables.Add(i));


// get name spaces
ModelProperty mp2 = cad.ModelItem.Properties["NameSpaces"];

if(mp2 != null && mp2.PropertyType == typeof(Collection<NameSpace>))

mp2.Collection.ToList().ForEach(i => nameSpaces.Add(i));


// finally need the WorkflowDesigner object
WorkflowDesigner designer = Modelitem.Root....??? as WorkflowDesigner

// now we have what we need we can create the IExpressionEditor
CustomExpressionEditior ce = new CustomExpressionEditior(designer, variables, nameSpaces)









share|improve this question
























  • The ModelItem property is hierarchical so traversing this you can gain access to the root element of your workflow where defined variables can be found. ModelItem also has information about the type of the property so you can just select properties of certain type.

    – Kousic
    Nov 19 '18 at 13:02












  • @kousic I can see that I can get the root item from my model item, but I cannot cast that to a WorkflowDesigner, nor do I see any properties to access the WorkflowDesigner object. I would like to get the Designer itself, then any variables defined in the scope of my custom activity, and any namespaces. Not finding much info online though.

    – user1336827
    Nov 20 '18 at 14:31











  • Can you give me a sample code of your model item?

    – Kousic
    Nov 21 '18 at 6:51











  • @kousic added sample code

    – user1336827
    Nov 21 '18 at 14:16















3















I am trying to create a custom IExpressionEditor. In order to new one up I need a WorkflowDesigner, All I have is the ModelItem representing my custom activity. Is it possible to access the WorkflowDesigner from a given ModelItem?



 List<ModelItem> variables = new List<ModelItem>();
List<ModelItem> nameSpaces = new List<ModelItem>();

// get the activity from the datacontext
CustomActivityDesigner cad = this.DataContext as CustomActivityDesigner;
// try to get the variables
// look for variables collection cant seem to find them
ModelProperty mp = cad.ModelItem.Properties["Variables"];

if(mp != null && mp.PropertyType == typeof(Collection<Variable>))

mp.Collection.ToList().ForEach(i => variables.Add(i));


// get name spaces
ModelProperty mp2 = cad.ModelItem.Properties["NameSpaces"];

if(mp2 != null && mp2.PropertyType == typeof(Collection<NameSpace>))

mp2.Collection.ToList().ForEach(i => nameSpaces.Add(i));


// finally need the WorkflowDesigner object
WorkflowDesigner designer = Modelitem.Root....??? as WorkflowDesigner

// now we have what we need we can create the IExpressionEditor
CustomExpressionEditior ce = new CustomExpressionEditior(designer, variables, nameSpaces)









share|improve this question
























  • The ModelItem property is hierarchical so traversing this you can gain access to the root element of your workflow where defined variables can be found. ModelItem also has information about the type of the property so you can just select properties of certain type.

    – Kousic
    Nov 19 '18 at 13:02












  • @kousic I can see that I can get the root item from my model item, but I cannot cast that to a WorkflowDesigner, nor do I see any properties to access the WorkflowDesigner object. I would like to get the Designer itself, then any variables defined in the scope of my custom activity, and any namespaces. Not finding much info online though.

    – user1336827
    Nov 20 '18 at 14:31











  • Can you give me a sample code of your model item?

    – Kousic
    Nov 21 '18 at 6:51











  • @kousic added sample code

    – user1336827
    Nov 21 '18 at 14:16













3












3








3








I am trying to create a custom IExpressionEditor. In order to new one up I need a WorkflowDesigner, All I have is the ModelItem representing my custom activity. Is it possible to access the WorkflowDesigner from a given ModelItem?



 List<ModelItem> variables = new List<ModelItem>();
List<ModelItem> nameSpaces = new List<ModelItem>();

// get the activity from the datacontext
CustomActivityDesigner cad = this.DataContext as CustomActivityDesigner;
// try to get the variables
// look for variables collection cant seem to find them
ModelProperty mp = cad.ModelItem.Properties["Variables"];

if(mp != null && mp.PropertyType == typeof(Collection<Variable>))

mp.Collection.ToList().ForEach(i => variables.Add(i));


// get name spaces
ModelProperty mp2 = cad.ModelItem.Properties["NameSpaces"];

if(mp2 != null && mp2.PropertyType == typeof(Collection<NameSpace>))

mp2.Collection.ToList().ForEach(i => nameSpaces.Add(i));


// finally need the WorkflowDesigner object
WorkflowDesigner designer = Modelitem.Root....??? as WorkflowDesigner

// now we have what we need we can create the IExpressionEditor
CustomExpressionEditior ce = new CustomExpressionEditior(designer, variables, nameSpaces)









share|improve this question
















I am trying to create a custom IExpressionEditor. In order to new one up I need a WorkflowDesigner, All I have is the ModelItem representing my custom activity. Is it possible to access the WorkflowDesigner from a given ModelItem?



 List<ModelItem> variables = new List<ModelItem>();
List<ModelItem> nameSpaces = new List<ModelItem>();

// get the activity from the datacontext
CustomActivityDesigner cad = this.DataContext as CustomActivityDesigner;
// try to get the variables
// look for variables collection cant seem to find them
ModelProperty mp = cad.ModelItem.Properties["Variables"];

if(mp != null && mp.PropertyType == typeof(Collection<Variable>))

mp.Collection.ToList().ForEach(i => variables.Add(i));


// get name spaces
ModelProperty mp2 = cad.ModelItem.Properties["NameSpaces"];

if(mp2 != null && mp2.PropertyType == typeof(Collection<NameSpace>))

mp2.Collection.ToList().ForEach(i => nameSpaces.Add(i));


// finally need the WorkflowDesigner object
WorkflowDesigner designer = Modelitem.Root....??? as WorkflowDesigner

// now we have what we need we can create the IExpressionEditor
CustomExpressionEditior ce = new CustomExpressionEditior(designer, variables, nameSpaces)






workflow-foundation-4 workflow-foundation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 14:16







user1336827

















asked Nov 13 '18 at 16:18









user1336827user1336827

5931925




5931925












  • The ModelItem property is hierarchical so traversing this you can gain access to the root element of your workflow where defined variables can be found. ModelItem also has information about the type of the property so you can just select properties of certain type.

    – Kousic
    Nov 19 '18 at 13:02












  • @kousic I can see that I can get the root item from my model item, but I cannot cast that to a WorkflowDesigner, nor do I see any properties to access the WorkflowDesigner object. I would like to get the Designer itself, then any variables defined in the scope of my custom activity, and any namespaces. Not finding much info online though.

    – user1336827
    Nov 20 '18 at 14:31











  • Can you give me a sample code of your model item?

    – Kousic
    Nov 21 '18 at 6:51











  • @kousic added sample code

    – user1336827
    Nov 21 '18 at 14:16

















  • The ModelItem property is hierarchical so traversing this you can gain access to the root element of your workflow where defined variables can be found. ModelItem also has information about the type of the property so you can just select properties of certain type.

    – Kousic
    Nov 19 '18 at 13:02












  • @kousic I can see that I can get the root item from my model item, but I cannot cast that to a WorkflowDesigner, nor do I see any properties to access the WorkflowDesigner object. I would like to get the Designer itself, then any variables defined in the scope of my custom activity, and any namespaces. Not finding much info online though.

    – user1336827
    Nov 20 '18 at 14:31











  • Can you give me a sample code of your model item?

    – Kousic
    Nov 21 '18 at 6:51











  • @kousic added sample code

    – user1336827
    Nov 21 '18 at 14:16
















The ModelItem property is hierarchical so traversing this you can gain access to the root element of your workflow where defined variables can be found. ModelItem also has information about the type of the property so you can just select properties of certain type.

– Kousic
Nov 19 '18 at 13:02






The ModelItem property is hierarchical so traversing this you can gain access to the root element of your workflow where defined variables can be found. ModelItem also has information about the type of the property so you can just select properties of certain type.

– Kousic
Nov 19 '18 at 13:02














@kousic I can see that I can get the root item from my model item, but I cannot cast that to a WorkflowDesigner, nor do I see any properties to access the WorkflowDesigner object. I would like to get the Designer itself, then any variables defined in the scope of my custom activity, and any namespaces. Not finding much info online though.

– user1336827
Nov 20 '18 at 14:31





@kousic I can see that I can get the root item from my model item, but I cannot cast that to a WorkflowDesigner, nor do I see any properties to access the WorkflowDesigner object. I would like to get the Designer itself, then any variables defined in the scope of my custom activity, and any namespaces. Not finding much info online though.

– user1336827
Nov 20 '18 at 14:31













Can you give me a sample code of your model item?

– Kousic
Nov 21 '18 at 6:51





Can you give me a sample code of your model item?

– Kousic
Nov 21 '18 at 6:51













@kousic added sample code

– user1336827
Nov 21 '18 at 14:16





@kousic added sample code

– user1336827
Nov 21 '18 at 14:16












1 Answer
1






active

oldest

votes


















-1














Following the Using a Custom Expression Editor as reference, it seems you should be able to create a Custom Expression Service (which will be creating the Expression Editor instances) and register it to the Services collection on the WorkflowDesigner.



Once it's registered in the WorkflowDesigner's Services collection, you'll be able to:



  • Get the editing context for the ModelItem by using ModelItemExtensions.GetEditingContext

  • Access the Services property of the returned EditingContext

  • Retrieve the Custom Expression Service you registered on the WorkflowDesginer

Hope it helps!






share|improve this answer























  • Thanks, yes, I was able to grab the ServiceManager, variables and using statements all off the original modelItem and pass them through.

    – user1336827
    Nov 26 '18 at 18:49










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285216%2fget-workflowdesigner-from-a-modelitem%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









-1














Following the Using a Custom Expression Editor as reference, it seems you should be able to create a Custom Expression Service (which will be creating the Expression Editor instances) and register it to the Services collection on the WorkflowDesigner.



Once it's registered in the WorkflowDesigner's Services collection, you'll be able to:



  • Get the editing context for the ModelItem by using ModelItemExtensions.GetEditingContext

  • Access the Services property of the returned EditingContext

  • Retrieve the Custom Expression Service you registered on the WorkflowDesginer

Hope it helps!






share|improve this answer























  • Thanks, yes, I was able to grab the ServiceManager, variables and using statements all off the original modelItem and pass them through.

    – user1336827
    Nov 26 '18 at 18:49















-1














Following the Using a Custom Expression Editor as reference, it seems you should be able to create a Custom Expression Service (which will be creating the Expression Editor instances) and register it to the Services collection on the WorkflowDesigner.



Once it's registered in the WorkflowDesigner's Services collection, you'll be able to:



  • Get the editing context for the ModelItem by using ModelItemExtensions.GetEditingContext

  • Access the Services property of the returned EditingContext

  • Retrieve the Custom Expression Service you registered on the WorkflowDesginer

Hope it helps!






share|improve this answer























  • Thanks, yes, I was able to grab the ServiceManager, variables and using statements all off the original modelItem and pass them through.

    – user1336827
    Nov 26 '18 at 18:49













-1












-1








-1







Following the Using a Custom Expression Editor as reference, it seems you should be able to create a Custom Expression Service (which will be creating the Expression Editor instances) and register it to the Services collection on the WorkflowDesigner.



Once it's registered in the WorkflowDesigner's Services collection, you'll be able to:



  • Get the editing context for the ModelItem by using ModelItemExtensions.GetEditingContext

  • Access the Services property of the returned EditingContext

  • Retrieve the Custom Expression Service you registered on the WorkflowDesginer

Hope it helps!






share|improve this answer













Following the Using a Custom Expression Editor as reference, it seems you should be able to create a Custom Expression Service (which will be creating the Expression Editor instances) and register it to the Services collection on the WorkflowDesigner.



Once it's registered in the WorkflowDesigner's Services collection, you'll be able to:



  • Get the editing context for the ModelItem by using ModelItemExtensions.GetEditingContext

  • Access the Services property of the returned EditingContext

  • Retrieve the Custom Expression Service you registered on the WorkflowDesginer

Hope it helps!







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 5:52









Itay PodhajcerItay Podhajcer

1,9241412




1,9241412












  • Thanks, yes, I was able to grab the ServiceManager, variables and using statements all off the original modelItem and pass them through.

    – user1336827
    Nov 26 '18 at 18:49

















  • Thanks, yes, I was able to grab the ServiceManager, variables and using statements all off the original modelItem and pass them through.

    – user1336827
    Nov 26 '18 at 18:49
















Thanks, yes, I was able to grab the ServiceManager, variables and using statements all off the original modelItem and pass them through.

– user1336827
Nov 26 '18 at 18:49





Thanks, yes, I was able to grab the ServiceManager, variables and using statements all off the original modelItem and pass them through.

– user1336827
Nov 26 '18 at 18:49

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285216%2fget-workflowdesigner-from-a-modelitem%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

What does pagestruct do in Eviews?

Dutch intervention in Lombok and Karangasem

Channel Islands