Example #1
0
        public DatasetListWindowViewModel(JobStore jobStore)
        {
            Store             = null;
            DatasetLoaded     = false;
            IsLoading         = false;
            LoadProgressCount = 0;
            LoadTotalCount    = 1;
            ProjectPath       = "No project loaded";
            ShowLegacyPets    = false;
            PetDatasetsList   = new List <Dataset>();
            PetDatasets       = new ListCollectionView(PetDatasetsList);
            PetDatasets.SortDescriptions.Add(new SortDescription("Time", ListSortDirection.Descending));

            TestBenchDatasetsList = new List <Dataset>();
            TestBenchDatasets     = new ListCollectionView(TestBenchDatasetsList);
            TestBenchDatasets.SortDescriptions.Add(new SortDescription("Time", ListSortDirection.Descending));

            FilterPets("");

            AnalysisTools = new AnalysisTools();

            if (jobStore == null)
            {
                JobStore = new JobStore();
            }
            else
            {
                JobStore = jobStore;
            }
            JobsView = new ListCollectionView(JobStore.TrackedJobs);
            JobStore.TrackedJobsChanged += (sender, args) =>
            {
                JobsView.Refresh();
                if (TrackedJobsChanged != null)
                {
                    TrackedJobsChanged(this, EventArgs.Empty);
                }
            };
            JobStore.JobCompleted += (sender, args) =>
            {
                if (DatasetLoaded)
                {
                    LoadDataset(Store.DataDirectory, exception => Console.WriteLine(exception));
                }
            };
            JobStore.JobCollectionAdded += (sender, args) =>
            {
                if (DatasetLoaded)
                {
                    LoadDataset(Store.DataDirectory, exception => Console.WriteLine(exception));
                }
            };
        }
Example #2
0
        public MergedPetDetailsViewModel(Dataset dataset, string mergedDirectory)
        {
            AnalysisTools   = new AnalysisTools();
            DetailsDataset  = dataset;
            MergedDirectory = mergedDirectory;
            RecordCount     = 0;
            MgaFilename     = "";
            MgaFilePath     = "";
            PetPath         = "";
            if (DetailsDataset.Kind == Dataset.DatasetKind.MergedPet || DetailsDataset.Kind == Dataset.DatasetKind.Pet)
            {
                var datasetPath = System.IO.Path.Combine(mergedDirectory, DetailsDataset.Folders[0]);

                try
                {
                    var jsonFileName = Path.Combine(MergedDirectory, DetailsDataset.Folders[0], "pet_config.json");

                    using (var reader = File.OpenText(jsonFileName))
                    {
                        var serializer = new JsonSerializer();
                        var mdaoConfig = (PETConfig)serializer.Deserialize(reader, typeof(PETConfig));

                        if (!string.IsNullOrEmpty(mdaoConfig.MgaFilename))
                        {
                            MgaFilePath = mdaoConfig.MgaFilename;
                            MgaFilename = Path.GetFileName(MgaFilePath);
                        }

                        if (!string.IsNullOrEmpty(mdaoConfig.PETName))
                        {
                            PetPath = mdaoConfig.PETName;
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error occurred reading pet_config.json: ");
                    Console.WriteLine(e);

                    Trace.TraceError("Error occurred reading pet_config.json: ");
                    Trace.TraceError(e.ToString());
                }

                ComputeStatistics();
                VisualizerSessionsList = GetVisualizerSessions(mergedDirectory);
                VisualizerSessions     = new ListCollectionView(VisualizerSessionsList);
                VisualizerSessions.SortDescriptions.Add(new SortDescription("DisplayName", ListSortDirection.Ascending));
            }
            else
            {
            }
        }