void lbTodoList_SelectionChanged(object sender, SelectionChangedEventArgs e) { currentSelectedMethod = (SimulationAction)e.AddedItems[0]; this.lblmethod.Content = currentSelectedMethod.methodname; this.txtSleeptimer.Text = currentSelectedMethod.sleep.ToString(); this.chkException.IsChecked = currentSelectedMethod.throwException; this.chkUnmanaged.IsChecked = currentSelectedMethod.throwException; this.chkCpu.IsChecked = currentSelectedMethod.consumecpu; this.heaprate.Text = currentSelectedMethod.consumeheapfactor.ToString(); }
public void SetPerformSimulation(SimulationAction action) { ExSetPerformSimulation(action); }
private static extern void ExSetPerformSimulation(SimulationAction action);
/// <summary> /// Switches to the given SimulationAction, or resets the graph /// if it is in a state that cannot run the specified SimulationAction /// </summary> private void SwitchSimulationAction(SimulationAction newAction) { m_SimulationAction = SimulationAction.None; switch (newAction) { case SimulationAction.RunContinuously: m_SimulationAction = newAction; break; case SimulationAction.RunOnce: if (m_GraphState == PathfindingGraphState.Finished) { ResetGraph(); } else { m_SimulationAction = newAction; } break; case SimulationAction.RunOneStep: if (m_GraphState == PathfindingGraphState.Finished) { ResetGraph(); } else { m_SimulationAction = newAction; } break; case SimulationAction.RunProgressive: if (m_GraphState == PathfindingGraphState.Finished) { ResetGraph(); } else { m_SimulationAction = newAction; m_Timer = new Stopwatch(); m_Timer.Start(); } break; } }
/// <summary> /// Rebuilds the graph based on the current GridType /// </summary> private void RebuildGraph() { m_Grid = IndexedPathfindingMapFactory.BuildMap(m_GridType, m_NodeSize, m_Window.Size, StateToColorMap); SimulationAction = SimulationAction.None; ResetGraph(); }
public void Update() { switch (SimulationAction) { case SimulationAction.RunContinuously: if (m_GraphState == PathfindingGraphState.Finished) { ResetGraph(); } FullRunOnce(); break; case SimulationAction.RunOnce: FullRunOnce(); SimulationAction = SimulationAction.None; break; case SimulationAction.RunOneStep: RunOneStep(); SimulationAction = SimulationAction.None; break; case SimulationAction.RunProgressive: if (m_GraphState == PathfindingGraphState.Finished) SimulationAction = SimulationAction.None; else if (m_Timer.ElapsedMilliseconds > (1000f/MovesPerSecond)) { m_Timer.Restart(); RunOneStep(); if (m_GraphState == PathfindingGraphState.Finished) SimulationAction = SimulationAction.None; } break; } }