public void ToolsBenchmarksClick() { int projectId = 0; // Check for SelectedSlot, and if found... load its ProjectID. if (_gridModel.SelectedSlot != null) { projectId = _gridModel.SelectedSlot.UnitInfo.ProjectID; } var benchmarksView = _viewFactory.GetBenchmarksForm(); benchmarksView.Closed += (s, e) => _viewFactory.Release(benchmarksView); benchmarksView.ProjectId = projectId; // Restore state data var location = _prefs.Get <Point>(Preference.BenchmarksFormLocation); var size = _prefs.Get <Size>(Preference.BenchmarksFormSize); location = WindowPosition.Normalize(location, size); if (location.X != 0 && location.Y != 0) { benchmarksView.Location = location; } else { benchmarksView.Location = WindowPosition.CenterOnPrimaryScreen(size); } if (size.Width != 0 && size.Height != 0) { benchmarksView.Size = size; } benchmarksView.Show(); }