/// <summary> /// Change items. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Type_SelectionChanged(object sender, EventArgs e) { if (ActiveComponent != null) { ComponentContent.Remove(ActiveComponent); } WidgetTypes type = (WidgetTypes)Type.SelectedItem; switch (type) { case WidgetTypes.SEQUENCE: if (SequenceComponent == null) { SequenceComponent = new SequenceVariable(); } ActiveComponent = SequenceComponent; SequenceComponent.ClearData(); ComponentContent.PackStart(SequenceComponent, true, true); break; case WidgetTypes.VARIABLE: if (VariableComponent == null) { VariableComponent = new VariableVariable(); } ActiveComponent = VariableComponent; VariableComponent.ClearData(); ComponentContent.PackStart(VariableComponent, true, true); break; case WidgetTypes.RAND_INT: if (NumberComponent == null) { NumberComponent = new NumberVariable(); } ActiveComponent = NumberComponent; NumberComponent.ClearData(); ComponentContent.PackStart(NumberComponent, true, true); break; case WidgetTypes.RAND_STRING: if (StringComponent == null) { StringComponent = new StringVariable(); } ActiveComponent = StringComponent; StringComponent.ClearData(); ComponentContent.PackStart(StringComponent, true, true); break; case WidgetTypes.RAND_FLOAT: if (FloatComponent == null) { FloatComponent = new FloatVariable(); } ActiveComponent = FloatComponent; FloatComponent.ClearData(); ComponentContent.PackStart(FloatComponent, true, true); break; default: if (TextVariableComponent == null) { TextVariableComponent = new TextVariable(); } ActiveComponent = TextVariableComponent; TextVariableComponent.ClearData(); ComponentContent.PackStart(TextVariableComponent, true, true); break; } }
/// <summary> /// Change items. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Type_SelectionChanged(object sender, EventArgs e) { if (ActiveComponent != null) ComponentContent.Remove(ActiveComponent); WidgetTypes type = (WidgetTypes)Type.SelectedItem; switch (type) { case WidgetTypes.SEQUENCE: if (SequenceComponent == null) SequenceComponent = new SequenceVariable(); ActiveComponent = SequenceComponent; SequenceComponent.ClearData(); ComponentContent.PackStart(SequenceComponent, true, true); break; case WidgetTypes.VARIABLE: if (VariableComponent == null) VariableComponent = new VariableVariable(); ActiveComponent = VariableComponent; VariableComponent.ClearData(); ComponentContent.PackStart(VariableComponent, true, true); break; case WidgetTypes.RAND_INT: if (NumberComponent == null) NumberComponent = new NumberVariable(); ActiveComponent = NumberComponent; NumberComponent.ClearData(); ComponentContent.PackStart(NumberComponent, true, true); break; case WidgetTypes.RAND_STRING: if (StringComponent == null) StringComponent = new StringVariable(); ActiveComponent = StringComponent; StringComponent.ClearData(); ComponentContent.PackStart(StringComponent, true, true); break; case WidgetTypes.RAND_FLOAT: if (FloatComponent == null) FloatComponent = new FloatVariable(); ActiveComponent = FloatComponent; FloatComponent.ClearData(); ComponentContent.PackStart(FloatComponent, true, true); break; default: if (TextVariableComponent == null) TextVariableComponent = new TextVariable(); ActiveComponent = TextVariableComponent; TextVariableComponent.ClearData(); ComponentContent.PackStart(TextVariableComponent, true, true); break; } }