예제 #1
0
        protected void RefreshNode(WorkflowOutlineNode nodeToUpdate, bool refreshChildNodes)
        {
            this.treeView.BeginUpdate();

            Queue <WorkflowOutlineNode> nodesQ = new Queue <WorkflowOutlineNode>();

            nodesQ.Enqueue(nodeToUpdate);
            while (nodesQ.Count > 0)
            {
                WorkflowOutlineNode node = nodesQ.Dequeue();
                OnRefreshNode(node);

                if (refreshChildNodes)
                {
                    foreach (TreeNode childNode in node.Nodes)
                    {
                        WorkflowOutlineNode childOutlineNode = childNode as WorkflowOutlineNode;
                        if (childOutlineNode != null)
                        {
                            Activity childActivity = childOutlineNode.Activity;
                            if (childActivity != null)
                            {
                                nodesQ.Enqueue(childOutlineNode);
                            }
                        }
                    }
                }

                this.treeView.EndUpdate();
            }
        }
예제 #2
0
 private void InsertDocOutlineNode(WorkflowOutlineNode parentNode, Activity activity, int childIndex, bool addNestedActivities)
 {
     if (!this.activityToNodeMapping.Contains(activity))
     {
         WorkflowOutlineNode nodeToUpdate = this.CreateNewNode(activity);
         if (nodeToUpdate != null)
         {
             this.RefreshNode(nodeToUpdate, false);
             this.activityToNodeMapping.Add(activity, nodeToUpdate);
             if (addNestedActivities && (activity is CompositeActivity))
             {
                 foreach (Activity activity2 in ((CompositeActivity)activity).Activities)
                 {
                     this.InsertDocOutlineNode(nodeToUpdate, activity2, nodeToUpdate.Nodes.Count, addNestedActivities);
                 }
             }
             if (parentNode != null)
             {
                 parentNode.Nodes.Insert(childIndex, nodeToUpdate);
             }
             else
             {
                 this.treeView.Nodes.Add(nodeToUpdate);
             }
             this.OnNodeAdded(nodeToUpdate);
         }
     }
 }
예제 #3
0
        private void OnTreeViewAfterSelect(object sender, TreeViewEventArgs e)
        {
            // Change the primary selection of the selection service
            WorkflowOutlineNode node = e.Node as WorkflowOutlineNode;

            OnNodeSelected(node);
        }
예제 #4
0
 protected virtual void OnRefreshNode(WorkflowOutlineNode node)
 {
     if (node != null)
     {
         Activity activity = node.Activity;
         if (activity != null)
         {
             int num = (this.treeView.ImageList != null) ? this.treeView.ImageList.Images.IndexOfKey(activity.GetType().FullName) : -1;
             if (num == -1)
             {
                 ActivityDesigner designer = ActivityDesigner.GetDesigner(activity);
                 if (designer != null)
                 {
                     Bitmap stockImage = designer.StockImage as Bitmap;
                     if (stockImage != null)
                     {
                         if (this.treeView.ImageList == null)
                         {
                             this.treeView.ImageList            = new ImageList();
                             this.treeView.ImageList.ColorDepth = ColorDepth.Depth32Bit;
                         }
                         this.treeView.ImageList.Images.Add(activity.GetType().FullName, stockImage);
                         num = this.treeView.ImageList.Images.Count - 1;
                     }
                 }
             }
             node.ImageIndex = node.SelectedImageIndex = num;
             node.RefreshNode();
         }
     }
 }
예제 #5
0
 private void OnComponentRename(object sender, ComponentRenameEventArgs e)
 {
     if (e.Component is Activity)
     {
         WorkflowOutlineNode node = this.activityToNodeMapping[e.Component] as WorkflowOutlineNode;
         if (node != null)
         {
             node.OnActivityRename(e.NewName);
         }
     }
 }
예제 #6
0
        protected virtual void OnNodeSelected(WorkflowOutlineNode node)
        {
            ISelectionService service = this.GetService(typeof(ISelectionService)) as ISelectionService;

            if (((service != null) && (node != null)) && (service.PrimarySelection != node.Activity))
            {
                WorkflowView view = this.GetService(typeof(WorkflowView)) as WorkflowView;
                if (view != null)
                {
                    view.EnsureVisible(node.Activity);
                }
                service.SetSelectedComponents(new object[] { node.Activity }, SelectionTypes.Replace);
            }
        }
예제 #7
0
 private void OnComponentChanged(object sender, ComponentChangedEventArgs e)
 {
     if (e.OldValue is ActivityCollectionChangeEventArgs)
     {
         this.IsDirty = true;
     }
     else if ((e.Member != null) && (e.Component is Activity))
     {
         WorkflowOutlineNode nodeToUpdate = this.activityToNodeMapping[e.Component] as WorkflowOutlineNode;
         if ((nodeToUpdate != null) && string.Equals(e.Member.Name, "Enabled", StringComparison.Ordinal))
         {
             this.RefreshNode(nodeToUpdate, true);
         }
     }
 }
