From 9d4d894aa88092d92a4bbb5555ca61fa0c5112f8 Mon Sep 17 00:00:00 2001 From: Quajak Date: Mon, 26 Oct 2020 13:13:48 +0100 Subject: [PATCH] User defined launch configurations are loaded when reopening properties Cleaned up code --- .../OldCosmosPropertyPageControl.Designer.cs | 2 +- .../OldCosmosPropertyPageControl.cs | 13 ++++++++---- .../VS/PropertyPages/OldPropertyManager.cs | 20 +++++++++---------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldCosmosPropertyPageControl.Designer.cs b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldCosmosPropertyPageControl.Designer.cs index 456d75f83..47bf41a21 100644 --- a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldCosmosPropertyPageControl.Designer.cs +++ b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldCosmosPropertyPageControl.Designer.cs @@ -451,7 +451,7 @@ this.chkEnableStackCorruptionDetection.TabIndex = 8; this.chkEnableStackCorruptionDetection.Text = "Enable Stack Corruption Detection"; this.chkEnableStackCorruptionDetection.UseVisualStyleBackColor = true; - this.chkEnableStackCorruptionDetection.CheckedChanged += new System.EventHandler(this.chkEnableStacckCorruptionDetection_CheckedChanged); + this.chkEnableStackCorruptionDetection.CheckedChanged += new System.EventHandler(this.chkEnableStackCorruptionDetection_CheckedChanged); // // debugLevelGroupBox // diff --git a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldCosmosPropertyPageControl.cs b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldCosmosPropertyPageControl.cs index dd9d423e0..4e0c1eeed 100644 --- a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldCosmosPropertyPageControl.cs +++ b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldCosmosPropertyPageControl.cs @@ -558,7 +558,7 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages for (int i = 1; i < 100; i++) { - if (!string.IsNullOrEmpty(mViewModel.BuildProperties.GetProperty("User" + i.ToString("000") + "_Name"))) + if (!String.IsNullOrEmpty(mViewModel.BuildProperties.GetProperty("User" + i.ToString("000") + "_Name"))) { FillProfile(i); } @@ -669,7 +669,7 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages { string xValue = mViewModel.GetProjectProperty(xPrefix + xName); // This is important that we dont copy empty values, so instead the defaults will be used. - if (!string.IsNullOrWhiteSpace(xValue)) + if (!String.IsNullOrWhiteSpace(xValue)) { mViewModel.BuildProperties.SetProperty(xPrefix + xName, xValue); } @@ -695,6 +695,11 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages { LoadProfileProps(xPreset.Key); } + for (int id = 1; id < 100; id++) + { + var xPrefix = "User" + id.ToString("000"); + LoadProfileProps(xPrefix); + } } private void FillProperties() @@ -786,7 +791,7 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages protected List GetNetworkInterfaces() { NetworkInterface[] nInterfaces = NetworkInterface.GetAllNetworkInterfaces(); - List interfaces_list = new List(); + var interfaces_list = new List(); foreach (NetworkInterface nInterface in nInterfaces) { @@ -807,7 +812,7 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages return interfaces_list; } - private void chkEnableStacckCorruptionDetection_CheckedChanged(object sender, EventArgs e) + private void chkEnableStackCorruptionDetection_CheckedChanged(object sender, EventArgs e) { if (!FreezeEvents) { diff --git a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldPropertyManager.cs b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldPropertyManager.cs index bd42aa0d6..bbfda2810 100644 --- a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldPropertyManager.cs +++ b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/OldPropertyManager.cs @@ -11,9 +11,7 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages { internal class OldPropertyManager : IPropertyManager { - private BuildProperties mBuildProperties; - - public BuildProperties BuildProperties => mBuildProperties; + public BuildProperties BuildProperties { get; } public string ProjectPath => mUnconfiguredProject.FullPath; @@ -28,14 +26,14 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages public OldPropertyManager(UnconfiguredProject unconfiguredProject) { - mBuildProperties = new BuildProperties(); + BuildProperties = new BuildProperties(); - mBuildProperties.PropertyChanged += delegate (object sender, PropertyChangedEventArgs e) + BuildProperties.PropertyChanged += delegate (object sender, PropertyChangedEventArgs e) { PropertyChanged?.Invoke(this, new ProjectPropertyChangedEventArgs(e.PropertyName, e.OldValue, e.NewValue)); }; - mBuildProperties.PropertyChanging += delegate (object sender, PropertyChangingEventArgs e) + BuildProperties.PropertyChanging += delegate (object sender, PropertyChangingEventArgs e) { PropertyChanging?.Invoke(this, new ProjectPropertyChangingEventArgs(e.PropertyName)); }; @@ -59,7 +57,7 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages } public Task GetPropertyAsync(string propertyName) => - Task.FromResult(mBuildProperties.GetProperty(propertyName)); + Task.FromResult(BuildProperties.GetProperty(propertyName)); public async Task SetPathPropertyAsync(string propertyName, string value, bool isRelative) { @@ -77,11 +75,11 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages { PropertyChanging?.Invoke(this, new ProjectPropertyChangingEventArgs(propertyName)); - var oldValue = mBuildProperties.GetProperty(propertyName); - mBuildProperties.SetProperty(propertyName, value); + var oldValue = BuildProperties.GetProperty(propertyName); + BuildProperties.SetProperty(propertyName, value); PropertyChanged?.Invoke(this, new ProjectPropertyChangedEventArgs( - propertyName, oldValue, mBuildProperties.GetProperty(propertyName))); + propertyName, oldValue, BuildProperties.GetProperty(propertyName))); mIsDirty = true; @@ -99,7 +97,7 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages var project = await projectWriteLock.GetProjectAsync(configuredProject); await projectWriteLock.CheckoutAsync(mUnconfiguredProject.FullPath); - foreach (var property in mBuildProperties.GetProperties()) + foreach (var property in BuildProperties.GetProperties()) { project.SetProperty(property.Key, property.Value); }