public PlotterViewModel(IViewModelProvider viewModelProvider, IModelProvider modelProvider) { _viewModelProvider = viewModelProvider; _modelProvider = modelProvider; Nodes = new ObservableCollection <INodeViewModel> { _viewModelProvider.GetNodeViewModel(_modelProvider.GetNode(0, 0)) }; }
public void OnCanvasClick(object e) { var eventArgs = e as RoutedEventArgs; var button = eventArgs.OriginalSource as Button; Point a = Mouse.GetPosition(button); if (a != null) { Point relPoint = button.TranslatePoint(a, button); INodeViewModel newNode = _viewModelProvider.GetNodeViewModel(_modelProvider.GetNode(a.X - button.ActualWidth, a.Y - button.ActualHeight)); Nodes.Add(newNode); } }
public INodeViewModel GetNodeViewModel(ICartesianPoint point, string name) { INode node = _modelProvider.GetNode(point, name); return(new NodeViewModel(node)); }