/// <summary> /// Method called when another scenario element has been selected /// </summary> /// <param name="previousElement">Scenario element that has been deselected</param> /// <param name="selectedElement">Scenario element that has been selected</param> private void OnSelectedOtherElement(ScenarioElement previousElement, ScenarioElement selectedElement) { //Detach from current agent events if (colorExtension != null) { colorExtension.ColorChanged -= SelectedAgentOnColorChanged; } selectedAgent = selectedElement as ScenarioAgent; //Attach to selected agent events if (selectedAgent != null) { colorExtension = selectedAgent.GetExtension <AgentColorExtension>(); if (colorExtension == null) { Hide(); } else { colorExtension.ColorChanged += SelectedAgentOnColorChanged; Show(); } } else { Hide(); } }
/// <summary> /// Constructor /// </summary> /// <param name="agentColor">Scenario agent color extension which color was changed</param> /// <param name="previousColor">Previous color of the given agent</param> public UndoChangeColor(AgentColorExtension agentColor, Color previousColor) { this.agentColor = agentColor; this.previousColor = previousColor; }