Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs @ 13843

Last change on this file since 13843 was 13843, checked in by pfleck, 8 years ago

#2597 Implemented "sync" y-axis for Target Response Gradient View.

File size: 22.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2016 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.Collections.Generic;
24using System.Drawing;
25using System.Globalization;
26using System.Linq;
27using System.Threading;
28using System.Threading.Tasks;
29using System.Windows.Forms;
30using System.Windows.Forms.DataVisualization.Charting;
31using HeuristicLab.Common;
32using HeuristicLab.MainForm.WindowsForms;
33using HeuristicLab.Visualization.ChartControlsExtensions;
34
35namespace HeuristicLab.Problems.DataAnalysis.Views {
36  public partial class GradientChart : UserControl {
37    private ModifiableDataset sharedFixedVariables; // used for syncronising variable values between charts
38    private ModifiableDataset internalDataset; // holds the x values for each point drawn
39
40    private CancellationTokenSource cancelCurrentRecalculateSource;
41
42    private readonly List<IRegressionSolution> solutions;
43    private readonly Dictionary<IRegressionSolution, Series> seriesCache;
44    private readonly Dictionary<IRegressionSolution, Series> ciSeriesCache;
45
46    #region Properties
47    public bool ShowLegend {
48      get { return chart.Legends[0].Enabled; }
49      set { chart.Legends[0].Enabled = value; }
50    }
51    public bool ShowXAxisLabel {
52      get { return chart.ChartAreas[0].AxisX.Enabled == AxisEnabled.True; }
53      set { chart.ChartAreas[0].AxisX.Enabled = value ? AxisEnabled.True : AxisEnabled.False; }
54    }
55    public bool ShowYAxisLabel {
56      get { return chart.ChartAreas[0].AxisY.Enabled == AxisEnabled.True; }
57      set { chart.ChartAreas[0].AxisY.Enabled = value ? AxisEnabled.True : AxisEnabled.False; }
58    }
59    public bool ShowCursor {
60      get { return chart.Annotations[0].Visible; }
61      set { chart.Annotations[0].Visible = value; }
62    }
63
64    private int xAxisTicks = 5;
65    public int XAxisTicks {
66      get { return xAxisTicks; }
67      set {
68        if (value != xAxisTicks) {
69          xAxisTicks = value;
70          SetupAxis(chart.ChartAreas[0].AxisX, trainingMin, trainingMax, XAxisTicks, FixedXAxisMin, FixedXAxisMax);
71          RecalculateInternalDataset();
72        }
73      }
74    }
75    private double? fixedXAxisMin;
76    public double? FixedXAxisMin {
77      get { return fixedXAxisMin; }
78      set {
79        if ((value.HasValue && fixedXAxisMin.HasValue && !value.Value.IsAlmost(fixedXAxisMin.Value)) || (value.HasValue != fixedXAxisMin.HasValue)) {
80          fixedXAxisMin = value;
81          SetupAxis(chart.ChartAreas[0].AxisX, trainingMin, trainingMax, XAxisTicks, FixedXAxisMin, FixedXAxisMax);
82          RecalculateInternalDataset();
83        }
84      }
85    }
86    private double? fixedXAxisMax;
87    public double? FixedXAxisMax {
88      get { return fixedXAxisMax; }
89      set {
90        if ((value.HasValue && fixedXAxisMax.HasValue && !value.Value.IsAlmost(fixedXAxisMax.Value)) || (value.HasValue != fixedXAxisMax.HasValue)) {
91          fixedXAxisMax = value;
92          SetupAxis(chart.ChartAreas[0].AxisX, trainingMin, trainingMax, XAxisTicks, FixedXAxisMin, FixedXAxisMax);
93          RecalculateInternalDataset();
94        }
95      }
96    }
97
98    private int yAxisTicks = 5;
99    public int YAxisTicks {
100      get { return yAxisTicks; }
101      set {
102        if (value != yAxisTicks) {
103          yAxisTicks = value;
104          SetupAxis(chart.ChartAreas[0].AxisY, yMin, yMax, YAxisTicks, FixedYAxisMin, FixedYAxisMax);
105          RecalculateInternalDataset();
106        }
107      }
108    }
109    private double? fixedYAxisMin;
110    public double? FixedYAxisMin {
111      get { return fixedYAxisMin; }
112      set {
113        if ((value.HasValue && fixedYAxisMin.HasValue && !value.Value.IsAlmost(fixedYAxisMin.Value)) || (value.HasValue != fixedYAxisMin.HasValue)) {
114          fixedYAxisMin = value;
115          SetupAxis(chart.ChartAreas[0].AxisY, yMin, yMax, YAxisTicks, FixedYAxisMin, FixedYAxisMax);
116        }
117      }
118    }
119    private double? fixedYAxisMax;
120    public double? FixedYAxisMax {
121      get { return fixedYAxisMax; }
122      set {
123        if ((value.HasValue && fixedYAxisMax.HasValue && !value.Value.IsAlmost(fixedYAxisMax.Value)) || (value.HasValue != fixedYAxisMax.HasValue)) {
124          fixedYAxisMax = value;
125          SetupAxis(chart.ChartAreas[0].AxisY, yMin, yMax, YAxisTicks, FixedYAxisMin, FixedYAxisMax);
126        }
127      }
128    }
129
130    private double trainingMin = 1;
131    private double trainingMax = -1;
132
133    private int drawingSteps = 1000;
134    public int DrawingSteps {
135      get { return drawingSteps; }
136      set {
137        if (value != drawingSteps) {
138          drawingSteps = value;
139          RecalculateInternalDataset();
140          ResizeAllSeriesData();
141        }
142      }
143    }
144
145    private string freeVariable;
146    public string FreeVariable {
147      get { return freeVariable; }
148      set {
149        if (value == freeVariable) return;
150        if (solutions.Any(s => !s.ProblemData.Dataset.DoubleVariables.Contains(value))) {
151          throw new ArgumentException("Variable does not exist in the ProblemData of the Solutions.");
152        }
153        freeVariable = value;
154        RecalculateInternalDataset();
155      }
156    }
157
158    private double yMin;
159    public double YMin {
160      get { return yMin; }
161    }
162    private double yMax;
163    public double YMax {
164      get { return yMax; }
165    }
166
167    private VerticalLineAnnotation VerticalLineAnnotation {
168      get { return (VerticalLineAnnotation)chart.Annotations.SingleOrDefault(x => x is VerticalLineAnnotation); }
169    }
170    #endregion
171
172    public GradientChart() {
173      InitializeComponent();
174
175      solutions = new List<IRegressionSolution>();
176      seriesCache = new Dictionary<IRegressionSolution, Series>();
177      ciSeriesCache = new Dictionary<IRegressionSolution, Series>();
178
179      // Configure axis
180      chart.CustomizeAllChartAreas();
181      chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
182      chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
183      chart.ChartAreas[0].CursorX.Interval = 0;
184
185      chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
186      chart.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
187      chart.ChartAreas[0].CursorY.Interval = 0;
188
189      Disposed += GradientChart_Disposed;
190    }
191    private void GradientChart_Disposed(object sender, EventArgs e) {
192      if (cancelCurrentRecalculateSource != null)
193        cancelCurrentRecalculateSource.Cancel();
194    }
195
196    public void Configure(IEnumerable<IRegressionSolution> solutions, ModifiableDataset sharedFixedVariables, string freeVariable, int drawingSteps, bool initializeAxisRanges = true) {
197      if (!SolutionsCompatible(solutions))
198        throw new ArgumentException("Solutions are not compatible with the problem data.");
199      this.freeVariable = freeVariable;
200      this.drawingSteps = drawingSteps;
201
202      this.solutions.Clear();
203      this.solutions.AddRange(solutions);
204
205      // add an event such that whenever a value is changed in the shared dataset,
206      // this change is reflected in the internal dataset (where the value becomes a whole column)
207      if (this.sharedFixedVariables != null)
208        this.sharedFixedVariables.ItemChanged -= sharedFixedVariables_ItemChanged;
209      this.sharedFixedVariables = sharedFixedVariables;
210      this.sharedFixedVariables.ItemChanged += sharedFixedVariables_ItemChanged;
211
212      RecalculateTrainingLimits(initializeAxisRanges);
213      RecalculateInternalDataset();
214
215      chart.Series.Clear();
216      seriesCache.Clear();
217      ciSeriesCache.Clear();
218      foreach (var solution in this.solutions) {
219        var series = CreateSeries(solution);
220        seriesCache.Add(solution, series.Item1);
221        if (series.Item2 != null)
222          ciSeriesCache.Add(solution, series.Item2);
223      }
224
225      ResizeAllSeriesData();
226      OrderAndColorSeries();
227    }
228
229    public async Task RecalculateAsync(bool updateOnFinish = true, bool resetYAxis = true) {
230      if (IsDisposed
231        || sharedFixedVariables == null || !solutions.Any() || string.IsNullOrEmpty(freeVariable)
232        || trainingMin.IsAlmost(trainingMax) || trainingMin > trainingMax || drawingSteps == 0)
233        return;
234
235      statusLabel.Visible = true;
236      Update(); // immediately show label
237
238      // cancel previous recalculate call
239      if (cancelCurrentRecalculateSource != null)
240        cancelCurrentRecalculateSource.Cancel();
241      cancelCurrentRecalculateSource = new CancellationTokenSource();
242
243      // Set cursor and x-axis
244      var defaultValue = sharedFixedVariables.GetDoubleValue(freeVariable, 0);
245      VerticalLineAnnotation.X = defaultValue;
246      chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture);
247
248      // Update series
249      var cancellationToken = cancelCurrentRecalculateSource.Token;
250      try {
251        var limits = await UpdateAllSeriesDataAsync(cancellationToken);
252        //cancellationToken.ThrowIfCancellationRequested();
253
254        yMin = limits.Lower;
255        yMax = limits.Upper;
256        // Set y-axis
257        if (resetYAxis)
258          SetupAxis(chart.ChartAreas[0].AxisY, yMin, yMax, YAxisTicks, FixedYAxisMin, FixedYAxisMax);
259
260        UpdateOutOfTrainingRangeStripLines();
261
262        statusLabel.Visible = false;
263        if (updateOnFinish)
264          Update();
265      }
266      catch (OperationCanceledException) { }
267      catch (AggregateException ae) {
268        if (!ae.InnerExceptions.Any(e => e is OperationCanceledException))
269          throw;
270      }
271    }
272
273    private void SetupAxis(Axis axis, double minValue, double maxValue, int ticks, double? fixedAxisMin, double? fixedAxisMax) {
274      double axisMin, axisMax, axisInterval;
275      ChartUtil.CalculateAxisInterval(minValue, maxValue, ticks, out axisMin, out axisMax, out axisInterval);
276      axis.Minimum = fixedAxisMin ?? axisMin;
277      axis.Maximum = fixedAxisMax ?? axisMax;
278      axis.Interval = (axis.Maximum - axis.Minimum) / ticks;
279
280      chart.ChartAreas[0].RecalculateAxesScale();
281    }
282
283    private void RecalculateTrainingLimits(bool initializeAxisRanges) {
284      trainingMin = solutions.Select(s => s.ProblemData.Dataset.GetDoubleValues(freeVariable, s.ProblemData.TrainingIndices).Min()).Max();
285      trainingMax = solutions.Select(s => s.ProblemData.Dataset.GetDoubleValues(freeVariable, s.ProblemData.TrainingIndices).Max()).Min();
286
287      if (initializeAxisRanges) {
288        double xmin, xmax, xinterval;
289        ChartUtil.CalculateAxisInterval(trainingMin, trainingMax, XAxisTicks, out xmin, out xmax, out xinterval);
290        FixedXAxisMin = xmin;
291        FixedXAxisMax = xmax;
292      }
293    }
294
295    private void RecalculateInternalDataset() {
296      if (sharedFixedVariables == null)
297        return;
298
299      // we expand the range in order to get nice tick intervals on the x axis
300      double xmin, xmax, xinterval;
301      ChartUtil.CalculateAxisInterval(trainingMin, trainingMax, XAxisTicks, out xmin, out xmax, out xinterval);
302
303      if (FixedXAxisMin.HasValue) xmin = FixedXAxisMin.Value;
304      if (FixedXAxisMax.HasValue) xmax = FixedXAxisMax.Value;
305      double step = (xmax - xmin) / drawingSteps;
306
307      var xvalues = new List<double>();
308      for (int i = 0; i < drawingSteps; i++)
309        xvalues.Add(xmin + i * step);
310
311      var variables = sharedFixedVariables.DoubleVariables.ToList();
312      internalDataset = new ModifiableDataset(variables,
313        variables.Select(x => x == FreeVariable
314          ? xvalues
315          : Enumerable.Repeat(sharedFixedVariables.GetDoubleValue(x, 0), xvalues.Count).ToList()
316        )
317      );
318    }
319
320    private Tuple<Series, Series> CreateSeries(IRegressionSolution solution) {
321      var series = new Series {
322        ChartType = SeriesChartType.Line,
323        Name = solution.ProblemData.TargetVariable + " " + solutions.IndexOf(solution)
324      };
325      series.LegendText = series.Name;
326
327      var confidenceBoundSolution = solution as IConfidenceBoundRegressionSolution;
328      Series confidenceIntervalSeries = null;
329      if (confidenceBoundSolution != null) {
330        confidenceIntervalSeries = new Series {
331          ChartType = SeriesChartType.Range,
332          YValuesPerPoint = 2,
333          Name = "95% Conf. Interval " + series.Name,
334          IsVisibleInLegend = false
335        };
336      }
337      return Tuple.Create(series, confidenceIntervalSeries);
338    }
339
340    private void OrderAndColorSeries() {
341      chart.SuspendRepaint();
342
343      chart.Series.Clear();
344      // Add mean series for applying palette colors
345      foreach (var solution in solutions) {
346        chart.Series.Add(seriesCache[solution]);
347      }
348
349      chart.Palette = ChartColorPalette.BrightPastel;
350      chart.ApplyPaletteColors();
351      chart.Palette = ChartColorPalette.None;
352
353      // Add confidence interval series before its coresponding series for correct z index
354      foreach (var solution in solutions) {
355        Series ciSeries;
356        if (ciSeriesCache.TryGetValue(solution, out ciSeries)) {
357          var series = seriesCache[solution];
358          ciSeries.Color =  Color.FromArgb(40, series.Color);
359          int idx = chart.Series.IndexOf(seriesCache[solution]);
360          chart.Series.Insert(idx, ciSeries);
361        }
362      }
363
364      chart.ResumeRepaint(true);
365    }
366
367    private async Task<DoubleLimit> UpdateAllSeriesDataAsync(CancellationToken cancellationToken) {
368      var updateTasks = solutions.Select(solution => UpdateSeriesDataAsync(solution, cancellationToken));
369
370      double min = double.MaxValue, max = double.MinValue;
371      foreach (var update in updateTasks) {
372        var limit = await update;
373        if (limit.Lower < min) min = limit.Lower;
374        if (limit.Upper > max) max = limit.Upper;
375      }
376
377      return new DoubleLimit(min, max);
378    }
379
380    private Task<DoubleLimit> UpdateSeriesDataAsync(IRegressionSolution solution, CancellationToken cancellationToken) {
381      return Task.Run(() => {
382        var xvalues = internalDataset.GetDoubleValues(FreeVariable).ToList();
383        var yvalues = solution.Model.GetEstimatedValues(internalDataset, Enumerable.Range(0, internalDataset.Rows)).ToList();
384
385        double min = double.MaxValue, max = double.MinValue;
386
387        var series = seriesCache[solution];
388        for (int i = 0; i < xvalues.Count; i++) {
389          series.Points[i].SetValueXY(xvalues[i], yvalues[i]);
390          if (yvalues[i] < min) min = yvalues[i];
391          if (yvalues[i] > max) max = yvalues[i];
392        }
393
394        var confidenceBoundSolution = solution as IConfidenceBoundRegressionSolution;
395        if (confidenceBoundSolution != null) {
396          var confidenceIntervalSeries = ciSeriesCache[solution];
397
398          cancellationToken.ThrowIfCancellationRequested();
399          var variances =
400            confidenceBoundSolution.Model.GetEstimatedVariances(internalDataset,
401              Enumerable.Range(0, internalDataset.Rows)).ToList();
402          for (int i = 0; i < xvalues.Count; i++) {
403            var lower = yvalues[i] - 1.96 * Math.Sqrt(variances[i]);
404            var upper = yvalues[i] + 1.96 * Math.Sqrt(variances[i]);
405            confidenceIntervalSeries.Points[i].SetValueXY(xvalues[i], lower, upper);
406            if (lower < min) min = lower;
407            if (upper > max) max = upper;
408          }
409        }
410
411        cancellationToken.ThrowIfCancellationRequested();
412        return new DoubleLimit(min, max);
413      }, cancellationToken);
414    }
415
416    private void ResizeAllSeriesData() {
417      if (internalDataset == null)
418        return;
419
420      var xvalues = internalDataset.GetDoubleValues(FreeVariable).ToList();
421      foreach (var solution in solutions)
422        ResizeSeriesData(solution, xvalues);
423    }
424    private void ResizeSeriesData(IRegressionSolution solution, IList<double> xvalues = null) {
425      if (xvalues == null)
426        xvalues = internalDataset.GetDoubleValues(FreeVariable).ToList();
427
428      var series = seriesCache[solution];
429      series.Points.SuspendUpdates();
430      for (int i = 0; i < xvalues.Count; i++)
431        series.Points.Add(new DataPoint(xvalues[i], 0.0));
432      series.Points.ResumeUpdates();
433
434      Series confidenceIntervalSeries;
435      if (ciSeriesCache.TryGetValue(solution, out confidenceIntervalSeries)) {
436        confidenceIntervalSeries.Points.SuspendUpdates();
437        for (int i = 0; i < xvalues.Count; i++)
438          confidenceIntervalSeries.Points.Add(new DataPoint(xvalues[i], new[] { -1.0, 1.0 }));
439        confidenceIntervalSeries.Points.ResumeUpdates();
440      }
441    }
442
443    public async Task AddSolutionAsync(IRegressionSolution solution) {
444      if (!SolutionsCompatible(solutions.Concat(new[] { solution })))
445        throw new ArgumentException("The solution is not compatible with the problem data.");
446      if (solutions.Contains(solution))
447        return;
448
449      solutions.Add(solution);
450      RecalculateTrainingLimits(true);
451
452      var series = CreateSeries(solution);
453      seriesCache.Add(solution, series.Item1);
454      if (series.Item2 != null)
455        ciSeriesCache.Add(solution, series.Item2);
456
457      ResizeSeriesData(solution);
458      OrderAndColorSeries();
459
460      await RecalculateAsync();
461    }
462    public async Task RemoveSolutionAsync(IRegressionSolution solution) {
463      if (!solutions.Remove(solution))
464        return;
465
466      RecalculateTrainingLimits(true);
467
468      seriesCache.Remove(solution);
469      ciSeriesCache.Remove(solution);
470
471      await RecalculateAsync();
472    }
473
474    private static bool SolutionsCompatible(IEnumerable<IRegressionSolution> solutions) {
475      foreach (var solution1 in solutions) {
476        var variables1 = solution1.ProblemData.Dataset.DoubleVariables;
477        foreach (var solution2 in solutions) {
478          if (solution1 == solution2)
479            continue;
480          var variables2 = solution2.ProblemData.Dataset.DoubleVariables;
481          if (!variables1.All(variables2.Contains))
482            return false;
483        }
484      }
485      return true;
486    }
487
488    private void UpdateOutOfTrainingRangeStripLines() {
489      var axisX = chart.ChartAreas[0].AxisX;
490      var lowerStripLine = axisX.StripLines[0];
491      var upperStripLine = axisX.StripLines[1];
492
493      lowerStripLine.IntervalOffset = axisX.Minimum;
494      lowerStripLine.StripWidth = trainingMin - axisX.Minimum;
495
496      upperStripLine.IntervalOffset = trainingMax;
497      upperStripLine.StripWidth = axisX.Maximum - trainingMax;
498    }
499
500    #region Events
501    public event EventHandler VariableValueChanged;
502    public void OnVariableValueChanged(object sender, EventArgs args) {
503      var changed = VariableValueChanged;
504      if (changed == null) return;
505      changed(sender, args);
506    }
507
508    private void sharedFixedVariables_ItemChanged(object o, EventArgs<int, int> e) {
509      if (o != sharedFixedVariables) return;
510      var variables = sharedFixedVariables.DoubleVariables.ToList();
511      var rowIndex = e.Value;
512      var columnIndex = e.Value2;
513
514      var variableName = variables[columnIndex];
515      if (variableName == FreeVariable) return;
516      var v = sharedFixedVariables.GetDoubleValue(variableName, rowIndex);
517      var values = new List<double>(Enumerable.Repeat(v, DrawingSteps));
518      internalDataset.ReplaceVariable(variableName, values);
519    }
520
521    private double oldCurserPosition = double.NaN;
522    private void chart_AnnotationPositionChanging(object sender, AnnotationPositionChangingEventArgs e) {
523      if (oldCurserPosition.IsAlmost(e.NewLocationX))
524        return;
525      oldCurserPosition = e.NewLocationX;
526
527      var step = (trainingMax - trainingMin) / drawingSteps;
528      e.NewLocationX = step * (long)Math.Round(e.NewLocationX / step);
529      var axisX = chart.ChartAreas[0].AxisX;
530      if (e.NewLocationX > axisX.Maximum)
531        e.NewLocationX = axisX.Maximum;
532      if (e.NewLocationX < axisX.Minimum)
533        e.NewLocationX = axisX.Minimum;
534
535      var annotation = VerticalLineAnnotation;
536      var x = annotation.X;
537      sharedFixedVariables.SetVariableValue(x, FreeVariable, 0);
538
539      chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);
540      chart.Update();
541
542      OnVariableValueChanged(this, EventArgs.Empty);
543    }
544
545    private void chart_MouseMove(object sender, MouseEventArgs e) {
546      bool hitCursor = chart.HitTest(e.X, e.Y).ChartElementType == ChartElementType.Annotation;
547      chart.Cursor = hitCursor ? Cursors.VSplit : Cursors.Default;
548    }
549
550    private void chart_FormatNumber(object sender, FormatNumberEventArgs e) {
551      if (e.ElementType == ChartElementType.AxisLabels) {
552        switch (e.Format) {
553          case "CustomAxisXFormat":
554            break;
555          case "CustomAxisYFormat":
556            var v = e.Value;
557            e.LocalizedValue = string.Format("{0,5}", v);
558            break;
559          default:
560            break;
561        }
562      }
563    }
564
565    private void chart_DragDrop(object sender, DragEventArgs e) {
566      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
567      if (data != null) {
568        var solution = data as IRegressionSolution;
569        if (!solutions.Contains(solution))
570          AddSolutionAsync(solution);
571      }
572    }
573    private void chart_DragEnter(object sender, DragEventArgs e) {
574      if (!e.Data.GetDataPresent(HeuristicLab.Common.Constants.DragDropDataFormat)) return;
575      e.Effect = DragDropEffects.None;
576
577      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
578      var regressionSolution = data as IRegressionSolution;
579      if (regressionSolution != null) {
580        e.Effect = DragDropEffects.Copy;
581      }
582    }
583    #endregion
584  }
585}
Note: See TracBrowser for help on using the repository browser.