예제 #8
0
        //gets called when user selected a node in the activity tree
        protected virtual void OnNodeSelected(WorkflowOutlineNode node)
        {
            ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService;

            if (selectionService != null && node != null && selectionService.PrimarySelection != node.Activity)
            {
                // make the selected shape visible (note - the order is important, EnsureVisible will
                // expand appropiate branches and set CAG into edit mode, which is crucial for
                // SetSelectedComponents to perform well)
                WorkflowView workflowView = GetService(typeof(WorkflowView)) as WorkflowView;
                if (workflowView != null)
                {
                    workflowView.EnsureVisible(node.Activity);
                }

                // select it
                selectionService.SetSelectedComponents(new object[] { node.Activity }, SelectionTypes.Replace);
            }
        }
예제 #9
0
        protected virtual void OnRefreshNode(WorkflowOutlineNode node)
        {
            if (node == null)
            {
                return;
            }

            Activity activity = node.Activity;

            if (activity == null)
            {
                return;
            }

            //Update the designer image
            int imageIndex = (this.treeView.ImageList != null) ? this.treeView.ImageList.Images.IndexOfKey(activity.GetType().FullName) : -1;

            if (imageIndex == -1)
            {
                ActivityDesigner activityDesigner = ActivityDesigner.GetDesigner(activity);
                if (activityDesigner != null)
                {
                    Bitmap activityImage = activityDesigner.StockImage as Bitmap;
                    if (activityImage != null)
                    {
                        if (this.treeView.ImageList == null)
                        {
                            this.treeView.ImageList            = new ImageList();
                            this.treeView.ImageList.ColorDepth = ColorDepth.Depth32Bit;
                        }

                        this.treeView.ImageList.Images.Add(activity.GetType().FullName, activityImage);
                        imageIndex = this.treeView.ImageList.Images.Count - 1;
                    }
                }
            }
            node.ImageIndex = node.SelectedImageIndex = imageIndex;

            //ask the node to update its color, text, etc
            node.RefreshNode();
        }
예제 #10
0
        protected void RefreshNode(WorkflowOutlineNode nodeToUpdate, bool refreshChildNodes)
        {
            this.treeView.BeginUpdate();
            Queue <WorkflowOutlineNode> queue = new Queue <WorkflowOutlineNode>();

            queue.Enqueue(nodeToUpdate);
            while (queue.Count > 0)
            {
                WorkflowOutlineNode node = queue.Dequeue();
                this.OnRefreshNode(node);
                if (refreshChildNodes)
                {
                    foreach (TreeNode node2 in node.Nodes)
                    {
                        WorkflowOutlineNode item = node2 as WorkflowOutlineNode;
                        if ((item != null) && (item.Activity != null))
                        {
                            queue.Enqueue(item);
                        }
                    }
                }
                this.treeView.EndUpdate();
            }
        }
