Пример #1
0
		public BaseDesignerCanvas(BasePlanDesignerViewModel planDesignerViewModel)
			: base(ServiceFactoryBase.Events)
		{
			GridLineController = new GridLineController(this);
			RemoveGridLinesCommand = new RelayCommand(OnRemoveGridLinesCommand);
			PlanDesignerViewModel = planDesignerViewModel;
			Toolbox = new ToolboxViewModel(this);
			ServiceFactoryBase.DragDropService.DragOver += OnDragServiceDragOver;
			ServiceFactoryBase.DragDropService.Drop += OnDragServiceDrop;
			ServiceFactoryBase.DragDropService.DragCorrection += OnDragServiceCorrection;
			PainterCache.Initialize(ServiceFactoryBase.ContentService.GetBitmapContent, ServiceFactoryBase.ContentService.GetDrawing, ServiceFactoryBase.ContentService.GetVisual);
			Width = 100;
			Height = 100;
			Focusable = false;
			DesignerSurface.AllowDrop = true;

			var menuItem = DesignerCanvasHelper.BuildMenuItem(
				"Вставить (Ctrl+V)",
				"BPaste",
				PlanDesignerViewModel.PasteCommand
			);
			menuItem.CommandParameter = this;
			var pasteItem = menuItem;

			ContextMenu = new ContextMenu();
			ContextMenu.HasDropShadow = false;
			ContextMenu.Items.Add(pasteItem);
			_moveAdorner = new MoveAdorner(this);
		}
Пример #2
0
		public InstrumentGroupViewModel(ToolboxViewModel toolbox, int index)
		{
			_lock = false;
			_toolbox = toolbox;
			Index = index;
			IsActive = false;
			Instruments = new ObservableCollection<IInstrument>();
			Instruments.CollectionChanged += Instruments_CollectionChanged;
		}