Esempio n. 1
0
 private static IObservable <Unit> SetGridDataSource(bool models = true)
 => Observable.Start(() => ProjectWrapperBuilder.GetProjectItemWrappers(models).ToList())
 .ObserveOn(_gridControl)
 .Select(list => {
     _gridControl.DataSource = new BindingList <ProjectItemWrapper>(list
                                                                    .GroupBy(wrapper => wrapper.LocalPath).Select(_ => _.First()).ToArray());
     return(Unit.Default);
 })
 .Catch <Unit, Exception>(e => {
     DteExtensions.DTE.LogError(e.ToString());
     DteExtensions.DTE.WriteToOutput(e.ToString());
     return(Observable.Empty <Unit>());
 });
Esempio n. 2
0
        private static void SetGridDataSource(bool models = true)
        {
            var projectWrappers = new List <ProjectItemWrapper>();

            Task.Factory.StartNew(() => projectWrappers = ProjectWrapperBuilder.GetProjectItemWrappers(models).ToList())
            .ContinueWith(task1 => {
                if (task1.Exception != null)
                {
                    DteExtensions.DTE.LogError(task1.Exception.ToString());
                    DteExtensions.DTE.WriteToOutput(task1.Exception.ToString());
                }
                _gridControl.DataSource = new BindingList <ProjectItemWrapper>(projectWrappers.GroupBy(wrapper => wrapper.LocalPath).Select(_ => _.First()).ToArray());
            }, _currentSynchronizationContext);
        }