public void Abc() { var d = new DynamicPropertyClass(); d.Extensions.AllowDynamicProperties(); d.String = "abc"; d.Int = 4; d.Extensions.DynamicProperties["String"].ShouldEqual("abc"); d.Extensions.DynamicProperties["Int"].ShouldEqual(4); }
/// <summary> /// Select the feature /// </summary> private void SelectFeature(IFeature feature) { if (feature == null) { pnlInfo.Visible = true; } else { pnlInfo.Visible = false; lblSelectedOption.Text = $"{feature.Name} Configuration"; if (feature is IEnhancedConfigurationFeature) { if (tcSettings.TabPages.ContainsKey("custom")) { tcSettings.TabPages.RemoveByKey("custom"); } tcSettings.TabPages.Insert(0, "custom", "Properties", 7); tcSettings.TabPages[0].Controls.Add((feature as IEnhancedConfigurationFeature).ConfigurationPanel); } var state = feature.QueryState(ConfigurationContext.Current.Configuration); // Confiugration if (feature.ConfigurationType == typeof(GenericFeatureConfiguration)) { var descriptor = new DynamicPropertyClass(feature.Configuration as GenericFeatureConfiguration); pgConfiguration.SelectedObject = descriptor; } else if (feature.ConfigurationType != null) { if (feature.Configuration == null) { feature.Configuration = ConfigurationContext.Current.Configuration.GetSection(feature.ConfigurationType) ?? Activator.CreateInstance(feature.ConfigurationType); } // Now set the task pgConfiguration.SelectedObject = feature.Configuration; pgConfiguration.Visible = true; } else { pgConfiguration.Visible = false; } lblDescription.Text = $" {feature.Description}"; this.CurrentFeature = feature; // Now detect the necessary bars switch (state) { case FeatureInstallState.Installed: tcSettings.Enabled = true; btnDisable.Visible = lblEnabled.Visible = !feature.Flags.HasFlag(FeatureFlags.NoRemove); lblNoInstall.Visible = lblDisabled.Visible = btnEnable.Visible = false; break; case FeatureInstallState.CantInstall: lblDisabled.Visible = lblEnabled.Visible = btnDisable.Visible = btnEnable.Visible = tcSettings.Enabled = false; lblNoInstall.Visible = true; break; default: lblNoInstall.Visible = tcSettings.Enabled = btnDisable.Visible = lblEnabled.Visible = false; lblDisabled.Visible = btnEnable.Visible = true; break; } } }