protected void OnFixtureSettingsButtonReleased(object sender, ButtonReleaseEventArgs args) { var parent = Toplevel as Window; var s = new FixtureSettings(Devices.Lighting.GetGadgetSettings(fixtureName) as LightingFixtureSettings, parent); s.Run(); var newFixtureName = s.fixtureName; var outcome = s.outcome; if ((outcome == TouchSettingsOutcome.Modified) && (newFixtureName != fixtureName)) { var index = combo.comboList.IndexOf(fixtureName); combo.comboList[index] = newFixtureName; fixtureName = newFixtureName; } else if (outcome == TouchSettingsOutcome.Added) { combo.comboList.Insert(combo.comboList.Count - 1, newFixtureName); combo.activeText = newFixtureName; fixtureName = newFixtureName; } else if (outcome == TouchSettingsOutcome.Deleted) { combo.comboList.Remove(fixtureName); fixtureName = Devices.Lighting.defaultGadget; combo.activeText = fixtureName; } combo.QueueDraw(); GetFixtureData(); lightingStateWidget.SetStates(fixtureName); lightingStateWidget.QueueDraw(); }
protected void OnComboChanged(object sender, ComboBoxChangedEventArgs e) { if (e.activeText == "New fixture...") { var parent = Toplevel as Window; var s = new FixtureSettings(new LightingFixtureSettings(), parent); s.Run(); var newFixtureName = s.fixtureName; var outcome = s.outcome; if (outcome == TouchSettingsOutcome.Added) { combo.comboList.Insert(combo.comboList.Count - 1, newFixtureName); combo.activeText = newFixtureName; fixtureName = newFixtureName; } else { combo.activeText = fixtureName; } } else { fixtureName = e.activeText; } GetFixtureData(); lightingStateWidget.SetStates(fixtureName); lightingStateWidget.QueueDraw(); combo.QueueDraw(); }