Ejemplo n.º 1
0
        private void ChangeLoadApplicationControls()
        {
            bool clearDataWhenDisabled = true;
            bool isLoadApplicationToggleButtonEnabled = TargetConnection.IsTargetConnected && RealTimeModelProperties.IsModelLocationLoaded;
            bool isLoadedModelRichTextBoxEnable       = TargetConnection.IsTargetConnected && SimulationState.IsModelLoadedOnTarget;

            MainScreen.ChangeLoadApplicationToggleButtonState(SimulationState.IsModelLoadedOnTarget, isLoadApplicationToggleButtonEnabled);
            MainScreen.ChangeLoadedModelRichTextBoxState(isLoadedModelRichTextBoxEnable, clearDataWhenDisabled);
            MainScreen.ChangeStopTimeRichTextBoxState(isLoadedModelRichTextBoxEnable, clearDataWhenDisabled);
        }
Ejemplo n.º 2
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);
		}