コード例 #1
0
        private void OnSelectionChanged(object sender, EventArgs args)
        {
            var classViewModel = (TypeViewModel)sender;

            if (classViewModel.IsSelected)
            {
                ShownTypes.Add(classViewModel);

                // automatically connect to parent in case parent is already shown
                var baseType = classViewModel.WrappedType.BaseType;
                var parent   = GetFromShown(baseType);
                if (parent != null)
                {
                    Connect(classViewModel, parent, ConnectionType.Inheritance);
                }

                // automatically connect to all interfaces that are already shown
                foreach (var @interface in classViewModel.WrappedType.GetInterfaces())
                {
                    var interfaceViewModel = GetFromShown(@interface);
                    if (interfaceViewModel != null)
                    {
                        Connect(classViewModel, interfaceViewModel, ConnectionType.Implementation);
                    }
                }
            }
            else
            {
                Disconnect(classViewModel);
                ShownTypes.Remove(classViewModel);
            }
        }
コード例 #2
0
        /// <summary>
        /// Connects the child with it's parent.
        /// </summary>
        private void OnShowBaseCommandExecute(TypeViewModel @class)
        {
            var parent = GetFromShown(@class.WrappedType.BaseType);

            if (parent == null)
            {
                parent = new TypeViewModel(@class.WrappedType.BaseType);
                ShownTypes.Add(parent);
            }

            Connect(@class, parent, ConnectionType.Inheritance);
        }
コード例 #3
0
        /// <summary>
        /// Connects the class with it's interfaces.
        /// </summary>
        private void OnShowInterfacesCommandExecute(TypeViewModel child)
        {
            foreach (var @interface in child.WrappedType.GetInterfaces())
            {
                var newInterface = GetFromShown(@interface);

                if (newInterface == null)
                {
                    newInterface = new TypeViewModel(@interface);
                    ShownTypes.Add(newInterface);
                }

                Connect(child, newInterface, ConnectionType.Implementation);
            }
        }