public CompileSettingsFormViewModel(IProject project) : base("Compiler", project) { settings = project.GetToolchainSettings <GccToolchainSettings>().CompileSettings; defines = new ObservableCollection <string>(settings.Defines); includePaths = new ObservableCollection <string>(settings.Includes); miscOptions = settings.CustomFlags; optimizationLevelSelectedIndex = (int)settings.Optimization; cppLanguageStandardSelectedIndex = (int)settings.CppLanguageStandard; clanguageStandardSelectedIndex = (int)settings.CLanguageStandard; fpuSelectedIndex = (int)settings.Fpu; debugSymbols = settings.DebugInformation; rtti = settings.Rtti; exceptions = settings.Exceptions; AddDefineCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.DefineText, define => !string.IsNullOrEmpty(define) && !Defines.Contains(define))); AddDefineCommand.Subscribe(AddDefine); RemoveDefineCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.SelectedDefine, selected => !string.IsNullOrEmpty(selected))); RemoveDefineCommand.Subscribe(RemoveDefine); AddIncludePathCommand = ReactiveCommand.Create(); AddIncludePathCommand.Subscribe(AddIncludePath); RemoveIncludePathCommand = ReactiveCommand.Create(); RemoveIncludePathCommand.Subscribe(RemoveIncludePath); UpdateCompileString(); }
public CompileSettingsFormViewModel(IProject project) : base("Compiler", project) { try { settings = GCCToolchain.GetSettings(project).CompileSettings; } catch (Exception) { Model.ToolchainSettings.GccToolchainSettings = new GccToolchainSettings(); } defines = new ObservableCollection <string>(settings.Defines); includePaths = new ObservableCollection <string>(settings.Includes); //var config = project.SelectedConfiguration; //cppSupport = config.CppSupport; miscOptions = settings.CustomFlags; //includePaths = new ObservableCollection<string>(config.IncludePaths); optimizationLevelSelectedIndex = (int)settings.Optimization; optimizationPreferenceSelectedIndex = (int)settings.OptimizationPreference; cppLanguageStandardSelectedIndex = (int)settings.CppLanguageStandard; cLanguageStandardSelectedIndex = (int)settings.CLanguageStandard; fpuSelectedIndex = (int)settings.Fpu; debugSymbols = settings.DebugInformation; rtti = settings.Rtti; exceptions = settings.Exceptions; AddDefineCommand = ReactiveCommand.Create(); // new RoutingCommand(AddDefine, (o) => DefineText != string.Empty && DefineText != null && !Defines.Contains(DefineText)); AddDefineCommand.Subscribe(AddDefine); RemoveDefineCommand = ReactiveCommand.Create(); // new RoutingCommand(RemoveDefine, (o) => SelectedDefine != string.Empty && SelectedDefine != null); RemoveDefineCommand.Subscribe(RemoveDefine); AddIncludePathCommand = ReactiveCommand.Create(); AddIncludePathCommand.Subscribe(AddIncludePath); RemoveIncludePathCommand = ReactiveCommand.Create(); RemoveIncludePathCommand.Subscribe(RemoveIncludePath); UpdateCompileString(); }