Exemplo n.º 1
0
        private void LoadData(BenchmarksModel model)
        {
            var(location, size) = WindowPosition.Normalize(this, model.FormLocation, model.FormSize);

            Location         = location;
            LocationChanged += (s, e) => model.FormLocation = WindowState == FormWindowState.Normal ? Location : RestoreBounds.Location;
            Size             = size;
            SizeChanged     += (s, e) => model.FormSize = WindowState == FormWindowState.Normal ? Size : RestoreBounds.Size;

            cboClients.BindSelectedValue(model, nameof(BenchmarksModel.SelectedSlotIdentifier));
            cboClients.DataSource    = model.SlotIdentifiers;
            cboClients.DisplayMember = nameof(ListItem.DisplayMember);
            cboClients.ValueMember   = nameof(ListItem.ValueMember);

            picDeleteClient.BindVisible(model, nameof(BenchmarksModel.SelectedSlotDeleteEnabled));

            ProjectIDTextBox.BindText(model, nameof(BenchmarksModel.WorkUnitName));
            CreditTextBox.BindText(model, nameof(BenchmarksModel.Credit));
            KFactorTextBox.BindText(model, nameof(BenchmarksModel.KFactor));
            FramesTextBox.BindText(model, nameof(BenchmarksModel.Frames));
            AtomsTextBox.BindText(model, nameof(BenchmarksModel.NumberOfAtoms));
            CoreTextBox.BindText(model, nameof(BenchmarksModel.Core));
            DescriptionLinkLabel.Text = "Click to view online";
            DescriptionLinkLabel.DataBindings.Add(nameof(Tag), model, nameof(BenchmarksModel.DescriptionUrl), false, DataSourceUpdateMode.OnPropertyChanged);
            TimeoutTextBox.BindText(model, nameof(BenchmarksModel.PreferredDays));
            ExpirationTextBox.BindText(model, nameof(BenchmarksModel.MaximumDays));
            ContactTextBox.BindText(model, nameof(BenchmarksModel.Contact));
            WorkServerTextBox.BindText(model, nameof(BenchmarksModel.ServerIP));

            model.PropertyChanged += (s, e) => ModelPropertyChanged((BenchmarksModel)s, e);
            model.SelectedSlotProjectListItems = new ListBoxSelectedListItemCollection(projectsListBox);
            projectsListBox.DataSource         = model.SlotProjects;
            projectsListBox.DisplayMember      = nameof(ListItem.DisplayMember);
            projectsListBox.ValueMember        = nameof(ListItem.ValueMember);
            model.SetDefaultSlotProject();

            lstColors.DataSource    = model.GraphColors;
            lstColors.DisplayMember = nameof(ListItem.DisplayMember);
            lstColors.ValueMember   = nameof(ListItem.ValueMember);
            lstColors.BindSelectedValue(model, nameof(BenchmarksModel.SelectedGraphColorItem));

            colorPreviewPictureBox.DataBindings.Add(nameof(PictureBox.BackColor), model, nameof(BenchmarksModel.SelectedGraphColor), false, DataSourceUpdateMode.OnPropertyChanged);
        }
Exemplo n.º 2
0
        private void ModelPropertyChanged(BenchmarksModel model, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case nameof(BenchmarksModel.BenchmarkText):
                LoadBenchmarkText(model);
                break;

            case nameof(BenchmarksModel.FrameTimeGraphControl):
                LoadFrameTimeGraphControl(model);
                break;

            case nameof(BenchmarksModel.ProductionGraphControl):
                LoadProductionGraphControl(model);
                break;

            case nameof(BenchmarksModel.ProjectComparisonGraphControl):
                LoadProjectComparisonGraphControl(model);
                break;
            }
        }
Exemplo n.º 3
0
 public MockFormBenchmarksPresenter(BenchmarksModel model, MessageBoxPresenter messageBox) : base(model, null, messageBox)
 {
 }
Exemplo n.º 4
0
 public MockFormBenchmarksPresenter(BenchmarksModel model) : base(model, null, null)
 {
 }
Exemplo n.º 5
0
 private void LoadBenchmarkText(BenchmarksModel model)
 {
     txtBenchmarks.Lines = model.BenchmarkText?.ToArray() ?? Array.Empty <string>();
 }
Exemplo n.º 6
0
 private void LoadProjectComparisonGraphControl(BenchmarksModel model)
 {
     LoadGraphControl(projectComparisonGraphTab, model.ProjectComparisonGraphControl);
 }
Exemplo n.º 7
0
 private void LoadProductionGraphControl(BenchmarksModel model)
 {
     LoadGraphControl(productionGraphTab, model.ProductionGraphControl);
 }
Exemplo n.º 8
0
 private void LoadFrameTimeGraphControl(BenchmarksModel model)
 {
     LoadGraphControl(frameTimeGraphTab, model.FrameTimeGraphControl);
 }