代码之家  ›  专栏  ›  技术社区  ›  user1336827

从ModelItem获取WorkflowDesigner

  •  3
  • user1336827  · 技术社区  · 6 年前

       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)
    
    1 回复  |  直到 6 年前
        1
  •  -1
  •   Itay Podhajcer    6 年前

    跟随 Using a Custom Expression Editor (这将创建 实例)并将其注册到 Services 上的集合 工作流设计器 .

    一旦注册到 工作流设计器 服务 收藏,您将能够:

    希望有帮助!