private BenchmarkResultDto DbEntityToModel([NotNull] Result entity) { var result = new BenchmarkResultDto() { Id = entity.Id, BenchmarkId = entity.BenchmarkId, Browser = entity.Browser, DevicePlatform = entity.DevicePlatform, OS = entity.OperatingSystem, RawUserAgenString = entity.RawUastring, UserId = entity.UserId, ResultRows = new List <ResultsRowModel>(), WhenCreated = entity.Created }; foreach (var row in entity.ResultRow) { var rowModel = new ResultsRowModel() { ExecutionsPerSecond = row.ExecutionsPerSecond, NumberOfSamples = row.NumberOfSamples, RelativeMarginOfError = row.RelativeMarginOfError, TestName = row.TestName }; result.ResultRows.Add(rowModel); } return(result); }
protected void SetModel(object sender, DependencyPropertyChangedEventArgs e) { _model = DataContext as ResultsRowModel; Initialise(); }
/// <summary> /// Add a standard data row /// </summary> /// <param name="rowNumber"></param> protected virtual void BuildRow(ResultsRowModel row, ref double top, double rowWidth, Color backgroundColor) { double widthSoFar = 0; Control editor = GetEditorForObject(row); editor.Width = RowHeaderWidth; SetChild(editor, top, widthSoFar); widthSoFar += RowHeaderWidth + HorizontalSpacing; Canvas background = new Canvas() { Width = rowWidth, Height = row.Height, Background = new SolidColorBrush(backgroundColor) }; SetChild(background, top, widthSoFar); for (int i = 0; i < _model.Columns.Length; i++) { ResultsCellModel cellModel = row.GetCellForColumn(i, _model.Columns[i]); _model.Cells.Add(cellModel); editor = GetEditorForObject(cellModel); SetChild(editor, top, widthSoFar); widthSoFar += _model.Columns[i].Width + HorizontalSpacing; } top += row.Height + VerticalSpacing; }