From 1df3dc19f50ccc628f63e260c8dedb19e994e35f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro?= Date: Tue, 3 Apr 2018 19:55:11 +0100 Subject: [PATCH] Cosmos property page. --- .../build/Cosmos.Build.targets | 5 +- .../ViewModels/CosmosPropertyPageViewModel.cs | 84 ++++++--- .../Views/CosmosPropertyPageControl.xaml | 163 ++++++++++-------- 3 files changed, 152 insertions(+), 100 deletions(-) diff --git a/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets b/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets index 578b1a36c..aff2b3753 100644 --- a/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets +++ b/source/Cosmos.Build.Tasks/build/Cosmos.Build.targets @@ -38,6 +38,9 @@ True False + 1 + 0 + ELF Source User @@ -142,7 +145,7 @@ StackCorruptionDetectionLevel="$(StackCorruptionDetectionLevel)" TraceAssemblies="$(TraceAssemblies)" IgnoreDebugStubAttribute="$(IgnoreDebugStubAttribute)" - DebugCom="1" + DebugCom="$(DebugCom)" References="$(TargetPath);@(PlugsReference)" AssemblySearchDirs="@(AssemblySearchDir)" OutputFilename="$(Il2cpuOutput)" diff --git a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/ViewModels/CosmosPropertyPageViewModel.cs b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/ViewModels/CosmosPropertyPageViewModel.cs index bc62f8f3a..93c2483f7 100644 --- a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/ViewModels/CosmosPropertyPageViewModel.cs +++ b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/ViewModels/CosmosPropertyPageViewModel.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; using Microsoft.VisualStudio.ProjectSystem; using VSPropertyPages; @@ -8,32 +9,17 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels { internal class CosmosPropertyPageViewModel : PropertyPageViewModel { - public CosmosPropertyPageViewModel( - IPropertyManager propertyManager, - IProjectThreadingService projectThreadingService) - : base(propertyManager, projectThreadingService) - { - } + #region Static Items - public bool DebugEnabled - { - get => String.Equals(GetProperty(nameof(DebugEnabled)), "True", StringComparison.OrdinalIgnoreCase); - set => SetProperty(nameof(DebugEnabled), value.ToString(), nameof(DebugEnabled)); - } + private static readonly List DebugComItemsList = new List() { 1, 2, 3, 4 }; - public Dictionary DebugModeItems { get; } = new Dictionary() + private static readonly Dictionary DebugModeItemsDictionary = new Dictionary() { ["IL"] = "IL", ["Source"] = "Source" }; - public string DebugMode - { - get => GetProperty(nameof(DebugMode)); - set => SetProperty(nameof(DebugMode), value); - } - - public Dictionary TraceModeItems { get; } = new Dictionary() + private static readonly Dictionary TraceModeItemsDictionary = new Dictionary() { ["None"] = "None", ["User"] = "User", @@ -41,23 +27,57 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels ["All"] = "All" }; + private static readonly Dictionary StackCorruptionDetectionLevelItemsDictionary = new Dictionary() + { + ["AllInstructions"] = "All Instructions", + ["MethodFooters"] = "Method Footers" + }; + + #endregion + + public bool DebugEnabled + { + get => String.Equals(GetProperty(nameof(DebugEnabled)), "True", StringComparison.OrdinalIgnoreCase); + set => SetProperty(nameof(DebugEnabled), value.ToString(), nameof(DebugEnabled)); + } + + public List DebugComItems => DebugComItemsList; + + public int DebugCom + { + get => Int32.Parse(GetProperty(nameof(DebugCom))); + set => SetProperty(nameof(DebugCom), value.ToString()); + } + + public Dictionary DebugModeItems => DebugModeItemsDictionary; + + public string DebugMode + { + get => GetProperty(nameof(DebugMode)); + set => SetProperty(nameof(DebugMode), value); + } + + public Dictionary TraceModeItems => TraceModeItemsDictionary; + public string TraceMode { get => GetProperty(nameof(TraceMode)); set => SetProperty(nameof(TraceMode), value); } + public bool IgnoreDebugStubAttribute + { + get => String.Equals(GetProperty(nameof(IgnoreDebugStubAttribute)), "True", StringComparison.OrdinalIgnoreCase); + set => SetProperty(nameof(IgnoreDebugStubAttribute), value.ToString(), nameof(IgnoreDebugStubAttribute)); + } + public bool StackCorruptionDetectionEnabled { get => String.Equals(GetProperty(nameof(StackCorruptionDetectionEnabled)), "True", StringComparison.OrdinalIgnoreCase); set => SetProperty(nameof(StackCorruptionDetectionEnabled), value.ToString(), nameof(StackCorruptionDetectionEnabled)); } - public Dictionary StackCorruptionDetectionLevelItems { get; } = new Dictionary() - { - ["AllInstructions"] = "All Instructions", - ["MethodFooters"] = "Method Footers" - }; + public Dictionary StackCorruptionDetectionLevelItems => StackCorruptionDetectionLevelItemsDictionary; public string StackCorruptionDetectionLevel { @@ -77,10 +97,20 @@ namespace Cosmos.VS.ProjectSystem.VS.PropertyPages.ViewModels set => SetProperty(nameof(VisualStudioDebugPort), value); } - public bool IgnoreDebugStubAttribute + public CosmosPropertyPageViewModel( + IPropertyManager propertyManager, + IProjectThreadingService projectThreadingService) + : base(propertyManager, projectThreadingService) { - get => String.Equals(GetProperty(nameof(IgnoreDebugStubAttribute)), "True", StringComparison.OrdinalIgnoreCase); - set => SetProperty(nameof(IgnoreDebugStubAttribute), value.ToString(), nameof(IgnoreDebugStubAttribute)); + } + + private void SetAndRaiseIfChanged(ref T field, T value, [CallerMemberName] string propertyName = null) + { + if (!EqualityComparer.Default.Equals(field, value)) + { + field = value; + OnPropertyChanged(propertyName); + } } } } diff --git a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/Views/CosmosPropertyPageControl.xaml b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/Views/CosmosPropertyPageControl.xaml index 7bc27fccb..8e3a87860 100644 --- a/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/Views/CosmosPropertyPageControl.xaml +++ b/source/Cosmos.VS.ProjectSystem/ProjectSystem/VS/PropertyPages/Views/CosmosPropertyPageControl.xaml @@ -17,90 +17,109 @@ Padding="12" Header="IL2CPU"> - - - - - - - - - - - - - - - + - - - + - - + + + + + + + + + + + + + + + - - + + - + + - - + + - - + + - + + + + - + + + + + + + + + + +