/// <summary> /// Creates a new <see cref="SettingsSubPageViewModel"/> instance /// </summary> /// <param name="messenger">The <see cref="IMessenger"/> instance to use</param> /// <param name="analyticsService">The <see cref="IAnalyticsService"/> instance to use</param> /// <param name="storeService">The <see cref="IStoreService"/> instance to use</param> /// <param name="settingsService">The <see cref="ISettingsService"/> instance to use</param> /// <param name="configuration">The <see cref="IOptions{TOptions}"/> instance to use</param> public SettingsSubPageViewModel(IMessenger messenger, IAnalyticsService analyticsService, IStoreService storeService, ISettingsService settingsService, IOptions <AppConfiguration> configuration) : base(messenger) { Source.AddGroup(SettingsSection.Ide, new IdeSettingsSectionViewModel(messenger, analyticsService, storeService, settingsService, configuration)); Source.AddGroup(SettingsSection.UI, new UISettingsSectionViewModel(messenger, settingsService)); Source.AddGroup(SettingsSection.Interpreter, new InterpreterSettingsSectionViewModel(messenger, settingsService)); }
private void LoadResults(InterpreterResult result) { Source.Clear(); // A function used to quickly add a specific section to the current collection void AddToSource(IdeResultSection section) { var model = new IdeResultWithSectionInfo(section, result); Source.AddGroup(section, model); } // The order of items in the result view is as follows: // - (optional) Exception type // - (optional) Stdout buffer // - (optional) Error location // - (optional) Breakpoint location // - (optional) Stack trace // - Source code // - (optional) Function definitions // - Memory state // - Statistics // // Each group stores the type of section it represents, so that // a template selector can be used in the view. The value of each // group is the the whole session result, as it contains all the // available info for the current script execution. // Each template is responsible for extracting info from it // and display according to its own function and section type. if (!result.ExitCode.HasFlag(ExitCode.Success)) { AddToSource(IdeResultSection.ExceptionType); } if (result.Stdout.Length > 0) { AddToSource(IdeResultSection.Stdout); } if (result.ExitCode.HasFlag(ExitCode.ExceptionThrown)) { AddToSource(IdeResultSection.FaultingOperator); } else if (result.ExitCode.HasFlag(ExitCode.BreakpointReached)) { AddToSource(IdeResultSection.BreakpointReached); } if (result.ExitCode.HasFlag(ExitCode.ExceptionThrown) || result.ExitCode.HasFlag(ExitCode.ThresholdExceeded) || result.ExitCode.HasFlag(ExitCode.BreakpointReached)) { AddToSource(IdeResultSection.StackTrace); } AddToSource(IdeResultSection.SourceCode); if (result.Functions.Count > 0) { AddToSource(IdeResultSection.FunctionDefinitions); } AddToSource(IdeResultSection.MemoryState); AddToSource(IdeResultSection.Statistics); }