Esempio n. 1
0
        public void Clear()
        {
            List <UndoRedoAction> foo = new List <UndoRedoAction>(); //the undoPipe here has no meaning, we don't need any undo info anyway

            if (currAddedObj != null)
            {
                currAddedObj.RemoveItem(ref foo);
                currAddedObj = null;
            }
            if (state == MouseState.Ropes || state == MouseState.Tooltip)
            {
                object[] keys = new object[BoundItems.Keys.Count];
                BoundItems.Keys.CopyTo(keys, 0);
                if (state == MouseState.Ropes)
                {
                    ((RopeAnchor)keys[0]).RemoveItem(ref foo);
                }
                else
                {
                    ((ToolTipDot)keys[0]).ParentTooltip.RemoveItem(ref foo);
                }
            }
            else if (state == MouseState.Footholds && connectedLines.Count > 0)
            {
                FootholdLine fh = (FootholdLine)connectedLines[0];
                fh.Remove(false, ref foo);
                Board.BoardItems.FootholdLines.Remove(fh);
            }
            InputHandler.ClearBoundItems(Board);
            InputHandler.ClearSelectedItems(Board);
            IsDown = false;
        }
 void MultiBoard_OnEditInstanceClicked(BoardItem item)
 {
     InputHandler.ClearBoundItems(multiBoard.SelectedBoard);
     try
     {
         if (item is ObjectInstance)
         {
             new ObjectInstanceEditor((ObjectInstance)item).ShowDialog();
         }
         else if (item is TileInstance)
         {
             new TileInstanceEditor((TileInstance)item).ShowDialog();
         }
         else if (item is Chair)
         {
             new GeneralInstanceEditor(item).ShowDialog();
         }
         else if (item is FootholdAnchor)
         {
             FootholdLine[] selectedFootholds = FootholdLine.GetSelectedFootholds(item.Board);
             if (selectedFootholds.Length > 0)
             {
                 new FootholdEditor(selectedFootholds).ShowDialog();
             }
             else
             {
                 new GeneralInstanceEditor(item).ShowDialog();
             }
         }
         else if (item is RopeAnchor ropeItem)
         {
             new RopeInstanceEditor(ropeItem).ShowDialog();
         }
         else if (item is LifeInstance lifeItem)
         {
             new LifeInstanceEditor(lifeItem).ShowDialog();
         }
         else if (item is ReactorInstance reactorItem)
         {
             new ReactorInstanceEditor(reactorItem).ShowDialog();
         }
         else if (item is BackgroundInstance backgroundItem)
         {
             new BackgroundInstanceEditor(backgroundItem).ShowDialog();
         }
         else if (item is PortalInstance portal)
         {
             new PortalInstanceEditor(portal).ShowDialog();
         }
         else if (item is ToolTipInstance tooltipItem)
         {
             new TooltipInstanceEditor(tooltipItem).ShowDialog();
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(string.Format("An error occurred while presenting the instance editor for {0}:\r\n{1}", item.GetType().Name, e.ToString()));
     }
 }