//create a new thread for simulation and call Loop Simulation public void StartSim() { NodeActivator.SimWin = this; CommonCalToken = new CancellationTokenSource(); LoopSimulation loop = new LoopSimulation(); this.WriteOutput("\nTotal Single Edge Flow: " + NodeActivator.SingleEdgeFlow + "\n\n"); this.WriteOutput("Performing Simulation...\n\n"); Task.Factory.StartNew(((LoopSimulation)loop).start, CommonCalToken.Token); }