private void ToggleFeatureLoad(IToggleFeature toggleFeature) { this.Menu.Add(this.Name + "enabled", new CheckBox("啟用")).OnValueChange += (sender, args) => { if (args.NewValue) { toggleFeature.Enable(); } else { toggleFeature.Disable(); } }; if (this[this.Name + "enabled"].Cast <CheckBox>().CurrentValue) { toggleFeature.Enable(); } }
private void ToggleFeatureLoad(IToggleFeature toggleFeature) { this.Menu.Add(this.Name + "enabled", new CheckBox("Enabled")).OnValueChange += (sender, args) => { if (args.NewValue) { toggleFeature.Enable(); } else { toggleFeature.Disable(); } }; if (this[this.Name + "enabled"].Cast<CheckBox>().CurrentValue) { toggleFeature.Enable(); } }