Пример #1
0
        private void setDelegates()
        {
            //tell the control who can expand
            TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object x)
            {
                var checkGroup = x as CheckGroup;
                return(checkGroup != null && checkGroup.subItems.Any());
            };
            this.olvChecks.CanExpandGetter = canExpandGetter;
            //tell the control how to expand
            TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object x)
            {
                var checkGroup = x as CheckGroup;
                return(checkGroup?.subItems);
            };
            this.olvChecks.ChildrenGetter = childrenGetter;
            //tell the control which image to show
            ImageGetterDelegate imageGetter = delegate(object rowObject)
            {
                if (rowObject is Check)
                {
                    return("Check");
                }
                else
                {
                    return("package");
                }
            };

            this.olvColName.ImageGetter = imageGetter;
        }
        private void setDelegates()
        {
            //tell the control who can expand
            TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object x)
            {
                var mappingNode = (MappingNode)x;
                return(mappingNode.childNodes.Any());
            };
            this.sourceTreeView.CanExpandGetter = canExpandGetter;
            this.targetTreeView.CanExpandGetter = canExpandGetter;
            //tell the control how to expand
            TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object x)
            {
                var mappingNode = (MappingNode)x;
                return(mappingNode.childNodes);
            };
            this.sourceTreeView.ChildrenGetter = childrenGetter;
            this.targetTreeView.ChildrenGetter = childrenGetter;
            //parentgetter to be able to reveal deeply nested nodes
            TreeListView.ParentGetterDelegate parentGetter = delegate(object x)
            {
                var mappingNode = (MappingNode)x;
                return(mappingNode.parent);
            };
            this.sourceTreeView.ParentGetter = parentGetter;
            this.targetTreeView.ParentGetter = parentGetter;
            //tell the control which image to show
            ImageGetterDelegate imageGetter = delegate(object rowObject)
            {
                if (rowObject is ElementMappingNode)
                {
                    if (((ElementMappingNode)rowObject).source is UML.Classes.Kernel.Package)
                    {
                        return("packageNode");
                    }
                    else
                    {
                        return("classifierNode");
                    }
                }
                if (rowObject is AttributeMappingNode)
                {
                    return("attributeNode");
                }

                if (rowObject is AssociationMappingNode)
                {
                    return("associationNode");
                }
                else
                {
                    return(string.Empty);
                }
            };

            this.sourceColumn.ImageGetter = imageGetter;
            this.targetColumn.ImageGetter = imageGetter;
        }
        private void setDelegates()
        {
            //tell the control who can expand
            TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object x)
            {
                var checkGroup = x as CheckGroup;
                return(checkGroup != null && checkGroup.subItems.Any());
            };
            this.olvChecks.CanExpandGetter = canExpandGetter;
            //tell the control how to expand
            TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object x)
            {
                var checkGroup = x as CheckGroup;
                return(checkGroup?.subItems);
            };
            this.olvChecks.ChildrenGetter = childrenGetter;
            //set image for check
            ImageGetterDelegate checkImageGetter = delegate(object rowObject)
            {
                var checkObject = rowObject as Check;
                if (checkObject != null)
                {
                    if (checkObject.canBeResolved)
                    {
                        return("CheckAutoResolve");
                    }
                    return("Check");
                }
                return("package");
            };

            this.olvColName.ImageGetter = checkImageGetter;
            //set image for validation
            ImageGetterDelegate validationImageGetter = delegate(object rowObject)
            {
                var validationObject = rowObject as Validation;
                if (validationObject != null)
                {
                    if (validationObject.isResolved)
                    {
                        return("Check");
                    }
                    if (validationObject.check.canBeResolved)
                    {
                        return("ErrorAutoResolve");
                    }
                    return("Error");
                }
                return(string.Empty);
            };

            this.olvColCheck.ImageGetter = validationImageGetter;
        }
        private void setDelegates()
        {
            //tell the control who can expand
            TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object o)
            {
                var scriptGroup = o as ScriptGroup;
                if (scriptGroup != null)
                {
                    return(scriptGroup.scripts.Any());
                }
                var script = o as Script;
                if (script != null)
                {
                    return(script.includedScripts.Any());
                }
                return(((ScriptInclude)o).hasIncludes);
            };
            this.refdataTreeView.CanExpandGetter = canExpandGetter;
            //tell the control how to expand
            TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object o)
            {
                var scriptGroup = o as ScriptGroup;
                if (scriptGroup != null)
                {
                    return(scriptGroup.scripts.OrderBy(x => x.name));
                }
                var script = o as Script;
                if (script != null)
                {
                    return(script.includedScripts);
                }
                return(((ScriptInclude)o).scriptIncludes);
            };
            this.refdataTreeView.ChildrenGetter = childrenGetter;
            //tell the control which image to show
            ImageGetterDelegate imageGetter = delegate(object rowObject)
            {
                if (rowObject is Script ||
                    rowObject is ScriptInclude)
                {
                    return("Script");
                }
                else
                {
                    return("ScriptGroup");
                }
            };

            this.nameColumn.ImageGetter = imageGetter;
        }
        private void setColumnsListViewDelegates()
        {
            //tell the control who can expand (only tables)
            TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object x)
            {
                return(x is EDDTable);
            };
            this.columnsListView.CanExpandGetter  = canExpandGetter;
            this.dColumnsListView.CanExpandGetter = canExpandGetter;
            //tell the control how to expand
            TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object x)
            {
                var table = (EDDTable)x;
                return(table.columns);
            };
            this.columnsListView.ChildrenGetter  = childrenGetter;
            this.dColumnsListView.ChildrenGetter = childrenGetter;
            //tell the control which image to show
            ImageGetterDelegate imageGetter = delegate(object rowObject)
            {
                if (rowObject is EDDTable)
                {
                    return("table");
                }
                if (rowObject is EDDColumn)
                {
                    return("column");
                }
                else
                {
                    return(string.Empty);
                }
            };

            this.C_NameColumn.ImageGetter  = imageGetter;
            this.dC_NameColumn.ImageGetter = imageGetter;
        }