public void AddNewType(ClassViewModel type) { if (!this.Types.Contains(type)) this.Types.Add(type); }
/// <summary> /// Adds new (dropped) item to diagram. /// </summary> /// <param name="classViewModel">The model (representing a type) to be added.</param> /// <param name="point">The position.</param> /// <param name="offset">The displacement.</param> private void AddNewItemToDiagram(ClassViewModel classViewModel, Point point, ref int offset) { if (this.DataContext == null || !(this.DataContext is MainViewModel)) return; classViewModel.Position = new Point(point.X + ((offset % 5) * 200), point.Y + ((offset / 5) * 200)); (this.DataContext as MainViewModel).ClassDiagramGraphSource.AddItem(classViewModel); offset++; }