public StatementSlot(string name, Fitter fitter) { InitializeComponent(); thin = (Thickness)Resources["thin"]; thick = (Thickness)Resources["thick"]; slotName = name; moveableFitter = fitter; slotBorder.Width = ObjectBlock.DefaultSize.Width + slotBorder.BorderThickness.Left + slotBorder.BorderThickness.Right; slotBorder.Height = ObjectBlock.DefaultSize.Height + slotBorder.BorderThickness.Top + slotBorder.BorderThickness.Bottom; PreviewDrop += new DragEventHandler(DroppedOnSlotPanel); DragEnter += delegate(object sender, DragEventArgs e) { if (!e.Handled) { ObjectBlock block = e.Data.GetData(typeof(Moveable)) as ObjectBlock; if (block != null && block != Attached && Fits(block)) { SetToCanDropAppearance(); } } }; DragLeave += delegate(object sender, DragEventArgs e) { SetToStandardAppearance(); }; }
public void Add(ObjectBlock block) { if (block == null) { throw new ArgumentNullException("block"); } objectblock++; // could replace by discriminating between object block types }
/// <summary> /// Gets whether a given Moveable is an ObjectBlock. /// </summary> /// <param name="moveable">The Moveable to check.</param> /// <returns>True if the Moveable is an ObjectBlock; false otherwise.</returns> public static bool IsObjectBlock(Moveable moveable) { ObjectBlock objectBlock = moveable as ObjectBlock; return objectBlock != null; }
public abstract void AssignImage(ObjectBlock block);