Exemplo n.º 1
0
        public async Task LoadAsync()
        {
            try
            {
                WorkingStart();

                OutputService.WriteOutputWithContext("Start load Projectinformation.");

                solutionPath = new FileInfo(service.Solution.FullName);

                if (solutionPath?.DirectoryName != null)
                {
                    var xmlFile = Path.Combine(solutionPath.DirectoryName,
                                               solutionPath.Name.Replace(solutionPath.Extension, string.Empty));

                    Configuration = SerializationService.FromXml <ConfigData>($"{xmlFile}ConfigData.xml");
                    Data          = SerializationService.FromXml <ObservableCollection <ProjectData> >($"{xmlFile}ProjectData.xml");
                }

                if (solutionPath.FullName.Contains("Dev-Feature"))
                {
                    Configuration.IsFeature = true;
                }

                var task = Task.Run(() => Load());

                await task;

                var result = task.Result;

                Data =
                    new ObservableCollection <ProjectData>(
                        Data.Concat(result.Select(item => item).Where(item => !Data.Contains(item))));

                OutputService.WriteOutputWithContext("Finshed load Projectinformation.");
            }
            catch (Exception exception)
            {
                OutputService.WriteOutputWithContext($"Error: {exception.Message}");
                logger.Error(exception, exception.Message);
            }
            finally
            {
                WorkingStop();
            }
        }