public void Initialize(MapEditorViewVM vm) { _vm = vm; MapBodyViewer.Initialize(_vm); _vm.PropertyChanged += _vm_PropertyChanged; }
public void Initialize(MapEditorViewVM vm) { _vm = vm ?? throw new ArgumentNullException(nameof(MapEditorViewVM)); _vm.RefreshAction = this.Invalidate; _scrollTool = new ScrollTool(_vm, this); _scrollTool.Activate(); _zoomTool = new ZoomTool(_vm, this); _zoomTool.Activate(); MouseHover += (s, a) => _vm.Cursor.Hover(); MouseLeave += (s, a) => vm.Cursor.Leave(); MouseMove += (s, a) => vm.Cursor.Move(ToCursorButtons(a.Button), a.Location); MouseUp += (s, a) => vm.Cursor.Up(ToCursorButtons(a.Button), a.Location); MouseDown += (s, a) => vm.Cursor.Down(ToCursorButtons(a.Button), a.Location); Resize += (s, a) => _vm.Resize(this.ClientSize.Width, this.ClientSize.Height); }