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 IncludePathSettingsFormViewModel(CPlusPlusProject model) : base("Includes / Definitions", model) { defines = new ObservableCollection <DefinitionViewModel>(); includePaths = new ObservableCollection <IncludeViewModel>(); foreach (var define in model.Defines) { defines.Add(new DefinitionViewModel(model, define)); } foreach (var include in model.Includes) { includePaths.Add(new IncludeViewModel(model, include)); } 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); }
public CompileSettingsFormViewModel(IProject project) : base("Compiler", project) { try { settings = STM32GCCToolchain.GetSettings(project).CompileSettings; } catch (Exception e) { Model.ToolchainSettings.STM32ToolchainSettings = new STM32ToolchainSettings(); } 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(); }