예제 #11
0
        private void InsertDocOutlineNode(WorkflowOutlineNode parentNode, Activity activity, int childIndex, bool addNestedActivities)
        {
            if (this.activityToNodeMapping.Contains(activity))
            {
                return;
            }

            WorkflowOutlineNode newNode = CreateNewNode(activity);

            if (newNode == null)
            {
                return;
            }

            RefreshNode(newNode, false);
            this.activityToNodeMapping.Add(activity, newNode);

            if (addNestedActivities && activity is CompositeActivity)
            {
                foreach (Activity childActivity in ((CompositeActivity)activity).Activities)
                {
                    InsertDocOutlineNode(newNode, childActivity, newNode.Nodes.Count, addNestedActivities);
                }
            }

            if (parentNode != null)
            {
                parentNode.Nodes.Insert(childIndex, newNode);
            }
            else
            {
                this.treeView.Nodes.Add(newNode);
            }

            OnNodeAdded(newNode);
        }
 //gets called after adding a new not-null node to the activity tree
 protected virtual void OnNodeAdded(WorkflowOutlineNode node)
 {
 }
        //gets called when user selected a node in the activity tree
        protected virtual void OnNodeSelected(WorkflowOutlineNode node)
        {
            ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService;
            if (selectionService != null && node != null && selectionService.PrimarySelection != node.Activity)
            {
                // make the selected shape visible (note - the order is important, EnsureVisible will 
                // expand appropiate branches and set CAG into edit mode, which is crucial for 
                // SetSelectedComponents to perform well)
                WorkflowView workflowView = GetService(typeof(WorkflowView)) as WorkflowView;
                if (workflowView != null)
                    workflowView.EnsureVisible(node.Activity);

                // select it
                selectionService.SetSelectedComponents(new object[] { node.Activity }, SelectionTypes.Replace);
            }
        }
        protected virtual void OnRefreshNode(WorkflowOutlineNode node)
        {
            if (node == null)
                return;

            Activity activity = node.Activity;
            if (activity == null)
                return;

            //Update the designer image
            int imageIndex = (this.treeView.ImageList != null) ? this.treeView.ImageList.Images.IndexOfKey(activity.GetType().FullName) : -1;
            if (imageIndex == -1)
            {
                ActivityDesigner activityDesigner = ActivityDesigner.GetDesigner(activity);
                if (activityDesigner != null)
                {
                    Bitmap activityImage = activityDesigner.StockImage as Bitmap;
                    if (activityImage != null)
                    {
                        if (this.treeView.ImageList == null)
                        {
                            this.treeView.ImageList = new ImageList();
                            this.treeView.ImageList.ColorDepth = ColorDepth.Depth32Bit;
                        }

                        this.treeView.ImageList.Images.Add(activity.GetType().FullName, activityImage);
                        imageIndex = this.treeView.ImageList.Images.Count - 1;
                    }
                }
            }
            node.ImageIndex = node.SelectedImageIndex = imageIndex;

            //ask the node to update its color, text, etc
            node.RefreshNode();
        }
 protected void RefreshNode(WorkflowOutlineNode nodeToUpdate, bool refreshChildNodes)
 {
     this.treeView.BeginUpdate();
     Queue<WorkflowOutlineNode> queue = new Queue<WorkflowOutlineNode>();
     queue.Enqueue(nodeToUpdate);
     while (queue.Count > 0)
     {
         WorkflowOutlineNode node = queue.Dequeue();
         this.OnRefreshNode(node);
         if (refreshChildNodes)
         {
             foreach (TreeNode node2 in node.Nodes)
             {
                 WorkflowOutlineNode item = node2 as WorkflowOutlineNode;
                 if ((item != null) && (item.Activity != null))
                 {
                     queue.Enqueue(item);
                 }
             }
         }
         this.treeView.EndUpdate();
     }
 }
 protected virtual void OnRefreshNode(WorkflowOutlineNode node)
 {
     if (node != null)
     {
         Activity activity = node.Activity;
         if (activity != null)
         {
             int num = (this.treeView.ImageList != null) ? this.treeView.ImageList.Images.IndexOfKey(activity.GetType().FullName) : -1;
             if (num == -1)
             {
                 ActivityDesigner designer = ActivityDesigner.GetDesigner(activity);
                 if (designer != null)
                 {
                     Bitmap stockImage = designer.StockImage as Bitmap;
                     if (stockImage != null)
                     {
                         if (this.treeView.ImageList == null)
                         {
                             this.treeView.ImageList = new ImageList();
                             this.treeView.ImageList.ColorDepth = ColorDepth.Depth32Bit;
                         }
                         this.treeView.ImageList.Images.Add(activity.GetType().FullName, stockImage);
                         num = this.treeView.ImageList.Images.Count - 1;
                     }
                 }
             }
             node.ImageIndex = node.SelectedImageIndex = num;
             node.RefreshNode();
         }
     }
 }
 protected virtual void OnNodeSelected(WorkflowOutlineNode node)
 {
     ISelectionService service = this.GetService(typeof(ISelectionService)) as ISelectionService;
     if (((service != null) && (node != null)) && (service.PrimarySelection != node.Activity))
     {
         WorkflowView view = this.GetService(typeof(WorkflowView)) as WorkflowView;
         if (view != null)
         {
             view.EnsureVisible(node.Activity);
         }
         service.SetSelectedComponents(new object[] { node.Activity }, SelectionTypes.Replace);
     }
 }
 private void InsertDocOutlineNode(WorkflowOutlineNode parentNode, Activity activity, int childIndex, bool addNestedActivities)
 {
     if (!this.activityToNodeMapping.Contains(activity))
     {
         WorkflowOutlineNode nodeToUpdate = this.CreateNewNode(activity);
         if (nodeToUpdate != null)
         {
             this.RefreshNode(nodeToUpdate, false);
             this.activityToNodeMapping.Add(activity, nodeToUpdate);
             if (addNestedActivities && (activity is CompositeActivity))
             {
                 foreach (Activity activity2 in ((CompositeActivity) activity).Activities)
                 {
                     this.InsertDocOutlineNode(nodeToUpdate, activity2, nodeToUpdate.Nodes.Count, addNestedActivities);
                 }
             }
             if (parentNode != null)
             {
                 parentNode.Nodes.Insert(childIndex, nodeToUpdate);
             }
             else
             {
                 this.treeView.Nodes.Add(nodeToUpdate);
             }
             this.OnNodeAdded(nodeToUpdate);
         }
     }
 }
 protected override void OnNodeSelected(WorkflowOutlineNode node)
 {
     //notify the form that activity selection has been changed
     this.selectedActivity = (node != null) ? node.Activity : null;
     MemberActivityBindTreeNode memberNode = node as MemberActivityBindTreeNode;
     this.selectedPathInfo = (memberNode != null) ? memberNode.PathInfo : null;
     string path = PropertyPath;
     this.parent.SelectedActivityChanged(this.selectedActivity, this.selectedPathInfo, path);
 }
 protected override void OnNodeSelected(WorkflowOutlineNode node)
 {
     this.selectedActivity = (node != null) ? node.Activity : null;
     ActivityBindForm.MemberActivityBindTreeNode node2 = node as ActivityBindForm.MemberActivityBindTreeNode;
     this.selectedPathInfo = (node2 != null) ? node2.PathInfo : null;
     string propertyPath = this.PropertyPath;
     this.parent.SelectedActivityChanged(this.selectedActivity, this.selectedPathInfo, propertyPath);
 }
        protected void RefreshNode(WorkflowOutlineNode nodeToUpdate, bool refreshChildNodes)
        {
            this.treeView.BeginUpdate();

            Queue<WorkflowOutlineNode> nodesQ = new Queue<WorkflowOutlineNode>();
            nodesQ.Enqueue(nodeToUpdate);
            while (nodesQ.Count > 0)
            {
                WorkflowOutlineNode node = nodesQ.Dequeue();
                OnRefreshNode(node);

                if (refreshChildNodes)
                {
                    foreach (TreeNode childNode in node.Nodes)
                    {
                        WorkflowOutlineNode childOutlineNode = childNode as WorkflowOutlineNode;
                        if (childOutlineNode != null)
                        {
                            Activity childActivity = childOutlineNode.Activity;
                            if (childActivity != null)
                                nodesQ.Enqueue(childOutlineNode);
                        }
                    }
                }

                this.treeView.EndUpdate();
            }
        }
