11// --------------------------------------------------------------------------------------------------------------------
22// <copyright file="MapListener.cs" company="MapWindow OSS Team - www.mapwindow.org">
3- // MapWindow OSS Team - 2015
3+ // MapWindow OSS Team - 2015 - 2017
44// </copyright>
55// <summary>
66// The map listener.
@@ -23,14 +23,14 @@ namespace MW5.Plugins.TemplatePlugin
2323 #endregion
2424
2525 /// <summary>
26- /// The map listener.
26+ /// The map listener.
2727 /// </summary>
2828 public class MapListener
2929 {
3030 #region Fields
3131
3232 /// <summary>
33- /// The context of the application, holding the menu, layers, project, etc.
33+ /// The context of the application, holding the menu, layers, project, etc.
3434 /// </summary>
3535 private readonly IAppContext _context ;
3636
@@ -44,33 +44,17 @@ public class MapListener
4444 #region Constructors and Destructors
4545
4646 /// <summary>
47- /// Initializes a new instance of the <see cref="MapListener"/> class.
47+ /// Initializes a new instance of the <see cref="MapListener" /> class.
4848 /// </summary>
49- /// <param name="context">
50- /// The application context.
51- /// </param>
52- /// <param name="plugin">
53- /// The plugin.
54- /// </param>
55- /// <param name="sampleDockWindow">
56- /// Reference to the sample dock window
57- /// </param>
49+ /// <param name="context">The application context.</param>
50+ /// <param name="plugin">The plugin.</param>
51+ /// <param name="sampleDockWindow">Reference to the sample dock window</param>
5852 public MapListener ( IAppContext context , InitPlugin plugin , SampleDockWindow sampleDockWindow )
5953 {
60- if ( context == null )
61- {
62- throw new ArgumentNullException ( "context" ) ;
63- }
64-
65- if ( plugin == null )
66- {
67- throw new ArgumentNullException ( "plugin" ) ;
68- }
69-
70- if ( sampleDockWindow == null )
71- {
72- throw new ArgumentNullException ( "sampleDockWindow" ) ;
73- }
54+ // Check input:
55+ if ( context == null ) throw new ArgumentNullException ( "context" ) ;
56+ if ( plugin == null ) throw new ArgumentNullException ( "plugin" ) ;
57+ if ( sampleDockWindow == null ) throw new ArgumentNullException ( "sampleDockWindow" ) ;
7458
7559 // Save local references:
7660 _context = context ;
@@ -80,9 +64,9 @@ public MapListener(IAppContext context, InitPlugin plugin, SampleDockWindow samp
8064 Debug . WriteLine ( "Number of loaded layers; " + _context . Layers . Count ) ;
8165
8266 // Create event handlers:
83- plugin . ExtentsChanged += this . PluginOnExtentsChanged ;
84- plugin . ChooseLayer += this . PluginOnChooseLayer ;
85- plugin . LayerSelected += this . PluginOnLayerSelected ;
67+ plugin . ExtentsChanged += PluginOnExtentsChanged ;
68+ plugin . ChooseLayer += PluginOnChooseLayer ;
69+ plugin . LayerSelected += PluginOnLayerSelected ;
8670 }
8771
8872 #endregion
@@ -92,12 +76,8 @@ public MapListener(IAppContext context, InitPlugin plugin, SampleDockWindow samp
9276 /// <summary>
9377 /// The plugin on choose layer.
9478 /// </summary>
95- /// <param name="map">
96- /// The map.
97- /// </param>
98- /// <param name="e">
99- /// The e.
100- /// </param>
79+ /// <param name="map">The map.</param>
80+ /// <param name="e">The ChooseLayer EventArgs.</param>
10181 private void PluginOnChooseLayer ( IMuteMap map , ChooseLayerEventArgs e )
10282 {
10383 if ( e . LayerHandle == - 1 )
@@ -113,12 +93,8 @@ private void PluginOnChooseLayer(IMuteMap map, ChooseLayerEventArgs e)
11393 /// <summary>
11494 /// The extents changed event handler
11595 /// </summary>
116- /// <param name="map">
117- /// The map.
118- /// </param>
119- /// <param name="e">
120- /// The event arguments
121- /// </param>
96+ /// <param name="map">The map.</param>
97+ /// <param name="e">The event arguments</param>
12298 private void PluginOnExtentsChanged ( IMuteMap map , EventArgs e )
12399 {
124100 _sampleDockWindow . Write ( "MapListener.PluginOnExtentsChanged" , map . Extents . ToString ( ) ) ;
@@ -127,20 +103,16 @@ private void PluginOnExtentsChanged(IMuteMap map, EventArgs e)
127103 /// <summary>
128104 /// The layer selected event handler
129105 /// </summary>
130- /// <param name="legend">
131- /// The legend.
132- /// </param>
133- /// <param name="e">
134- /// The layer event arguments
135- /// </param>
106+ /// <param name="legend">The legend.</param>
107+ /// <param name="e">The layer event arguments</param>
136108 private void PluginOnLayerSelected ( IMuteLegend legend , LayerEventArgs e )
137109 {
138110 if ( e . LayerHandle == - 1 )
139111 {
140112 return ;
141113 }
142114
143- string filename = _context . Layers . ItemByHandle ( e . LayerHandle ) . Filename ;
115+ var filename = _context . Layers . ItemByHandle ( e . LayerHandle ) . Filename ;
144116 if ( File . Exists ( filename ) )
145117 {
146118 filename = Path . GetFileName ( filename ) ;
0 commit comments