void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { Active = e.NewState != MySimulationHandler.SimulationState.STOPPED; if (!Active) { peekLabel.Visible = false; } CloseButton = e.NewState == MySimulationHandler.SimulationState.PAUSED || e.NewState == MySimulationHandler.SimulationState.STOPPED; if (Observer != null) { Observer.Active = Active; } Observer.TriggerViewReset(); glControl.Invalidate(); updateViewToolStripMenuItem.Enabled = snapshotToolStripMenuItem.Enabled = e.NewState == MySimulationHandler.SimulationState.PAUSED; }
private void StateChanged(object sender, MySimulationHandler.StateEventArgs e) { if (e.NewState == MySimulationHandler.SimulationState.STOPPED || e.NewState == MySimulationHandler.SimulationState.PAUSED) { OpenFile(); } m_continueEvent.Set(); }
public override void OnSimulationStateChanged(MySimulationHandler.StateEventArgs args) { PreviousState = args.OldState; CurrentState = args.NewState; if (Event != null) { Event.Set(); } }
private void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { if (e.OldState != MySimulationHandler.SimulationState.STOPPED) { return; } richTextBox_messages.Clear(); FindGuiNodes(); }
void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { nodesToolStrip.Enabled = e.NewState == MySimulationHandler.SimulationState.STOPPED; updateModelButton.Enabled = nodesToolStrip.Enabled; if (e.NewState == MySimulationHandler.SimulationState.STOPPED) { ResetNodeColours(); } }
private void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { if (!Visible && !(m_mainForm.Project.World is SchoolWorld)) { return; } // time measurements if (m_currentLtStopwatch != null) { if (e.NewState == MySimulationHandler.SimulationState.PAUSED) { m_currentLtStopwatch.Stop(); } else if (e.NewState == MySimulationHandler.SimulationState.RUNNING || e.NewState == MySimulationHandler.SimulationState.RUNNING_STEP) { m_currentLtStopwatch.Start(); } } // workspace panel enable/disable if (e.NewState == MySimulationHandler.SimulationState.RUNNING || e.NewState == MySimulationHandler.SimulationState.RUNNING_STEP || e.NewState == MySimulationHandler.SimulationState.PAUSED) { disableLearningTaskPanel(); } else { enableLearningTaskPanel(); } // autosave if (e.NewState == MySimulationHandler.SimulationState.PAUSED || e.NewState == MySimulationHandler.SimulationState.STOPPED) { if (Properties.School.Default.AutosaveEnabled) { if (String.IsNullOrEmpty(m_autosaveFilePath)) { string filename = GetAutosaveFilename(); m_autosaveFilePath = Path.Combine(Properties.School.Default.AutosaveFolder, filename); } ExportDataGridViewData(m_autosaveFilePath); } } if (e.NewState == MySimulationHandler.SimulationState.STOPPED) { m_autosaveFilePath = null; } // buttons UpdateButtons(); }
public override void OnSimulationStateChanged(MySimulationHandler.StateEventArgs args) { // Notify BS that the model has changed -- it will reuse the old model otherwise and won't call inits on CurrentWorld's tasks when run if (args.NewState == MySimulationHandler.SimulationState.STOPPED) { m_shouldShowNewLearningTask = true; LearningTaskFinished(this, new SchoolEventArgs(CurrentLearningTask)); CurrentLearningTask = null; Curriculum.Reset(); } }
void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { MySimulationHandler simulationHandler = sender as MySimulationHandler; runToolButton.Enabled = simulationHandler.CanStart; stepInButton.Enabled = simulationHandler.CanStepInto; stepOutButton.Enabled = simulationHandler.CanStepOut; stepOverButton.Enabled = simulationHandler.CanStepOver; pauseToolButton.Enabled = simulationHandler.CanPause; UpdateDebugListView(); if (e.NewState == MySimulationHandler.SimulationState.PAUSED) { if (simulationHandler.Simulation.InDebugMode) { noDebugLabel.Visible = false; MyExecutionBlock currentBlock = simulationHandler.Simulation.CurrentDebuggedBlock; m_selectedNodeView = null; if (currentBlock != null && currentBlock.CurrentChild != null) { m_selectedNodeView = debugTreeView.AllNodes.FirstOrDefault(node => (node.Tag is MyDebugNode && (node.Tag as MyDebugNode).Executable == currentBlock.CurrentChild)); } ; } debugTreeView.Invalidate(); //debugTreeView.Invoke((MethodInvoker)(() => debugTreeView.SelectedNode = m_selectedNodeView)); } else if (e.NewState == MySimulationHandler.SimulationState.STOPPED) { m_executionPlan = null; debugTreeView.Model = null; noDebugLabel.Visible = true; if (this.IsFloat) { this.Hide(); } } breakpointCheckBox.EditEnabled = simulationHandler.Simulation.InDebugMode; }
public override void OnSimulationStateChanged(MySimulationHandler.StateEventArgs args) { base.OnSimulationStateChanged(args); if (args.NewState == MySimulationHandler.SimulationState.RUNNING || args.NewState == MySimulationHandler.SimulationState.RUNNING_STEP) { InitStream(); } else { // Simulation stopped? => set the flag to false so that we use the selected writing mode when it starts again. if (args.NewState == MySimulationHandler.SimulationState.STOPPED) { m_isAlreadyWriting = false; } CloseStream(); } }
/// <summary> /// This allows the node implementations to react to the simulation's state. /// This is useful for e.g. resource management. /// </summary> public virtual void OnSimulationStateChanged(MySimulationHandler.StateEventArgs args) { }
//TODO: this should be done by data binding but menu items cannot do that (add this support) void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { runToolButton.Enabled = SimulationHandler.CanStart; startToolStripMenuItem.Enabled = SimulationHandler.CanStart; pauseToolButton.Enabled = SimulationHandler.CanPause; pauseToolStripMenuItem.Enabled = SimulationHandler.CanPause; stopToolButton.Enabled = SimulationHandler.CanStop; stopToolStripMenuItem.Enabled = SimulationHandler.CanStop; debugToolButton.Enabled = SimulationHandler.CanStartDebugging; debugToolStripMenuItem.Enabled = SimulationHandler.CanStartDebugging; stepOverToolButton.Enabled = SimulationHandler.CanStepOver; stepOverToolStripMenuItem.Enabled = SimulationHandler.CanStepOver; stepIntoToolStripMenuItem.Enabled = SimulationHandler.CanStepInto; stepOutToolStripMenuItem.Enabled = SimulationHandler.CanStepOut; reloadButton.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; simStatusLabel.Text = SimulationHandler.State.GetAttributeProperty((DescriptionAttribute x) => x.Description); //TODO: this is awful, binding is needed here for sure newProjectToolButton.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; newProjectToolStripMenuItem.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; openProjectToolButton.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; openProjectToolStripMenuItem.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; saveProjectToolButton.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; saveProjectAsToolStripMenuItem.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; saveProjectToolStripMenuItem.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; copySelectionToolStripMenuItem.Enabled = pasteSelectionToolStripMenuItem.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; worldList.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; NodePropertyView.CanEdit = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; updateMemoryBlocksToolStripMenuItem.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED; MemoryBlocksView.Enabled = SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED || SimulationHandler.State == MySimulationHandler.SimulationState.PAUSED; if (SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED) { stepStatusLabel.Text = String.Empty; statusStrip.BackColor = STATUS_BAR_BLUE; exportStateButton.Enabled = MyMemoryBlockSerializer.TempDataExists(Project); clearDataButton.Enabled = exportStateButton.Enabled; } else if (SimulationHandler.State == MySimulationHandler.SimulationState.PAUSED) { statusStrip.BackColor = Color.Chocolate; } else { statusStrip.BackColor = STATUS_BAR_BLUE_BUILDING; } RefreshUndoRedoButtons(); }
public void OnSimulationStateChanged(object sender, MySimulationHandler.StateEventArgs e) { CanEditNodeProperties = e.NewState == MySimulationHandler.SimulationState.STOPPED; }
void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { //UpdateConsole(); }
public override void OnSimulationStateChanged(MySimulationHandler.StateEventArgs args) { m_paused = args.NewState == MySimulationHandler.SimulationState.PAUSED; }
void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { scintilla.Enabled = e.NewState == MySimulationHandler.SimulationState.STOPPED; SetupEditorStyle(); }
void SimulationHandler_StateChanged(object sender, MySimulationHandler.StateEventArgs e) { toolStrip1.Enabled = e.NewState == MySimulationHandler.SimulationState.STOPPED; updateModelButton.Enabled = toolStrip1.Enabled; }