public static async Task InitializeAsync(RazorMinifier package)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            Instance = new ToggleRazorMinifier(package, commandService);
        }
示例#2
0
        private async Task RazorMinifier_OnInitializeAsync(CancellationToken arg1, IProgress <ServiceProgressData> arg2)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync();

            if (Solution.IsTempSolution())
            {
                return;
            }

            await ToggleRazorMinifier.InitializeAsync(this);

            Solution.OpenNodeEvents.OnSaved.Hook(NodeTypes.Document, OnDocumentSaved);
            Solution.ProjectNodeChangedEvents.OnDocumentsAdded   += OnDocumentsAdded;
            Solution.ProjectNodeChangedEvents.OnDocumentsRemoved += OnDocumentsRemoved;

            _ = JoinableTaskFactory.RunAsync(async() => await TryLoadConfigFileAsync());
        }