/// <summary>
        /// Creates a new instance of the options class and loads the values from the store. For internal use only
        /// </summary>
        /// <returns></returns>
        private static async Task <GeneralOptionModel> CreateAsync()
        {
            var optionProvider = GeneralOptionProvider.Instance;
            var instance       = new GeneralOptionModel(optionProvider);

            await instance.LoadAsync();

            return(instance);
        }
示例#2
0
        public GeneralOptionProvider()
        {
            SortOptions              = GeneralOptionPage.SortState.ByName;
            AutoScroll               = true;
            IsEnabledIndentGuides    = false;
            IndentGuideThickness     = 0.9;
            IndentGuideDashSize      = 3.0;
            IndentGuideSpaceSize     = 2.9;
            IndentGuideOffsetX       = 3.2;
            IndentGuideOffsetY       = 2.0;
            Asm1FileExtensions       = Constants.DefaultFileExtensionAsm1;
            Asm2FileExtensions       = Constants.DefaultFileExtensionAsm2;
            Asm1SelectedSet          = string.Empty;
            Asm2SelectedSet          = string.Empty;
            InstructionsPaths        = DefaultInstructionPaths.Value;
            AutocompleteInstructions = false;
            AutocompleteFunctions    = false;
            AutocompleteLabels       = false;
            AutocompleteVariables    = false;
            SignatureHelp            = false;

            _optionModelInitTask = Task.Run(async() =>
            {
                var optionModel = await GeneralOptionModel
                                  .GetInstanceAsync()
                                  .ConfigureAwait(false);

                // required initialization before OptionsSaved event
                var serviceProvider = AsyncServiceProvider.GlobalProvider;
                _ = await serviceProvider.GetMefServiceAsync <ContentTypeManager>();
                _ = await serviceProvider.GetMefServiceAsync <IInstructionListLoader>();

                optionModel.OptionsSaved += OptionsUpdatedInvoke;
                OptionsUpdatedInvoke(optionModel);

                return(optionModel);
            });
        }
示例#3
0
 private void OptionsUpdatedInvoke(GeneralOptionModel sender) =>
 OptionsUpdated?.Invoke(this);