示例#1
0
        public virtual void OnCurrentProbe()
        {
            ProbeState p = (ProbeState)VisualGrid.availableStates[typeof(ProbeState)];

            p.ptype = ProbeType.current;
            VisualGrid.ChangeState(typeof(ProbeState));
        }
示例#2
0
        public virtual void OnVoltageProbe()
        {
            ProbeState p = (ProbeState)VisualGrid.availableStates[typeof(ProbeState)];

            p.ptype = ProbeType.voltage;
            VisualGrid.ChangeState(typeof(ProbeState));
        }
示例#3
0
 public override void OnKeyBoardEvent(KeyEventArgs e)
 {
     base.OnKeyBoardEvent(e);
     if (e.Key == Key.Escape)
     {
         VisualGrid.ChangeState(typeof(SelectionState));
     }
 }
示例#4
0
        public override void OnMouseClick(MouseEventArgs e)
        {
            //when clicked, it searches for object.
            //and yes currently just for objects
            int px           = posX / 50;
            int py           = posY / 50;
            int selectionKey = py * SystemGrid.GridSize + px;

            if (SystemGrid.ComponentGrid.ContainsKey(selectionKey))
            {
                SelectedComponent = SystemGrid.ComponentGrid[selectionKey];
                Console.WriteLine("Selected component" + SelectedComponent.Name);
                VisualGrid.RequestSelectionChange(SelectedComponent);
            }
        }
示例#5
0
 public override void OnKeyBoardEvent(KeyEventArgs e)
 {
     base.OnKeyBoardEvent(e);
     if (e.Key == Key.Escape)
     {
         VisualGrid.ChangeState(typeof(SelectionState));
     }
     if (e.Key == Key.R)
     {
         if (tempR != null)
         {
             rotation += 90;
             rotation  = rotation > 270 ? 0 : rotation;
             tempR.RenderTransform = new RotateTransform(rotation, 50, 50);
         }
     }
 }
示例#6
0
        public override void OnKeyBoardEvent(KeyEventArgs e)
        {
            base.OnKeyBoardEvent(e);
            if (e.Key == Key.W)
            {
                VisualGrid.ChangeState(typeof(WireState));
            }

            else if (e.Key == Key.P)
            {
                VisualGrid.ChangeState(typeof(ComponentState));
            }

            else if (e.Key == Key.Delete || e.Key == Key.Back)
            {
                ComponentManager.DeleteComponent(posX, posY, SelectedComponent);
                SelectedComponent = null;
            }
        }
示例#7
0
        public override void OnKeyBoardEvent(KeyEventArgs e)
        {
            base.OnKeyBoardEvent(e);
            if (e.Key == Key.Escape)
            {
                //means we were drawing and now want to quit
                if (started)
                {
                    started = false;
                    currentCanvas.Children.RemoveAt(tempLineIndex);
                    tempLine = null;
                }

                //if not, then we want to switch to selection mode
                else
                {
                    VisualGrid.ChangeState(typeof(SelectionState));
                }
            }
        }