예제 #1
0
        public static void Assign(ModelItem selected)
        {
            Contract.Requires(selected != null);

            CompositeService.UpdateModelItem(selected, selected.GetActivity().CreateTaskActivity());
        }
예제 #2
0
        private CompositeNode CreateNewNode(CompositeNode parent, ModelItem item, Activity root)
        {
            CompositeNode node = null;
            AssemblyName assembly = null;
            if (item != null)
            {
                assembly = item.GetAssemblyName();

                root = CompositeService.GetRootActivity(item.GetActivity());
                if (root == null)
                {
                    return null;
                }
            }
            else
            {
                assembly = root.GetAssemblyName();
            }
            if (!AssemblyService.AssemblyIsBuiltIn(assembly))
            {
                node = new CompositeNode(GetDisplayName(item, assembly), assembly, parent, item);
                node.Activity = root;

                var subs = WorkflowInspectionServices.GetActivities(node.Activity);
                foreach (var sub in subs)
                {
                    var child = CreateNewNode(node, null, sub);
                    child.IfNotNull(c => node.Children.Add(c));
                }
            }
            return node;
        }
예제 #3
0
        /// <summary>
        /// Update model has same reference
        /// </summary>
        public static void UpdateReference(ModelItem source)
        {
            Contract.Requires(source != null);

            var sourceKey = GetNodeKey(source);
            var assemblyName = sourceKey.Name;

            var needToUpdate = new List<ModelItem>();
            var root = source.Root;
            var tree = CompositeService.GetSubModelItems(root);
            foreach (var model in tree)
            {
                var key = GetNodeKey(model);
                if (key != null && key.Name == assemblyName && model != source)
                {
                    needToUpdate.Add(model);
                }
            }

            foreach (var target in needToUpdate)
            {
                var copyActivity = source.GetActivity().Clone();
                CompositeService.UpdateModelItem(target, copyActivity);
            }
        }