void IDropTarget.Drop(IDropInfo dropInfo)
        {
            if (dropInfo != null)
            {
                if (dropInfo.VisualTarget is FrameworkElement frameworkElement)
                {
                    if (frameworkElement.Name == "ReportDataGrid")
                    {
                        if (dropInfo.Data is IFileRecordInfo recordInfo)
                        {
                            ReportInfo reportInfo = GetReportInfoFromRecordInfo(recordInfo);
                            AddReportRecord(reportInfo);
                        }
                    }
                    else if (frameworkElement.Name == "RemoveRecordItemControl")
                    {
                        if (dropInfo.Data is ReportInfo reportInfo)
                        {
                            ReportInfoCollection.Remove(reportInfo);
                        }

                        if (dropInfo.Data is IEnumerable <ReportInfo> reportInfos)
                        {
                            reportInfos.ForEach(info => ReportInfoCollection.Remove(info));
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public ReportViewModel(IStatisticProvider frametimeStatisticProvider,
                               IEventAggregator eventAggregator,
                               IAppConfiguration appConfiguration,
                               RecordManager recordManager,
                               ILogger <ReportViewModel> logger)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _frametimeStatisticProvider = frametimeStatisticProvider;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;
            _recordManager = recordManager;
            _logger        = logger;

            CopyTableDataCommand                    = new DelegateCommand(OnCopyTableData);
            RemoveAllReportEntriesCommand           = new DelegateCommand(() => ReportInfoCollection.Clear());
            ReportInfoCollection.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                          ((sender, eventArg) => HasNoReportItems = !ReportInfoCollection.Any());

            SubscribeToSelectRecord();

            stopwatch.Stop();
            _logger.LogInformation(this.GetType().Name + " {initializationTime}s initialization time",
                                   Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
Beispiel #3
0
        public void OnGridSorting(object sender, DataGridSortingEventArgs e)
        {
            switch (e.Column.SortDirection)
            {
            case ListSortDirection.Ascending:
                e.Column.SortDirection = ListSortDirection.Descending;
                break;

            case ListSortDirection.Descending:
                e.Column.SortDirection = ListSortDirection.Ascending;
                break;

            default:
                e.Column.SortDirection = ListSortDirection.Ascending;
                break;
            }

            var column       = e.Column.SortMemberPath;
            var propertyInfo = typeof(ReportInfo).GetProperty(column);

            ReportInfoCollection.Sort(c => propertyInfo.GetValue(c), e.Column.SortDirection);

            var averageRow = ReportInfoCollection.FirstOrDefault(x => x.Game == "Averaged values");

            if (averageRow != null)
            {
                ReportInfoCollection.Move(ReportInfoCollection.IndexOf(averageRow), ReportInfoCollection.Count - 1);
            }
        }
Beispiel #4
0
        private void AddReportRecord(ReportInfo reportInfo)
        {
            ReportInfoCollection.Add(reportInfo);

            if (ReportShowAverageRow)
            {
                AddAverageReportInfo(ReportInfoCollection);
            }
        }
Beispiel #5
0
 public void RemoveReportEntry(ReportInfo selectedItem)
 {
     if (selectedItem.Game.Equals("Averaged values"))
     {
         return;
     }
     else
     {
         ReportInfoCollection.Remove(selectedItem);
         AddAverageReportInfo(ReportInfoCollection);
     }
 }
Beispiel #6
0
        private void OnCopyTableData()
        {
            if (!ReportInfoCollection.Any())
            {
                return;
            }

            StringBuilder builder = new StringBuilder();

            // Header
            var displayNameGame            = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.Game);
            var displayNameResolution      = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.Resolution);
            var displayNameDate            = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.Date);
            var displayNameTime            = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.Time);
            var displayNameNumberOfSamples = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.NumberOfSamples);
            var displayNameRecordTime      = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.RecordTime);
            var displayNameCpu             = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.Cpu);
            var displayNameGraphicCard     = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.GraphicCard);
            var displayNameRam             = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.Ram);
            var displayNameMaxFps          = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.MaxFps);
            var displayNameNinetyNinePercentQuantileFps = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.NinetyNinePercentQuantileFps);
            var displayNameNinetyFivePercentQuantileFps = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.NinetyFivePercentQuantileFps);
            var displayNameAverageFps                     = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.AverageFps);
            var displayNameMedianFps                      = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.MedianFps);
            var displayNameFivePercentQuantileFps         = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.FivePercentQuantileFps);
            var displayNameOnePercentQuantileFps          = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.OnePercentQuantileFps);
            var displayNameOnePercentLowAverageFps        = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.OnePercentLowAverageFps);
            var displayNameZeroDotTwoPercentQuantileFps   = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.ZeroDotTwoPercentQuantileFps);
            var displayNameZeroDotOnePercentQuantileFps   = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.ZeroDotOnePercentQuantileFps);
            var displayNameZeroDotOnePercentLowAverageFps = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.ZeroDotOnePercentLowAverageFps);
            var displayNameMinFps         = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.MinFps);
            var displayNameAdaptiveSTDFps = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.AdaptiveSTDFps);
            var displayNameCpuFpsPerWatt  = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.CpuFpsPerWatt);
            //var displayNameGpuFpsPerWatt = ReflectionExtensions.GetPropertyDisplayName<ReportInfo>(x => x.GpuFpsPerWatt);
            var displayNameCustomComment = ReflectionExtensions.GetPropertyDisplayName <ReportInfo>(x => x.CustomComment);

            builder.Append(displayNameGame + "\t" +
                           displayNameResolution + "\t" +
                           displayNameDate + "\t" +
                           displayNameTime + "\t" +
                           displayNameNumberOfSamples + "\t" +
                           displayNameRecordTime + "\t" +
                           displayNameCpu + "\t" +
                           displayNameGraphicCard + "\t" +
                           displayNameRam + "\t" +
                           displayNameMaxFps + "\t" +
                           displayNameNinetyNinePercentQuantileFps + "\t" +
                           displayNameNinetyFivePercentQuantileFps + "\t" +
                           displayNameAverageFps + "\t" +
                           displayNameMedianFps + "\t" +
                           displayNameFivePercentQuantileFps + "\t" +
                           displayNameOnePercentQuantileFps + "\t" +
                           displayNameOnePercentLowAverageFps + "\t" +
                           displayNameZeroDotTwoPercentQuantileFps + "\t" +
                           displayNameZeroDotOnePercentQuantileFps + "\t" +
                           displayNameZeroDotOnePercentLowAverageFps + "\t" +
                           displayNameMinFps + "\t" +
                           displayNameAdaptiveSTDFps + "\t" +
                           displayNameCpuFpsPerWatt + "\t" +
                           //displayNameGpuFpsPerWatt + "\t" +
                           displayNameCustomComment +
                           Environment.NewLine);

            var cultureInfo = CultureInfo.CurrentCulture;

            foreach (var reportInfo in ReportInfoCollection)
            {
                builder.Append(reportInfo.Game + "\t" +
                               reportInfo.Resolution + "\t" +
                               reportInfo.Date.ToString(cultureInfo) + "\t" +
                               reportInfo.Time.ToString(cultureInfo) + "\t" +
                               reportInfo.NumberOfSamples + "\t" +
                               reportInfo.RecordTime.ToString(cultureInfo) + "\t" +
                               reportInfo.Cpu + "\t" +
                               reportInfo.GraphicCard + "\t" +
                               reportInfo.Ram + "\t" +
                               reportInfo.MaxFps.ToString(cultureInfo) + "\t" +
                               reportInfo.NinetyNinePercentQuantileFps.ToString(cultureInfo) + "\t" +
                               reportInfo.NinetyFivePercentQuantileFps.ToString(cultureInfo) + "\t" +
                               reportInfo.AverageFps.ToString(cultureInfo) + "\t" +
                               reportInfo.MedianFps.ToString(cultureInfo) + "\t" +
                               reportInfo.FivePercentQuantileFps.ToString(cultureInfo) + "\t" +
                               reportInfo.OnePercentQuantileFps.ToString(cultureInfo) + "\t" +
                               reportInfo.OnePercentLowAverageFps.ToString(cultureInfo) + "\t" +
                               reportInfo.ZeroDotTwoPercentQuantileFps.ToString(cultureInfo) + "\t" +
                               reportInfo.ZeroDotOnePercentQuantileFps.ToString(cultureInfo) + "\t" +
                               reportInfo.ZeroDotOnePercentLowAverageFps.ToString(cultureInfo) + "\t" +
                               reportInfo.MinFps.ToString(cultureInfo) + "\t" +
                               reportInfo.AdaptiveSTDFps.ToString(cultureInfo) + "\t" +
                               reportInfo.CpuFpsPerWatt.ToString(cultureInfo) + "\t" +
                               //reportInfo.GpuFpsPerWatt.ToString(cultureInfo) + "\t" +
                               reportInfo.CustomComment +
                               Environment.NewLine);
            }

            Clipboard.SetDataObject(builder.ToString(), false);
        }
Beispiel #7
0
 public void RemoveReportEntry(ReportInfo selectedItem)
 {
     ReportInfoCollection.Remove(selectedItem);
 }
Beispiel #8
0
 private void AddReportRecord(ReportInfo reportInfo)
 {
     ReportInfoCollection.Add(reportInfo);
 }
        public ReportViewModel(IStatisticProvider frametimeStatisticProvider,
                               IEventAggregator eventAggregator,
                               IAppConfiguration appConfiguration, RecordManager recordManager)
        {
            _frametimeStatisticProvider = frametimeStatisticProvider;
            _eventAggregator            = eventAggregator;
            _appConfiguration           = appConfiguration;
            _recordManager       = recordManager;
            CopyTableDataCommand = new DelegateCommand(OnCopyTableData);
            ReportInfoCollection.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                          ((sender, eventArg) => HasNoReportItems = !ReportInfoCollection.Any());

            SubscribeToSelectRecord();
        }