private static bool CanFocusOnModelItem(ModelItem itemToFocus, WorkflowViewService viewService) { Fx.Assert(itemToFocus != null && viewService != null, "null argument"); if (typeof(ITextExpression).IsAssignableFrom(itemToFocus.ItemType)) { return(false); } Type designerType = viewService.GetDesignerType(itemToFocus.ItemType); return(typeof(WorkflowViewElement).IsAssignableFrom(designerType)); }
private static bool CanFocusOnModelItem(ModelItem itemToFocus, WorkflowViewService viewService) { Fx.Assert(itemToFocus != null && viewService != null, "null argument"); if (typeof(ITextExpression).IsAssignableFrom(itemToFocus.ItemType)) { return false; } Type designerType = viewService.GetDesignerType(itemToFocus.ItemType); return typeof(WorkflowViewElement).IsAssignableFrom(designerType); }
internal IEnumerable <ModelItem> GetItemsOnDesigner(bool preOrder, bool excludeRoot, bool excludeErrorActivity, bool excludeExpression, bool includeOtherObjects) { WorkflowViewService viewService = this.WorkflowViewService; IList <ModelItem> items = ModelTreeManager.DepthFirstSearch(modelService.Root, delegate(Type type) { // Only find items on the designer surface. return(includeOtherObjects || (typeof(WorkflowViewElement).IsAssignableFrom(viewService.GetDesignerType(type)))); }, delegate(ModelItem modelItem) { return(!(excludeExpression && modelItem != null && typeof(ITextExpression).IsAssignableFrom(modelItem.ItemType))); }, preOrder); // ModelItemKeyValuePair is associated with CaseDesigner. // So ModelItemKeyValuePair will be returned even if they are not really Cases. // Those ModelItemKeyValuePairs need to be excluded. IEnumerable <ModelItem> itemsToSearch = null; if (!excludeErrorActivity) { itemsToSearch = items.Where <ModelItem>(item => !ModelUtilities.IsModelItemKeyValuePair(item.ItemType) || ModelUtilities.IsSwitchCase(item)); } else { itemsToSearch = items.Where <ModelItem>(item => (!ModelUtilities.IsModelItemKeyValuePair(item.ItemType) || ModelUtilities.IsSwitchCase(item)) && !IsErrorActivity(item)); } if (excludeRoot) { itemsToSearch = itemsToSearch.Except <ModelItem>(new ModelItem[] { modelService.Root }); } return(itemsToSearch); }
private static bool HasView(ModelItem modelItem, WorkflowViewService viewService, bool allowDrillIn) { ActivityDesignerOptionsAttribute options = WorkflowViewService.GetAttribute<ActivityDesignerOptionsAttribute>(modelItem.ItemType); Type viewType = viewService.GetDesignerType(modelItem.ItemType); return typeof(WorkflowViewElement).IsAssignableFrom(viewType) && (!allowDrillIn || options == null || options.AllowDrillIn); }