Пример #1
0
 public PlotterViewModel(IViewModelProvider viewModelProvider, IModelProvider modelProvider)
 {
     _viewModelProvider = viewModelProvider;
     _modelProvider     = modelProvider;
     Nodes = new ObservableCollection <INodeViewModel>
     {
         _viewModelProvider.GetNodeViewModel(_modelProvider.GetNode(0, 0))
     };
 }
Пример #2
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);
            }
        }
Пример #3
0
        public INodeViewModel GetNodeViewModel(ICartesianPoint point, string name)
        {
            INode node = _modelProvider.GetNode(point, name);

            return(new NodeViewModel(node));
        }