/// <summary> /// Assign the current loc to the selected block facing the given side. /// </summary> private void Assign(BlockSide side) { var block = SelectedBlock; if ((loc != null) && (block != null)) { var task = Task <bool> .Factory.StartNew(() => loc.AssignTo(block, side.Invert())); task.ContinueWith(t => { if (t.Result) { UpdateBlocks(); UpdateControls(); } else { var msg = string.Format("Cannot lock block '{0}'", block); MessageBox.Show(msg, Strings.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }, TaskScheduler.FromCurrentSynchronizationContext()); } }
/// <summary> /// Assign the loc to the current block /// </summary> public void Assign() { loc.Direction.Requested = direction; loc.AssignTo(block, currentBlockEnterSide); }