/// <summary> /// will be called before the config menu is being displayed /// </summary> /// <param name="sender">command that was called</param> /// <param name="e">events</param> private void OnBeforeQueryStatusConfig(object sender, EventArgs e) { OleMenuCommand command = (OleMenuCommand)sender; if (command == null) { return; } command.Enabled = false; Project activeProject = GetActiveProject(); if (activeProject == null) { return; } Xml.Settings.Project.Options projectOptions = GetProjectOptions(activeProject); if (projectOptions == null) { return; } command.Enabled = projectOptions.GeneralOptions.Storage == Definitions.Enumerations.SettingsStorage.Project; }
/// <summary> /// ensures that all supported nuspec usages are present /// </summary> /// <returns>true if at least one nuspec usage for a supported project was missing, false otherwise</returns> private bool PrepareSupportedProjectInformation() { bool needsSave = false; //-----make sure the known projects are always present foreach (ProjectInformation project in SupportedProjectInformation) { Xml.Settings.Project.Options projectOptions = _configuration.ProjectOptions.Find(n => n.Identifier == project.Identifier); if (projectOptions == null) { projectOptions = new Xml.Settings.Project.Options() { Identifier = project.Identifier }; _configuration.ProjectOptions.Add(projectOptions); needsSave = true; } else if (string.IsNullOrEmpty(projectOptions.GeneralOptions.AssemblyInfoVersionInformationalSeparator)) { projectOptions.GeneralOptions.AssemblyInfoVersionInformationalSeparator = VersionUtil.VersionInformationalSeparator; needsSave = true; } } ; return(needsSave); }
/// <summary> /// /// </summary> /// <param name="activeProject"></param> /// <param name="identifier"></param> /// <param name="showDialog"></param> /// <param name="userChoice"></param> /// <param name="hadConfig"></param> /// <param name="filepath"></param> /// <returns></returns> public Xml.Settings.Project.Options DetermineProjectConfiguration(Project activeProject, Enumerations.ProjectIdentifier identifier, out string filepath, bool returnClone) { filepath = null; //-----get the user project settings and check if they are set to Xml.Settings.Project.Options projectOptions = Configuration.ProjectOptions.First(x => x.Identifier == identifier); if (projectOptions.GeneralOptions.Storage == Enumerations.SettingsStorage.Project) { string configName = Resources.ProjectConfigurationFilename; if (!string.IsNullOrEmpty(projectOptions.GeneralOptions.Filename)) { configName = projectOptions.GeneralOptions.Filename; if (string.IsNullOrEmpty(Path.GetExtension(configName))) { configName = string.Format("{0}.config", configName); } } LoggingManager.Instance.Logger.Debug(string.Format("configuration filename is: {0}", configName)); ProjectItem config = ExtensionUtil.GetItem(configName, activeProject.ProjectItems); if (config == null) { LoggingManager.Instance.Logger.Debug("configuration file not found, using existing configuration"); filepath = Path.Combine(Path.GetDirectoryName(activeProject.FullName), configName); XmlUtil.Serialize(filepath, Configuration.ProjectOptions.First(x => x.Identifier == identifier)); activeProject.ProjectItems.AddFromFile(filepath); activeProject.Save(); } else { filepath = ExtensionUtil.GetPropertyValue <string>(config.Properties, Resources.PropertyFullpath, null); } return(XmlUtil.Deserialize <Xml.Settings.Project.Options>(filepath)); } else { Xml.Settings.Project.Options original = Configuration.ProjectOptions.First(x => x.Identifier == identifier); if (original != null) { if (returnClone) { return(original.Clone()); } else { return(original); } } return(null); } }
/// <summary> /// prepares the project and stores all the needed information in local variables /// </summary> /// <param name="activeProject">project that is supposed to be deployed, must not be null</param> /// <returns>null if the preparation was successfull, otherwise the error string</returns> private void PreAnalyseProject(Project activeProject, out PackageInformation packageInfo, out ProjectInformation projectInformation) { LoggingManager.Instance.Logger.Debug("prepare project started"); if (activeProject == null) { throw new ArgumentNullException("activeProject", "given project must not be null"); } //-----assign incoming values packageInfo = null; projectInformation = null; //-----make sure the project is supported projectInformation = OptionsManager.Instance.SupportedProjectInformation.FirstOrDefault(p => activeProject.FullName.EndsWith(p.Extension)); if (projectInformation == null) { throw new ProjectNoSupportedException("project not supported"); } //-----make sure the project is not being deployed already try { if (Mutex.OpenExisting(activeProject.FullName.GetHashCode().ToString()) != null) { throw new ProjectIsBeingDeployedException("project is already being deployed"); } } catch (WaitHandleCannotBeOpenedException) { LoggingManager.Instance.Logger.Debug(string.Format("project {0} is currently not being deployed", activeProject.FullName)); } //-----get the project options, which will either be used or project based string configFullName; Enumerations.ProjectIdentifier identifier = projectInformation.Identifier; Xml.Settings.Project.Options projectOptions = OptionsManager.Instance.DetermineProjectConfiguration(activeProject, identifier, out configFullName, true); //-----create the deployment info packageInfo = new PackageInformation() { ProjectOptions = projectOptions, NuSpecPackage = new Xml.NuGet.NuSpec.Package() { Metadata = new Xml.NuGet.NuSpec.Metadata() }, Build = new BuildOptions(), ProjectFullName = activeProject.FullName, }; LoggingManager.Instance.Logger.Debug("prepare project finished"); }
private void SetInfo(Xml.Settings.Project.Options projectOptions) { _warningImage = SystemIcons.Warning.ToBitmap(); _infoImage = SystemIcons.Information.ToBitmap(); //-----NuSpec Metadata First _uiNuSpecMetadataIdInfo.Image = _infoImage; _uiNuSpecMetadataIdInfo.TOp if (projectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Use) { } }
/// <summary> /// tries to determine the project configuration orm the given project /// </summary> /// <param name="activeProject">project to be used</param> /// <param name="userChoice">the choice the user made when asked to set the configuration to project based</param> /// <returns>null if the configuration file was found, otherwise an error message</returns> private void PrepareProjectOptions(Project activeProject, ProjectInformation project) { LoggingManager.Instance.Logger.Debug("prepare project configruation started"); //-----check if the project should have a configuration _projectOption = OptionsManager.Instance.DetermineProjectConfiguration(activeProject, project.Identifier, out _configurationFullName, false); if (_projectOption == null) { string errorMessage = string.Format("Could not deserialize the project configuration file: {0}", _configurationFullName); LoggingManager.Instance.Logger.Error(errorMessage); MessageBox.Show(errorMessage); return; } Text = string.Format("Configuration for {0} Projects", project.Identifier); LoggingManager.Instance.Logger.Debug("prepare project configuration finished"); }
/// <summary> /// called when the project identifier is changed /// </summary> /// <param name="sender">combox of the project identifier</param> /// <param name="e">change event</param> private void OnChangeIdentifier(object sender, EventArgs e) { if (!_blockEvents) { _selectedProjectOptions = (Xml.Settings.Project.Options)_uiProjectIdentifiers.SelectedItem; _blockEvents = true; if (_selectedProjectOptions != null) { //-----optimize _uiOptimizeUseage.SelectedItem = Definitions.Constants.UseageNames[_selectedProjectOptions.MsBuildOptions.Usage.Optimize.Useage]; _uiOptimizeValue.Enabled = _selectedProjectOptions.MsBuildOptions.Usage.Optimize.Useage == Enumerations.Useage.Setting; _uiOptimizeValue.Checked = _selectedProjectOptions.MsBuildOptions.Usage.Optimize.Value; //-----debug constants _uiDebugConstantsUseage.SelectedItem = Definitions.Constants.UseageNames[_selectedProjectOptions.MsBuildOptions.Usage.DebugConstants.Useage]; _uiDebugConstantsValue.Enabled = _selectedProjectOptions.MsBuildOptions.Usage.DebugConstants.Useage == Enumerations.Useage.Setting; _uiDebugConstantsValue.Text = _selectedProjectOptions.MsBuildOptions.Usage.DebugConstants.Value; //-----debug info _uiDebugInfoUseage.SelectedItem = Definitions.Constants.UseageNames[_selectedProjectOptions.MsBuildOptions.Usage.DebugInfo.Useage]; _uiDebugInfoValue.Enabled = _selectedProjectOptions.MsBuildOptions.Usage.DebugInfo.Useage == Enumerations.Useage.Setting; _uiDebugInfoValue.SelectedItem = _selectedProjectOptions.MsBuildOptions.Usage.DebugInfo.Value; _imageDebugInfo.Visible = _selectedProjectOptions.NuGetOptions.NuSpecOptions.Files.UseFromSettings && _selectedProjectOptions.MsBuildOptions.Usage.DebugInfo.Useage != Enumerations.Useage.None; } else { //-----optimize _uiOptimizeUseage.SelectedItem = null; _uiOptimizeValue.Enabled = false; _uiOptimizeValue.Checked = false; //-----debug constants _uiDebugConstantsUseage.SelectedItem = null; _uiDebugConstantsValue.Enabled = false; _uiDebugConstantsValue.Text = null; //-----debug info _uiDebugInfoUseage.SelectedItem = null; _uiDebugInfoValue.Enabled = false; _uiDebugInfoValue.SelectedItem = null; _imageDebugInfo.Visible = false; } _blockEvents = false; } }
private void OnChange(object sender, EventArgs e) { if (!_blockEvents) { if (sender == _uiProjectIdentifiers) { _selectedProjectOption = (Xml.Settings.Project.Options)_uiProjectIdentifiers.SelectedItem; _blockEvents = true; if (_selectedProjectOption != null) { _uiDependencyUsage.SelectedItem = _dependencyUsageNames[_selectedProjectOption.NuGetOptions.GeneralOptions.DependencyUsage]; _uiDependencyUsage.Enabled = true; _uiHasTargetSpecificDependencyGroups.Checked = _selectedProjectOption.NuGetOptions.GeneralOptions.WillCreateTargetSpecificDependencyGroups; _uiHasTargetSpecificDependencyGroups.Enabled = true; } else { _uiDependencyUsage.SelectedItem = null; _uiDependencyUsage.Enabled = false; _uiHasTargetSpecificDependencyGroups.Checked = false; _uiHasTargetSpecificDependencyGroups.Enabled = false; } _blockEvents = false; } else if ((sender == _uiDependencyUsage) && _selectedProjectOption != null) { _selectedProjectOption.NuGetOptions.GeneralOptions.DependencyUsage = _dependencyUsageNames.First(x => x.Value == (string)_uiDependencyUsage.SelectedItem).Key; } else if ((sender == _uiHasTargetSpecificDependencyGroups) && _selectedProjectOption != null) { _selectedProjectOption.NuGetOptions.GeneralOptions.WillCreateTargetSpecificDependencyGroups = _uiHasTargetSpecificDependencyGroups.Checked; } } }
/// <summary> /// calles when one of the ui elements has changed /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event that was send</param> private void OnChange(object sender, EventArgs e) { if (!_blockEvents) { if (sender == _uiProjectIdentifiers) { _selectedProjectOptions = (Xml.Settings.Project.Options)_uiProjectIdentifiers.SelectedItem; _uiUseFromExistingNuSpec.Checked = _selectedProjectOptions != null ? _selectedProjectOptions.NuGetOptions.NuSpecOptions.Files.UseFromSettings : false; SetCheckboxImage(_uiUseFromExistingNuSpec); _uiCurrentType.DataSource = null; _uiFiles.DataSource = null; _project = null; if (_selectedProjectOptions != null) { _project = OptionsManager.Instance.SupportedProjectInformation.FirstOrDefault(x => x.Identifier == _selectedProjectOptions.Identifier); _uiCurrentType.DataSource = _project.ValidItemTypes; GuiUtil.SetItem(_selectedProjectOptions.NuGetOptions.NuSpecOptions.Files.FileIncludes, _uiFiles); } else { _uiFiles.DataSource = null; _uiCurrentType.DataSource = null; _project = null; } } else if (sender == _uiUseFromExistingNuSpec && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Files.UseFromSettings = _uiUseFromExistingNuSpec.Checked; _uiFilesSettings.Enabled = !_uiUseFromExistingNuSpec.Checked; SetCheckboxImage(_uiUseFromExistingNuSpec); } else if (sender == _uiFiles) { _selectedFile = (FileInclude)_uiFiles.SelectedItem; _blockEvents = true; if (_selectedFile != null) { _uiCurrentType.SelectedItem = _selectedFile.Type; _uiCurrentType.Enabled = true; _uiCurrentFolder.Text = _selectedFile.Folder; _uiCurrentFolder.Enabled = true; _uiCurrentName.Text = _selectedFile.Name; _uiCurrentName.Enabled = true; _uiCurrentTarget.Text = _selectedFile.Target; _uiCurrentTarget.Enabled = true; _uiCurrentInclude.Checked = _selectedFile.Include; _uiCurrentInclude.Enabled = true; _uiRemove.Enabled = true; } else { _uiCurrentType.SelectedItem = null; _uiCurrentType.Enabled = false; _uiCurrentFolder.Text = null; _uiCurrentFolder.Enabled = false; _uiCurrentName.Text = null; _uiCurrentName.Enabled = false; _uiCurrentTarget.Text = null; _uiCurrentTarget.Enabled = false; _uiCurrentInclude.Checked = false; _uiCurrentInclude.Enabled = false; _uiRemove.Enabled = false; } _blockEvents = false; _uiApplyChanges.Enabled = false; } else if ((sender == _uiCurrentType || sender == _uiCurrentFolder || sender == _uiCurrentName || sender == _uiCurrentTarget || sender == _uiCurrentInclude) && _selectedFile != null) { _uiApplyChanges.Enabled = _selectedFile.Type != (string)_uiCurrentType.SelectedItem || _selectedFile.Folder != _uiCurrentFolder.Text || _selectedFile.Name != _uiCurrentName.Text || _selectedFile.Target != _uiCurrentTarget.Text || _selectedFile.Include != _uiCurrentInclude.Checked; } } }
private void OnChange(object sender, EventArgs e) { if (!_blockEvents) { if (sender == _uiProjectIdentifiers) { _selectedProjectOptions = (Xml.Settings.Project.Options)_uiProjectIdentifiers.SelectedItem; _blockEvents = true; if (_selectedProjectOptions != null) { GetCheckedAndSetCheckbox(_uiUseId, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Use); GetCheckedAndSetCheckbox(_uiSaveId, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Save); GetCheckedAndSetCheckbox(_uiUseVersion, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Version.Use); GetCheckedAndSetCheckbox(_uiSaveVersion, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Version.Save); GetCheckedAndSetCheckbox(_uiUseTitle, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Title.Use); GetCheckedAndSetCheckbox(_uiSaveTitle, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Title.Save); GetCheckedAndSetCheckbox(_uiUseAuthors, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Authors.Use); GetCheckedAndSetCheckbox(_uiSaveAuthors, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Authors.Save); GetCheckedAndSetCheckbox(_uiUseOwners, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Owners); GetCheckedAndSetCheckbox(_uiUseDescription, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Description.Use); GetCheckedAndSetCheckbox(_uiSaveDescription, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Description.Save); GetCheckedAndSetCheckbox(_uiUseReleaseNotes, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.ReleaseNotes); GetCheckedAndSetCheckbox(_uiUseSummary, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Summary); GetCheckedAndSetCheckbox(_uiUseLanguage, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Language.Use); GetCheckedAndSetCheckbox(_uiSaveLanguage, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Language.Save); GetCheckedAndSetCheckbox(_uiUseProjectUrl, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.ProjectUrl); GetCheckedAndSetCheckbox(_uiUseIconUrl, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.IconUrl); GetCheckedAndSetCheckbox(_uiUseLicenseUrl, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.LicenseUrl); GetCheckedAndSetCheckbox(_uiUseCopyright, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Copyright.Use); GetCheckedAndSetCheckbox(_uiSaveCopyright, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Copyright.Save); GetCheckedAndSetCheckbox(_uiUseTags, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Tags); GetCheckedAndSetCheckbox(_uiUseRequireLicenseAcceptance, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.RequireLicenseAcceptance); GetCheckedAndSetCheckbox(_uiUseDevelopmentDependency, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.DevelopmentDependency); GetCheckedAndSetCheckbox(_uiUseDependencies, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Dependencies); } else { GetCheckedAndSetCheckbox(_uiUseId, false, false); GetCheckedAndSetCheckbox(_uiSaveId, true, false); GetCheckedAndSetCheckbox(_uiUseVersion, false, false); GetCheckedAndSetCheckbox(_uiSaveVersion, true, false); GetCheckedAndSetCheckbox(_uiUseTitle, false, false); GetCheckedAndSetCheckbox(_uiSaveTitle, true, false); GetCheckedAndSetCheckbox(_uiUseAuthors, false, false); GetCheckedAndSetCheckbox(_uiSaveAuthors, true, false); GetCheckedAndSetCheckbox(_uiUseOwners, false, false); GetCheckedAndSetCheckbox(_uiUseDescription, false, false); GetCheckedAndSetCheckbox(_uiSaveDescription, true, false); GetCheckedAndSetCheckbox(_uiUseReleaseNotes, false, false); GetCheckedAndSetCheckbox(_uiUseSummary, false, false); GetCheckedAndSetCheckbox(_uiUseLanguage, false, false); GetCheckedAndSetCheckbox(_uiSaveLanguage, true, false); GetCheckedAndSetCheckbox(_uiUseProjectUrl, false, false); GetCheckedAndSetCheckbox(_uiUseIconUrl, false, false); GetCheckedAndSetCheckbox(_uiUseLicenseUrl, false, false); GetCheckedAndSetCheckbox(_uiUseCopyright, false, false); GetCheckedAndSetCheckbox(_uiSaveCopyright, true, false); GetCheckedAndSetCheckbox(_uiUseTags, false, false); GetCheckedAndSetCheckbox(_uiUseRequireLicenseAcceptance, false, false); GetCheckedAndSetCheckbox(_uiUseDevelopmentDependency, false, false); GetCheckedAndSetCheckbox(_uiUseDependencies, false, false); } _blockEvents = false; } else if (sender == _uiUseId && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Use = GetCheckedAndSetCheckbox(_uiUseId, false); else if (sender == _uiSaveId && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Save = GetCheckedAndSetCheckbox(_uiSaveId, true); else if (sender == _uiUseVersion && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Version.Use = GetCheckedAndSetCheckbox(_uiUseVersion, false); else if (sender == _uiSaveVersion && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Version.Save = GetCheckedAndSetCheckbox(_uiSaveVersion, true); else if (sender == _uiUseTitle && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Title.Use = GetCheckedAndSetCheckbox(_uiUseTitle, false); else if (sender == _uiSaveTitle && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Title.Save = GetCheckedAndSetCheckbox(_uiSaveTitle, true); else if (sender == _uiUseAuthors && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Authors.Use = GetCheckedAndSetCheckbox(_uiUseAuthors, false); else if (sender == _uiSaveAuthors && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Authors.Save = GetCheckedAndSetCheckbox(_uiSaveAuthors, true); else if (sender == _uiUseOwners && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Owners = GetCheckedAndSetCheckbox(_uiUseOwners, false); else if (sender == _uiUseDescription && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Description.Use = GetCheckedAndSetCheckbox(_uiUseDescription, false); else if (sender == _uiSaveDescription && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Description.Save = GetCheckedAndSetCheckbox(_uiSaveDescription, true); else if (sender == _uiUseReleaseNotes && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.ReleaseNotes = GetCheckedAndSetCheckbox(_uiUseReleaseNotes, false); else if (sender == _uiUseSummary && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Summary = GetCheckedAndSetCheckbox(_uiUseSummary, false); else if (sender == _uiUseLanguage && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Language.Use = GetCheckedAndSetCheckbox(_uiUseLanguage, false); else if (sender == _uiSaveLanguage && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Language.Save = GetCheckedAndSetCheckbox(_uiSaveLanguage, true); else if (sender == _uiUseProjectUrl && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.ProjectUrl = GetCheckedAndSetCheckbox(_uiUseProjectUrl, false); else if (sender == _uiUseIconUrl && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.IconUrl = GetCheckedAndSetCheckbox(_uiUseIconUrl, false); else if (sender == _uiUseLicenseUrl && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.LicenseUrl = GetCheckedAndSetCheckbox(_uiUseLicenseUrl, false); else if (sender == _uiUseCopyright && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Copyright.Use = GetCheckedAndSetCheckbox(_uiUseCopyright, false); else if (sender == _uiSaveCopyright && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Copyright.Save = GetCheckedAndSetCheckbox(_uiSaveCopyright, true); else if (sender == _uiUseTags && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Tags = GetCheckedAndSetCheckbox(_uiUseTags, false); else if (sender == _uiUseRequireLicenseAcceptance && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.RequireLicenseAcceptance = GetCheckedAndSetCheckbox(_uiUseRequireLicenseAcceptance, false); else if (sender == _uiUseDevelopmentDependency && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.DevelopmentDependency = GetCheckedAndSetCheckbox(_uiUseDevelopmentDependency, false); else if (sender == _uiUseDependencies && _selectedProjectOptions != null) _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Dependencies = GetCheckedAndSetCheckbox(_uiUseDependencies, false); } }
private void OnChange(object sender, EventArgs e) { if (!_blockEvents) { if (sender == _uiProjectIdentifiers) { _selectedProjectOption = (Xml.Settings.Project.Options)_uiProjectIdentifiers.SelectedItem; _blockEvents = true; if (_selectedProjectOption != null) { _uiStorage.SelectedItem = _storageNames[_selectedProjectOption.GeneralOptions.Storage]; _uiStorage.Enabled = true && _wasCreatedFromOptions; _uiFilename.Text = _selectedProjectOption.GeneralOptions.Filename; _uiFilename.Enabled = _selectedProjectOption.GeneralOptions.Storage == Definitions.Enumerations.SettingsStorage.Project && _wasCreatedFromOptions; _uiIncrement.SelectedItem = _versionComponentNames.GetValue(_selectedProjectOption.GeneralOptions.VersionComponent); _uiIncrement.Enabled = true; _uiIncrementOverflow.Checked = _selectedProjectOption.GeneralOptions.HandleIncrementOverflow; _uiIncrementOverflow.Enabled = _selectedProjectOption.GeneralOptions.VersionComponent.HasValue; _uiVersionAttribute.SelectedItem = Constants.AssemblyInfoVersionIdentifierNames[_selectedProjectOption.GeneralOptions.AssemblyInfoVersionIdentifier]; _uiInformationalSeparator.Text = _selectedProjectOption.GeneralOptions.AssemblyInfoVersionInformationalSeparator; _uiSaveAllVersions.Checked = _selectedProjectOption.GeneralOptions.SaveBackVersionInAllIdentifiers; } else { _uiStorage.SelectedItem = null; _uiStorage.Enabled = false; _uiFilename.Text = null; _uiFilename.Enabled = false; _uiIncrement.SelectedItem = null; _uiIncrement.Enabled = false; _uiIncrementOverflow.Checked = false; _uiIncrementOverflow.Enabled = false; _uiVersionAttribute.SelectedItem = null; _uiInformationalSeparator.Text = null; _uiSaveAllVersions.Checked = false; } _blockEvents = false; } else if ((sender == _uiStorage) && _selectedProjectOption != null) { _selectedProjectOption.GeneralOptions.Storage = _storageNames.First(x => x.Value == (string)_uiStorage.SelectedItem).Key; _uiFilename.Enabled = _selectedProjectOption.GeneralOptions.Storage == Definitions.Enumerations.SettingsStorage.Project; } else if ((sender == _uiFilename) && _selectedProjectOption != null) { _selectedProjectOption.GeneralOptions.Filename = _uiFilename.Text; } else if ((sender == _uiIncrement) && _selectedProjectOption != null) { _selectedProjectOption.GeneralOptions.VersionComponent = _versionComponentNames.GetKey((string)_uiIncrement.SelectedItem); _uiIncrementOverflow.Enabled = _selectedProjectOption.GeneralOptions.VersionComponent.HasValue; } else if ((sender == _uiIncrementOverflow) && _selectedProjectOption != null) { _selectedProjectOption.GeneralOptions.HandleIncrementOverflow = _uiIncrementOverflow.Checked; } else if ((sender == _uiVersionAttribute) && _selectedProjectOption != null) { _selectedProjectOption.GeneralOptions.AssemblyInfoVersionIdentifier = Constants.AssemblyInfoVersionIdentifierNames.First(x => x.Value == (string)_uiVersionAttribute.SelectedItem).Key; } else if ((sender == _uiInformationalSeparator) && _selectedProjectOption != null) { if (string.IsNullOrEmpty(_uiInformationalSeparator.Text) || _uiInformationalSeparator.Text == VersionUtil.VersionSeparator.ToString()) { _blockEvents = true; _uiInformationalSeparator.Text = VersionUtil.VersionInformationalSeparator; _blockEvents = false; } _selectedProjectOption.GeneralOptions.AssemblyInfoVersionInformationalSeparator = _uiInformationalSeparator.Text; } else if ((sender == _uiSaveAllVersions) && _selectedProjectOption != null) { _selectedProjectOption.GeneralOptions.SaveBackVersionInAllIdentifiers = _uiSaveAllVersions.Checked; } } }
public DeploymentPrepare(Project activeProject, Xml.Settings.Project.Options projectOptions) : base() { InitializeComponent(); if (activeProject == null) throw new ArgumentNullException("activeProject", "given project must not be null"); _activeProject = activeProject; _projectOptions = projectOptions; _versionComponentControlRelationships = new HashSet<VersionComponentControlRelationship>() { new VersionComponentControlRelationship(Common.Definitions.Enumerations.VersionComponent.Major, _uiNuSpecMetadataVersionMajor, PropertyUtil.GetProperty<NumericUpDown, decimal>(x => x.Value)), new VersionComponentControlRelationship(Common.Definitions.Enumerations.VersionComponent.Minor, _uiNuSpecMetadataVersionMinor, PropertyUtil.GetProperty<NumericUpDown, decimal>(x => x.Value)), new VersionComponentControlRelationship(Common.Definitions.Enumerations.VersionComponent.Revision, _uiNuSpecMetadataVersionRevision, PropertyUtil.GetProperty<NumericUpDown, decimal>(x => x.Value)), new VersionComponentControlRelationship(Common.Definitions.Enumerations.VersionComponent.Build, _uiNuSpecMetadataVersionBuild, PropertyUtil.GetProperty<NumericUpDown, decimal>(x => x.Value)), new VersionComponentControlRelationship(Common.Definitions.Enumerations.VersionComponent.Informational, _uiNuSpecMetadataVersionInformational, PropertyUtil.GetProperty<TextBox, string>(x => x.Text)) }; }
private void OnChange(object sender, EventArgs e) { if (!_blockEvents) { if (sender == _uiProjectIdentifiers) { _selectedProjectOptions = (Xml.Settings.Project.Options)_uiProjectIdentifiers.SelectedItem; _blockEvents = true; if (_selectedProjectOptions != null) { GetCheckedAndSetCheckbox(_uiUseId, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Use); GetCheckedAndSetCheckbox(_uiSaveId, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Save); GetCheckedAndSetCheckbox(_uiUseVersion, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Version.Use); GetCheckedAndSetCheckbox(_uiSaveVersion, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Version.Save); GetCheckedAndSetCheckbox(_uiUseTitle, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Title.Use); GetCheckedAndSetCheckbox(_uiSaveTitle, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Title.Save); GetCheckedAndSetCheckbox(_uiUseAuthors, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Authors.Use); GetCheckedAndSetCheckbox(_uiSaveAuthors, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Authors.Save); GetCheckedAndSetCheckbox(_uiUseOwners, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Owners); GetCheckedAndSetCheckbox(_uiUseDescription, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Description.Use); GetCheckedAndSetCheckbox(_uiSaveDescription, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Description.Save); GetCheckedAndSetCheckbox(_uiUseReleaseNotes, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.ReleaseNotes); GetCheckedAndSetCheckbox(_uiUseSummary, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Summary); GetCheckedAndSetCheckbox(_uiUseLanguage, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Language.Use); GetCheckedAndSetCheckbox(_uiSaveLanguage, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Language.Save); GetCheckedAndSetCheckbox(_uiUseProjectUrl, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.ProjectUrl); GetCheckedAndSetCheckbox(_uiUseIconUrl, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.IconUrl); GetCheckedAndSetCheckbox(_uiUseLicenseUrl, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.LicenseUrl); GetCheckedAndSetCheckbox(_uiUseCopyright, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Copyright.Use); GetCheckedAndSetCheckbox(_uiSaveCopyright, true, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Copyright.Save); GetCheckedAndSetCheckbox(_uiUseTags, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Tags); GetCheckedAndSetCheckbox(_uiUseRequireLicenseAcceptance, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.RequireLicenseAcceptance); GetCheckedAndSetCheckbox(_uiUseDevelopmentDependency, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.DevelopmentDependency); GetCheckedAndSetCheckbox(_uiUseDependencies, false, _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Dependencies); } else { GetCheckedAndSetCheckbox(_uiUseId, false, false); GetCheckedAndSetCheckbox(_uiSaveId, true, false); GetCheckedAndSetCheckbox(_uiUseVersion, false, false); GetCheckedAndSetCheckbox(_uiSaveVersion, true, false); GetCheckedAndSetCheckbox(_uiUseTitle, false, false); GetCheckedAndSetCheckbox(_uiSaveTitle, true, false); GetCheckedAndSetCheckbox(_uiUseAuthors, false, false); GetCheckedAndSetCheckbox(_uiSaveAuthors, true, false); GetCheckedAndSetCheckbox(_uiUseOwners, false, false); GetCheckedAndSetCheckbox(_uiUseDescription, false, false); GetCheckedAndSetCheckbox(_uiSaveDescription, true, false); GetCheckedAndSetCheckbox(_uiUseReleaseNotes, false, false); GetCheckedAndSetCheckbox(_uiUseSummary, false, false); GetCheckedAndSetCheckbox(_uiUseLanguage, false, false); GetCheckedAndSetCheckbox(_uiSaveLanguage, true, false); GetCheckedAndSetCheckbox(_uiUseProjectUrl, false, false); GetCheckedAndSetCheckbox(_uiUseIconUrl, false, false); GetCheckedAndSetCheckbox(_uiUseLicenseUrl, false, false); GetCheckedAndSetCheckbox(_uiUseCopyright, false, false); GetCheckedAndSetCheckbox(_uiSaveCopyright, true, false); GetCheckedAndSetCheckbox(_uiUseTags, false, false); GetCheckedAndSetCheckbox(_uiUseRequireLicenseAcceptance, false, false); GetCheckedAndSetCheckbox(_uiUseDevelopmentDependency, false, false); GetCheckedAndSetCheckbox(_uiUseDependencies, false, false); } _blockEvents = false; } else if (sender == _uiUseId && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Use = GetCheckedAndSetCheckbox(_uiUseId, false); } else if (sender == _uiSaveId && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Id.Save = GetCheckedAndSetCheckbox(_uiSaveId, true); } else if (sender == _uiUseVersion && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Version.Use = GetCheckedAndSetCheckbox(_uiUseVersion, false); } else if (sender == _uiSaveVersion && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Version.Save = GetCheckedAndSetCheckbox(_uiSaveVersion, true); } else if (sender == _uiUseTitle && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Title.Use = GetCheckedAndSetCheckbox(_uiUseTitle, false); } else if (sender == _uiSaveTitle && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Title.Save = GetCheckedAndSetCheckbox(_uiSaveTitle, true); } else if (sender == _uiUseAuthors && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Authors.Use = GetCheckedAndSetCheckbox(_uiUseAuthors, false); } else if (sender == _uiSaveAuthors && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Authors.Save = GetCheckedAndSetCheckbox(_uiSaveAuthors, true); } else if (sender == _uiUseOwners && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Owners = GetCheckedAndSetCheckbox(_uiUseOwners, false); } else if (sender == _uiUseDescription && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Description.Use = GetCheckedAndSetCheckbox(_uiUseDescription, false); } else if (sender == _uiSaveDescription && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Description.Save = GetCheckedAndSetCheckbox(_uiSaveDescription, true); } else if (sender == _uiUseReleaseNotes && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.ReleaseNotes = GetCheckedAndSetCheckbox(_uiUseReleaseNotes, false); } else if (sender == _uiUseSummary && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Summary = GetCheckedAndSetCheckbox(_uiUseSummary, false); } else if (sender == _uiUseLanguage && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Language.Use = GetCheckedAndSetCheckbox(_uiUseLanguage, false); } else if (sender == _uiSaveLanguage && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Language.Save = GetCheckedAndSetCheckbox(_uiSaveLanguage, true); } else if (sender == _uiUseProjectUrl && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.ProjectUrl = GetCheckedAndSetCheckbox(_uiUseProjectUrl, false); } else if (sender == _uiUseIconUrl && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.IconUrl = GetCheckedAndSetCheckbox(_uiUseIconUrl, false); } else if (sender == _uiUseLicenseUrl && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.LicenseUrl = GetCheckedAndSetCheckbox(_uiUseLicenseUrl, false); } else if (sender == _uiUseCopyright && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Copyright.Use = GetCheckedAndSetCheckbox(_uiUseCopyright, false); } else if (sender == _uiSaveCopyright && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Copyright.Save = GetCheckedAndSetCheckbox(_uiSaveCopyright, true); } else if (sender == _uiUseTags && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Tags = GetCheckedAndSetCheckbox(_uiUseTags, false); } else if (sender == _uiUseRequireLicenseAcceptance && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.RequireLicenseAcceptance = GetCheckedAndSetCheckbox(_uiUseRequireLicenseAcceptance, false); } else if (sender == _uiUseDevelopmentDependency && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.DevelopmentDependency = GetCheckedAndSetCheckbox(_uiUseDevelopmentDependency, false); } else if (sender == _uiUseDependencies && _selectedProjectOptions != null) { _selectedProjectOptions.NuGetOptions.NuSpecOptions.Metadata.Dependencies = GetCheckedAndSetCheckbox(_uiUseDependencies, false); } } }