private void HydrateUiFromSettings(string settingsPath) { try { Settings = EarlyBoundGeneratorConfig.Load(settingsPath); Settings.CrmSvcUtilRealtiveRootPath = Paths.PluginsPath; SettingsMap = new SettingsMap(this, Settings) { SettingsPath = settingsPath }; PropertiesGrid.SelectedObject = SettingsMap; SkipSaveSettings = false; } catch (Exception ex) { TxtOutput.AppendText($"Unable to Load Settings from Config file: {settingsPath}. {ex}"); var result = MessageBox.Show(@"The Settings File is either empty or malformed. Would you like to reset the file to the default settings?", @"Unable to Load Settings!", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { Settings = EarlyBoundGeneratorConfig.GetDefault(); Settings.CrmSvcUtilRealtiveRootPath = Paths.PluginsPath; } else { SkipSaveSettings = true; } } }
private void HydrateUiFromSettings(string settingsPath) { try { Settings = EarlyBoundGeneratorConfig.Load(settingsPath); Settings.CrmSvcUtilRealtiveRootPath = Paths.PluginsPath; SkipSaveSettings = false; } catch (Exception ex) { TxtOutput.AppendText($"Unable to Load Settings from Config file: {settingsPath}. {ex}"); var result = MessageBox.Show(@"The Settings File is either empty or malformed. Would you like to reset the file to the default settings?", @"Unable to Load Settings!", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { Settings = EarlyBoundGeneratorConfig.GetDefault(); Settings.CrmSvcUtilRealtiveRootPath = Paths.PluginsPath; } else { SkipSaveSettings = true; } } ChkAddDebuggerNonUserCode.Checked = Settings.ExtensionConfig.AddDebuggerNonUserCode; ChkAddFilesToProject.Checked = Settings.ExtensionConfig.AddNewFilesToProject; ChkAudibleCompletion.Checked = Settings.AudibleCompletionNotification; ChkCreateOneActionFile.Checked = Settings.ExtensionConfig.CreateOneFilePerAction; ChkCreateOneEntityFile.Checked = Settings.ExtensionConfig.CreateOneFilePerEntity; ChkCreateOneOptionSetFile.Checked = Settings.ExtensionConfig.CreateOneFilePerOptionSet; ChkEditableResponseActions.Checked = Settings.ExtensionConfig.MakeResponseActionsEditable; ChkIncludeCommandLine.Checked = Settings.IncludeCommandLine; ChkMakeReadonlyFieldsEditable.Checked = Settings.ExtensionConfig.MakeReadonlyFieldsEditable; ChkMaskPassword.Checked = Settings.MaskPassword; ChkGenerateActionAttributeNameConsts.Checked = Settings.ExtensionConfig.GenerateActionAttributeNameConsts; ChkGenerateAttributeNameConsts.Checked = Settings.ExtensionConfig.GenerateAttributeNameConsts; ChkGenerateAnonymousTypeConstructor.Checked = Settings.ExtensionConfig.GenerateAnonymousTypeConstructor; ChkGenerateEntityRelationships.Checked = Settings.ExtensionConfig.GenerateEntityRelationships; ChkGenerateOptionSetEnums.Checked = Settings.ExtensionConfig.GenerateEnumProperties; ChkRemoveRuntimeComment.Checked = Settings.ExtensionConfig.RemoveRuntimeVersionComment; ChkUseDeprecatedOptionSetNaming.Checked = Settings.ExtensionConfig.UseDeprecatedOptionSetNaming; ChkUseTFS.Checked = Settings.ExtensionConfig.UseTfsToCheckoutFiles; ChkUseXrmClient.Checked = Settings.ExtensionConfig.UseXrmClient; TxtActionPath.Text = Settings.ActionOutPath; TxtEntityPath.Text = Settings.EntityOutPath; TxtInvalidCSharpNamePrefix.Text = Settings.ExtensionConfig.InvalidCSharpNamePrefix; TxtOptionSetFormat.Text = Settings.ExtensionConfig.LocalOptionSetFormat; TxtLanguageCodeOverride.Text = Settings.ExtensionConfig.OptionSetLanguageCodeOverride + ""; TxtNamespace.Text = Settings.Namespace; TxtOptionSetPath.Text = Settings.OptionSetOutPath; TxtServiceContextName.Text = Settings.ServiceContextName; // Hide or show labels based on checked preferences LblActionsDirectory.Visible = ChkCreateOneActionFile.Checked; LblActionPath.Visible = !LblActionsDirectory.Visible; LblEntitiesDirectory.Visible = ChkCreateOneEntityFile.Checked; LblEntityPath.Visible = !LblEntitiesDirectory.Visible; LblOptionSetsDirectory.Visible = ChkCreateOneOptionSetFile.Checked; LblOptionSetPath.Visible = !LblOptionSetsDirectory.Visible; SetAddFilesToProjectVisibility(); }
private void EarlyBoundGenerator_Load(object sender, EventArgs e) { if (ConnectionDetail != null) { DisplayActionsIfSupported(false); } try { Settings = EarlyBoundGeneratorConfig.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); } catch (Exception ex) { TxtOutput.AppendText("Unable to Load Settings form Config: " + ex); SkipSaveSettings = true; Settings = EarlyBoundGeneratorConfig.GetDefault(); } ChkAddDebuggerNonUserCode.Checked = Settings.ExtensionConfig.AddDebuggerNonUserCode; ChkAddFilesToProject.Checked = Settings.ExtensionConfig.AddNewFilesToProject; ChkAudibleCompletion.Checked = Settings.AudibleCompletionNotification; ChkCreateOneActionFile.Checked = Settings.ExtensionConfig.CreateOneFilePerAction; ChkCreateOneEntityFile.Checked = Settings.ExtensionConfig.CreateOneFilePerEntity; ChkCreateOneOptionSetFile.Checked = Settings.ExtensionConfig.CreateOneFilePerOptionSet; ChkIncludeCommandLine.Checked = Settings.IncludeCommandLine; ChkMakeReadonlyFieldsEditable.Checked = Settings.ExtensionConfig.MakeReadonlyFieldsEditable; ChkMaskPassword.Checked = Settings.MaskPassword; ChkGenerateAttributeNameConsts.Checked = Settings.ExtensionConfig.GenerateAttributeNameConsts; ChkGenerateAnonymousTypeConstructor.Checked = Settings.ExtensionConfig.GenerateAnonymousTypeConstructor; ChkGenerateEntityRelationships.Checked = Settings.ExtensionConfig.GenerateEntityRelationships; ChkGenerateOptionSetEnums.Checked = Settings.ExtensionConfig.GenerateEnumProperties; ChkRemoveRuntimeComment.Checked = Settings.ExtensionConfig.RemoveRuntimeVersionComment; ChkUseDeprecatedOptionSetNaming.Checked = Settings.ExtensionConfig.UseDeprecatedOptionSetNaming; ChkUseTFS.Checked = Settings.ExtensionConfig.UseTfsToCheckoutFiles; ChkUseXrmClient.Checked = Settings.ExtensionConfig.UseXrmClient; TxtActionPath.Text = Settings.ActionOutPath; TxtEntityPath.Text = Settings.EntityOutPath; TxtInvalidCSharpNamePrefix.Text = Settings.ExtensionConfig.InvalidCSharpNamePrefix; TxtOptionSetFormat.Text = Settings.ExtensionConfig.LocalOptionSetFormat; TxtNamespace.Text = Settings.Namespace; TxtOptionSetPath.Text = Settings.OptionSetOutPath; TxtServiceContextName.Text = Settings.ServiceContextName; // Hide or show labels based on checked preferences LblActionsDirectory.Visible = ChkCreateOneActionFile.Checked; LblActionPath.Visible = !LblActionsDirectory.Visible; LblEntitiesDirectory.Visible = ChkCreateOneEntityFile.Checked; LblEntityPath.Visible = !LblEntitiesDirectory.Visible; LblOptionSetsDirectory.Visible = ChkCreateOneOptionSetFile.Checked; LblOptionSetPath.Visible = !LblOptionSetsDirectory.Visible; SetAddFilesToProjectVisibility(); }