예제 #22
0
 protected virtual void OnNodeAdded(WorkflowOutlineNode node)
 {
 }
        private void InsertDocOutlineNode(WorkflowOutlineNode parentNode, Activity activity, int childIndex, bool addNestedActivities)
        {
            if (this.activityToNodeMapping.Contains(activity))
                return;

            WorkflowOutlineNode newNode = CreateNewNode(activity);
            if (newNode == null)
                return;

            RefreshNode(newNode, false);
            this.activityToNodeMapping.Add(activity, newNode);

            if (addNestedActivities && activity is CompositeActivity)
            {
                foreach (Activity childActivity in ((CompositeActivity)activity).Activities)
                    InsertDocOutlineNode(newNode, childActivity, newNode.Nodes.Count, addNestedActivities);
            }

            if (parentNode != null)
                parentNode.Nodes.Insert(childIndex, newNode);
            else
                this.treeView.Nodes.Add(newNode);

            OnNodeAdded(newNode);
        }
예제 #24
0
        private void OnTreeViewAfterSelect(object sender, TreeViewEventArgs e)
        {
            WorkflowOutlineNode node = e.Node as WorkflowOutlineNode;

            this.OnNodeSelected(node);
        }
 protected override void OnRefreshNode(WorkflowOutlineNode node)
 {
     if (node.Activity != null)
     {
         ActivityBindForm.MemberActivityBindTreeNode node2 = node as ActivityBindForm.MemberActivityBindTreeNode;
         if (node2 != null)
         {
             node.RefreshNode();
             int num = (int) (node2.MemberKind + ((ActivityBindForm.BindMemberKind) ((int) node2.MemberAccessKind)));
             node.ImageIndex = node.SelectedImageIndex = base.TreeView.ImageList.Images.IndexOfKey(string.Format(CultureInfo.InvariantCulture, "MemberType#{0}", new object[] { num }));
         }
         else
         {
             base.OnRefreshNode(node);
         }
     }
 }
            protected override void OnRefreshNode(WorkflowOutlineNode node)
            {
                Activity activity = node.Activity;
                if (activity == null)
                    return;

                MemberActivityBindTreeNode memberNode = node as MemberActivityBindTreeNode;
                if (memberNode != null)
                {
                    node.RefreshNode();
                    int imageNumber = (int)memberNode.MemberKind + (int)memberNode.MemberAccessKind;
                    node.ImageIndex = node.SelectedImageIndex = this.TreeView.ImageList.Images.IndexOfKey(string.Format(CultureInfo.InvariantCulture, MemberTypeFormat, imageNumber)); //it's non-localizable
                }
                else
                {
                    ActivityBindTreeNode activityNode = node as ActivityBindTreeNode;
                    //if (this.activityNodeFont == null)
                    //    this.activityNodeFont = new Font(Font, FontStyle.Bold);
                    //activityNode.NodeFont = this.activityNodeFont;

                    base.OnRefreshNode(node);
                }
            }