public virtual void OnCurrentProbe() { ProbeState p = (ProbeState)VisualGrid.availableStates[typeof(ProbeState)]; p.ptype = ProbeType.current; VisualGrid.ChangeState(typeof(ProbeState)); }
public virtual void OnVoltageProbe() { ProbeState p = (ProbeState)VisualGrid.availableStates[typeof(ProbeState)]; p.ptype = ProbeType.voltage; VisualGrid.ChangeState(typeof(ProbeState)); }
public override void OnKeyBoardEvent(KeyEventArgs e) { base.OnKeyBoardEvent(e); if (e.Key == Key.Escape) { VisualGrid.ChangeState(typeof(SelectionState)); } }
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); } }
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); } } }
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; } }
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)); } } }