Exemple #1
0
		/// <summary>
		/// Creates an instance of this view model with given parameteres
		/// </summary>
		/// <param name="parent">parent FpcWindowVm instance</param>
		/// <param name="container">(sub)item in fpc state in which this vm desires to go</param>
		/// <param name="containment">toolbox item that contains the data which is being dragged onto the state</param>
		public DropIndicatorVm(FpcWindowVm parent, TreeItemVm container, IToolboxData containment)
			: base(parent)
		{
			Container = container;
			Containment = containment;
			IsDropIndicator = true;
		}
Exemple #2
0
		/// <summary>
		/// Removes the current drop indicator from its container
		/// </summary>
		public void RemoveDropIndicator()
		{
			if (_dropIndicator != null)
			{
				_dropIndicator.Container.ContentsList.Remove(_dropIndicator);
				_dropIndicator = null;
			}
		}
Exemple #3
0
		/// <summary>
		/// Adds or removes the drap indicator object according to the tree item under the mouse
		/// </summary>
		/// <param name="pos_drawingArea">relative location of mouse in drawing area</param>
		public void UpdateDropIndicator(Point pos_drawingArea)
		{
			//find the underlying tree item
			TreeItemVm item = null;
			if (SelectedToolboxItem.ContentData is StationVm)
				item = SelectedToolboxItem.GetUnderlyingStateConfig(pos_drawingArea);
			else if (SelectedToolboxItem.ContentData is ActivityVm)
				item = SelectedToolboxItem.GetUnderlyingStateStation(pos_drawingArea);
			else if (SelectedToolboxItem.ContentData is MachineVm)
				item = SelectedToolboxItem.GetUnderlyingStateStationActivity(pos_drawingArea);

			//remove the indicator if can't drop
			if (item == null)
			{
				SelectedToolboxItem.CanDrop = false;
				RemoveDropIndicator();
			}

			//add an indicator if can drop (transition from can't drop)
			else if (!item.ContentsList.Any(x => x.IsDropIndicator))
			{
				SelectedToolboxItem.CanDrop = true;
				_dropIndicator = new DropIndicatorVm(this, item, SelectedToolboxItem.ContentData);
				item.ContentsList.Add(_dropIndicator);
			}
		}