Exemple #1
0
		private void HandleTargetConnectionStateChanged(object sender, TargetConnectionStateChangedEventArgs args)
		{
			if (TargetConnection.IsTargetConnected == false)
			{
				RealTimeMonitor.ApplicationState.ResetApplicationState();
				SimulationState.ResetSimulationProperties();
				RealTimeMonitor.StopPropertyUpdatesTimer();
			}

			bool isSimulationStartToggleButtonEnabled = TargetConnection.IsTargetConnected && SimulationState.IsModelLoadedOnTarget;
			MainScreen.ChangeSimulationStartToggleButtonState(!SimulationState.IsSimulationRunning, isSimulationStartToggleButtonEnabled);
			MainScreen.ChangeRebootButtonState(TargetConnection.IsTargetConnected);
		}
Exemple #2
0
		private void HandleStartSimulationToggleButtonClicked(object sender, MouseEventArgs args)
		{
			if(SimulationState.IsSimulationRunning) { SimulationState.StopTargetApplication(); }
			else
			{
				SimulationState.StartTargetApplication();
				RealTimeMonitor.StartPropertyUpdatesTimer();
			}

			bool isSimulationStartToggleButtonEnabled = TargetConnection.IsTargetConnected && SimulationState.IsModelLoadedOnTarget;
			MainScreen.ChangeSimulationStartToggleButtonState(!SimulationState.IsSimulationRunning, isSimulationStartToggleButtonEnabled);

			// Update this at the start of every simulation in case the user removed it
			MainScreen.UpdateStopTimeValue(SimulationState.StopTime);
		}
Exemple #3
0
		private void HandleLoadModelToggleButtonClicked(object sender, MouseEventArgs args)
		{
			if (SimulationState.IsModelLoadedOnTarget)
			{
				// If the model is already loaded, unload the model and clear the corresponding application data
				SimulationState.UnloadRealTimeModel(TargetConnection);
				RealTimeMonitor.ApplicationState.ResetApplicationState();
				RealTimeMonitor.StopPropertyUpdatesTimer();
			}
			else
			{
				// Otherwise, load the model and create a new application state
				SimulationState.LoadRealTimeModel(TargetConnection, RealTimeModelProperties.RealTimeModelFilePath);
				RealTimeMonitor.ApplicationState = new LoadedApplicationState(SimulationState.LoadedApplication);
			}

			bool clearDataWhenDisabled = true;
			bool isLoadApplicationToggleButtonEnabled = TargetConnection.IsTargetConnected && RealTimeModelProperties.IsModelLocationLoaded;
			bool isApplicationControlsEnabled = TargetConnection.IsTargetConnected && SimulationState.IsModelLoadedOnTarget;
			MainScreen.ChangeLoadApplicationToggleButtonState(SimulationState.IsModelLoadedOnTarget, isLoadApplicationToggleButtonEnabled);
			MainScreen.ChangeLoadedModelRichTextBoxState(isApplicationControlsEnabled, clearDataWhenDisabled);
			MainScreen.ChangeStopTimeRichTextBoxState(isApplicationControlsEnabled, clearDataWhenDisabled);
			MainScreen.ChangeSimulationStartToggleButtonState(!SimulationState.IsSimulationRunning, isApplicationControlsEnabled);
		}