Exemple #1
0
        private void Disconnect(TypeViewModel vm)
        {
            var connToRemove = Connections.Where(c =>
                                                 (c.Start.FullName == vm.FullName) ||
                                                 (c.End.FullName == vm.FullName)).ToList();

            connToRemove.ForEach(c => Connections.Remove(c));
        }
Exemple #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);
        }
        /// <summary>
        /// Initialize the Collection of all Classes contained within this Namespace.
        /// </summary>
        private void PopulateClasses()
        {
            Classes = new ObservableCollection <TypeViewModel>();
            var exportedTypes = _assembly.GetExportedTypes().Where(t => t.Namespace == Namespace);

            foreach (var t in exportedTypes)
            {
                var c = new TypeViewModel(t);
                c.SelectionChanged += OnSelectionChanged;
                Classes.Add(c);
            }
        }
Exemple #4
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);
            }
        }
Exemple #5
0
 /// <summary>
 /// Creates new ConnectionViewModel and connects the child with it's parent
 /// </summary>
 private void Connect(TypeViewModel child, TypeViewModel parent, ConnectionType connType)
 {
     Connections.Add(new ConnectionViewModel(child, parent, connType));
 }
Exemple #6
0
 private bool OnShowBaseCommandCanExecute(TypeViewModel classVm)
 {
     // Object doesn't have any base class -> disable
     return(classVm?.WrappedType?.BaseType != null);
 }
Exemple #7
0
 public ConnectionViewModel(TypeViewModel start, TypeViewModel end, ConnectionType type)
 {
     Start          = start;
     End            = end;
     ConnectionType = type;
 }