Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs @ 17343

Last change on this file since 17343 was 17180, checked in by swagner, 5 years ago

#2875: Removed years in copyrights

File size: 3.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Windows.Forms;
24using HeuristicLab.MainForm;
25using HeuristicLab.MainForm.WindowsForms;
26using HeuristicLab.Optimization.Views;
27
28namespace HeuristicLab.Problems.QuadraticAssignment.Views {
29  [View("Quadratic Assignment Problem View")]
30  [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)]
31  public sealed partial class QuadraticAssignmentProblemView : ProblemView {
32    public new QuadraticAssignmentProblem Content {
33      get { return (QuadraticAssignmentProblem)base.Content; }
34      set { base.Content = value; }
35    }
36
37    public QuadraticAssignmentProblemView() {
38      InitializeComponent();
39    }
40
41    protected override void RegisterContentEvents() {
42      base.RegisterContentEvents();
43      Content.DistancesParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged);
44      Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged);
45      Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
46    }
47
48    protected override void DeregisterContentEvents() {
49      Content.DistancesParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged);
50      Content.WeightsParameter.ValueChanged -= new EventHandler(WeightsParameter_ValueChanged);
51      Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
52      base.DeregisterContentEvents();
53    }
54
55    private void DistanceMatrixParameter_ValueChanged(object sender, EventArgs e) {
56      qapView.Distances = Content.Distances;
57    }
58
59    private void WeightsParameter_ValueChanged(object sender, EventArgs e) {
60      qapView.Weights = Content.Weights;
61    }
62
63    private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
64      qapView.Assignment = Content.BestKnownSolution;
65    }
66
67    protected override void OnContentChanged() {
68      base.OnContentChanged();
69      if (Content != null) {
70        qapView.Distances = Content.Distances;
71        qapView.Weights = Content.Weights;
72        qapView.Assignment = Content.BestKnownSolution;
73      } else {
74        qapView.Distances = null;
75        qapView.Weights = null;
76        qapView.Assignment = null;
77      }
78    }
79  }
80}
Note: See TracBrowser for help on using the repository browser.