Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 10214 was 9456, checked in by swagner, 12 years ago

Updated copyright year and added some missing license headers (#1889)

File size: 3.1 KB
RevLine 
[5563]1#region License Information
2/* HeuristicLab
[9456]3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[5563]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
[5641]22using System;
[5563]23using System.Windows.Forms;
24using HeuristicLab.MainForm;
25using HeuristicLab.MainForm.WindowsForms;
[7558]26using HeuristicLab.Optimization.Views;
[5563]27
28namespace HeuristicLab.Problems.QuadraticAssignment.Views {
29  [View("Quadratic Assignment Problem View")]
30  [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)]
[7641]31  public sealed partial class QuadraticAssignmentProblemView : ProblemView {
[5563]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
[5641]41    protected override void RegisterContentEvents() {
42      base.RegisterContentEvents();
[5838]43      Content.DistancesParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged);
[5641]44      Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged);
45      Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
46    }
47
48    protected override void DeregisterContentEvents() {
[5838]49      Content.DistancesParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged);
[5641]50      Content.WeightsParameter.ValueChanged -= new EventHandler(WeightsParameter_ValueChanged);
51      Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
52      base.DeregisterContentEvents();
53    }
54
[8882]55    private void DistanceMatrixParameter_ValueChanged(object sender, EventArgs e) {
[5838]56      qapView.Distances = Content.Distances;
[5641]57    }
58
[8882]59    private void WeightsParameter_ValueChanged(object sender, EventArgs e) {
[5641]60      qapView.Weights = Content.Weights;
61    }
62
[8882]63    private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
[5641]64      qapView.Assignment = Content.BestKnownSolution;
65    }
66
[5563]67    protected override void OnContentChanged() {
68      base.OnContentChanged();
69      if (Content != null) {
[5838]70        qapView.Distances = Content.Distances;
[5641]71        qapView.Weights = Content.Weights;
72        qapView.Assignment = Content.BestKnownSolution;
73      } else {
74        qapView.Distances = null;
75        qapView.Weights = null;
76        qapView.Assignment = null;
[5563]77      }
78    }
79  }
[6952]80}
Note: See TracBrowser for help on using the repository browser.