private void OnSelectionChanged(object sender, EventArgs e) { WorkflowView service = this.serviceProvider.GetService(typeof(WorkflowView)) as WorkflowView; if (service != null) { service.Invalidate(); } this.RefreshTasks(); }
private void OnRefreshTasks(object sender, EventArgs e) { WorkflowView workflowView = this.serviceProvider.GetService(typeof(WorkflowView)) as WorkflowView; if (this.refreshTasksHandler != null) { if (workflowView != null) { workflowView.Idle -= this.refreshTasksHandler; } this.refreshTasksHandler = null; } ISelectionService selectionService = this.serviceProvider.GetService(typeof(ISelectionService)) as ISelectionService; IExtendedUIService extendedUIService = this.serviceProvider.GetService(typeof(IExtendedUIService)) as IExtendedUIService; if (selectionService != null && extendedUIService != null) { extendedUIService.RemoveDesignerActions(); //Only if the current designer is active designer we add the designer actions to the task list IDesignerEventService designerEventService = (IDesignerEventService)this.serviceProvider.GetService(typeof(IDesignerEventService)); if (designerEventService != null && designerEventService.ActiveDesigner == this.serviceProvider.GetService(typeof(IDesignerHost))) { foreach (object obj in selectionService.GetSelectedComponents()) { ActivityDesigner activityDesigner = null; if (obj is HitTestInfo) { activityDesigner = ((HitTestInfo)obj).AssociatedDesigner; } else if (obj is Activity) { activityDesigner = ActivityDesigner.GetDesigner(obj as Activity); } if (activityDesigner != null) { extendedUIService.AddDesignerActions(new List <DesignerAction>(activityDesigner.DesignerActions).ToArray()); } } } } if (workflowView != null) { workflowView.Invalidate(); } }
private void OnRefreshTasks(object sender, EventArgs e) { WorkflowView view = this.serviceProvider.GetService(typeof(WorkflowView)) as WorkflowView; if (this.refreshTasksHandler != null) { if (view != null) { view.Idle -= this.refreshTasksHandler; } this.refreshTasksHandler = null; } ISelectionService service = this.serviceProvider.GetService(typeof(ISelectionService)) as ISelectionService; IExtendedUIService service2 = this.serviceProvider.GetService(typeof(IExtendedUIService)) as IExtendedUIService; if ((service != null) && (service2 != null)) { service2.RemoveDesignerActions(); IDesignerEventService service3 = (IDesignerEventService)this.serviceProvider.GetService(typeof(IDesignerEventService)); if ((service3 != null) && (service3.ActiveDesigner == this.serviceProvider.GetService(typeof(IDesignerHost)))) { foreach (object obj2 in service.GetSelectedComponents()) { ActivityDesigner associatedDesigner = null; if (obj2 is HitTestInfo) { associatedDesigner = ((HitTestInfo)obj2).AssociatedDesigner; } else if (obj2 is Activity) { associatedDesigner = ActivityDesigner.GetDesigner(obj2 as Activity); } if (associatedDesigner != null) { service2.AddDesignerActions(new List <DesignerAction>(associatedDesigner.DesignerActions).ToArray()); } } } } if (view != null) { view.Invalidate(); } }
internal static void SetDesignerBounds(ActivityDesigner designer, Rectangle bounds) { if (((designer != null) && (designer.Activity != null)) && (designer.Activity.Site != null)) { PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(designer); PropertyDescriptor descriptor = (properties != null) ? properties["Size"] : null; if (descriptor != null) { descriptor.SetValue(designer.Activity, bounds.Size); } else { designer.Size = bounds.Size; } PropertyDescriptor descriptor2 = (properties != null) ? properties["Location"] : null; if (descriptor2 != null) { descriptor2.SetValue(designer.Activity, bounds.Location); } else { designer.Location = bounds.Location; } WorkflowView service = designer.Activity.Site.GetService(typeof(WorkflowView)) as WorkflowView; if (service != null) { if (designer.ParentDesigner != null) { service.InvalidateLogicalRectangle(designer.ParentDesigner.Bounds); } else { service.Invalidate(); } } } }