Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. WF - TreeView

WF - TreeView

Scheduled Pinned Locked Moved WCF and WF
sysadmindata-structureshelpannouncementworkspace
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bonkers123
    wrote on last edited by
    #1

    Hi, I have been trying to make a simple treeView list that should be poppulated by a SequentialWorkFlow.... However, I have not been successful. I Start the workflow instance, send it a TreeView in it's propperties and obtain this populated TreeView again in the Workflow_Completed event. But I can't simply assign this populated treeview to the existing TreeView component.... since this simply does not poppulated the TreeView list. I tired Update() ... but it did nothing. Sorry, I'm still relatively new to workflows. I've been looking around for a solution for some time now, and I have found none... I'm sure there is a simple solution, I just can't think of it. Any help would be much appreciated. Kind regards OnMouseClick.....

                Dictionary<string,> properties = new Dictionary<string,>();
                properties.Add("TreeNodes", \_theTreeView);
                properties.Add("BaseDN", m\_ConnectionSettings.BaseDN);
                properties.Add("LdapConn", m\_LDAPconnection);
                //PoppulateTree(m\_ConnectionSettings.BaseDN); // Poppulate the Tree consisting of units on server under Base DN. 
                WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(Simulator.TreeViewStructure.ObtainTreeView), properties);
                instance.Start();
    

    and then ...

    void workflowRuntime_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
    {
    TreeView val = (TreeView)e.OutputParameters["TreeNodes"];
    treeView = val;
    Update();
    }

    I know the PoppulateTree function works, since it works fine if I don't do it in the workflow. Also, it's fine when I step through it.

    B K 2 Replies Last reply
    0
    • B bonkers123

      Hi, I have been trying to make a simple treeView list that should be poppulated by a SequentialWorkFlow.... However, I have not been successful. I Start the workflow instance, send it a TreeView in it's propperties and obtain this populated TreeView again in the Workflow_Completed event. But I can't simply assign this populated treeview to the existing TreeView component.... since this simply does not poppulated the TreeView list. I tired Update() ... but it did nothing. Sorry, I'm still relatively new to workflows. I've been looking around for a solution for some time now, and I have found none... I'm sure there is a simple solution, I just can't think of it. Any help would be much appreciated. Kind regards OnMouseClick.....

                  Dictionary<string,> properties = new Dictionary<string,>();
                  properties.Add("TreeNodes", \_theTreeView);
                  properties.Add("BaseDN", m\_ConnectionSettings.BaseDN);
                  properties.Add("LdapConn", m\_LDAPconnection);
                  //PoppulateTree(m\_ConnectionSettings.BaseDN); // Poppulate the Tree consisting of units on server under Base DN. 
                  WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(Simulator.TreeViewStructure.ObtainTreeView), properties);
                  instance.Start();
      

      and then ...

      void workflowRuntime_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
      {
      TreeView val = (TreeView)e.OutputParameters["TreeNodes"];
      treeView = val;
      Update();
      }

      I know the PoppulateTree function works, since it works fine if I don't do it in the workflow. Also, it's fine when I step through it.

      B Offline
      B Offline
      bonkers123
      wrote on last edited by
      #2

      Any ideas .... PLZ ?

      1 Reply Last reply
      0
      • B bonkers123

        Hi, I have been trying to make a simple treeView list that should be poppulated by a SequentialWorkFlow.... However, I have not been successful. I Start the workflow instance, send it a TreeView in it's propperties and obtain this populated TreeView again in the Workflow_Completed event. But I can't simply assign this populated treeview to the existing TreeView component.... since this simply does not poppulated the TreeView list. I tired Update() ... but it did nothing. Sorry, I'm still relatively new to workflows. I've been looking around for a solution for some time now, and I have found none... I'm sure there is a simple solution, I just can't think of it. Any help would be much appreciated. Kind regards OnMouseClick.....

                    Dictionary<string,> properties = new Dictionary<string,>();
                    properties.Add("TreeNodes", \_theTreeView);
                    properties.Add("BaseDN", m\_ConnectionSettings.BaseDN);
                    properties.Add("LdapConn", m\_LDAPconnection);
                    //PoppulateTree(m\_ConnectionSettings.BaseDN); // Poppulate the Tree consisting of units on server under Base DN. 
                    WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(Simulator.TreeViewStructure.ObtainTreeView), properties);
                    instance.Start();
        

        and then ...

        void workflowRuntime_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
        {
        TreeView val = (TreeView)e.OutputParameters["TreeNodes"];
        treeView = val;
        Update();
        }

        I know the PoppulateTree function works, since it works fine if I don't do it in the workflow. Also, it's fine when I step through it.

        K Offline
        K Offline
        Kevin McFarlane
        wrote on last edited by
        #3

        You have to do your update work on the UI thread. The pattern is like this, adapted from one of the Microsoft samples (OrderingStateMachine).

        private void Update()
        {
        if (this.InvokeRequired)
        {
        // This code is executing on a different thread than the one that
        // ...created the TreeView, so we need to use the Invoke method.

            // Create an instance of the delegate for invoking this method
            UpdateDelegate update = new UpdateDelegate(this.Update);
        
            // Invoke this method on the UI thread
            this.Invoke(update);
        }
        else
        {
            // Insert your update code here;
        }
        

        }

        BTW, I highly recommend the book, Pro WF by Bruce Bukovics. This is in its VS 2008 edition now. I have the first edition.

        Kevin

        B 1 Reply Last reply
        0
        • K Kevin McFarlane

          You have to do your update work on the UI thread. The pattern is like this, adapted from one of the Microsoft samples (OrderingStateMachine).

          private void Update()
          {
          if (this.InvokeRequired)
          {
          // This code is executing on a different thread than the one that
          // ...created the TreeView, so we need to use the Invoke method.

              // Create an instance of the delegate for invoking this method
              UpdateDelegate update = new UpdateDelegate(this.Update);
          
              // Invoke this method on the UI thread
              this.Invoke(update);
          }
          else
          {
              // Insert your update code here;
          }
          

          }

          BTW, I highly recommend the book, Pro WF by Bruce Bukovics. This is in its VS 2008 edition now. I have the first edition.

          Kevin

          B Offline
          B Offline
          bonkers
          wrote on last edited by
          #4

          omg ... tnx a lot ! That helps ^_^ I will buy that one ... hope it's a good read !

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups