Beispiel #1
0
        private async System.Threading.Tasks.Task ExecuteTidySetAsync(ExecuteShellCommand executeShell,
                                                                      string clangPath, Dictionary <string, List <string> > projectToFiles, string clangOptions, CancellationToken cancel)
        {
            IInvokeTidyService service = await package.GetServiceAsync(typeof(SInvokeTidyService))
                                         as IInvokeTidyService;

            if (service == null)
            {
                return;
            }
            try
            {
                List <Task> tasks = new List <Task>();
                foreach (var compileDatabase in projectToFiles.Keys)
                {
                    tasks.Add(service.ExecuteTidyAsync(executeShell, clangPath, compileDatabase, clangOptions, projectToFiles[compileDatabase]
                                                       , cancel));
                }
                await Task.WhenAll(tasks.ToArray()).ContinueWith(_ =>
                {
                    executeShell.Done();
                    m_errorService.SetMessages(executeShell.Failures);
                    TidyControl.RunningTidy.Dispose();
                    TidyControl.RunningTidy = null;
                }, TaskScheduler.Default);
            }
            catch (Exception)
            {
                TidyControl.RunningTidy.Dispose();
                TidyControl.RunningTidy = null;
            }
        }
Beispiel #2
0
        private async System.Threading.Tasks.Task ExecuteTidyAsync(
            ExecuteShellCommand executor,
            string tidyPath,
            string compileDatabasePath,
            string tidyOptions,
            List <string> files,
            CancellationToken cancel)
        {
            IInvokeTidyService service = await package.GetServiceAsync(typeof(SInvokeTidyService))
                                         as IInvokeTidyService;

            if (service == null)
            {
                return;
            }
            await service.ExecuteTidyAsync(executor, tidyPath, compileDatabasePath, tidyOptions, files, cancel)
            .ContinueWith(_ =>
            {
                executor.Done();
                m_errorService.SetMessages(executor.Failures);
                TidyControl.RunningTidy.Dispose();
                TidyControl.RunningTidy = null;
            }, TaskScheduler.Default);
        }