Beispiel #1
0
        /// <summary>
        ///   Initializes a new instance of the MainForm class
        /// </summary>
        /// <param name = "app">The reference to the MapWindow map object.</param>
        public MainForm(AppManager app)
            : this()
        {
            this._App = app;

            _layerManager = app.Map.GetLayerManager();
            _layerManager.ActiveLayerChanged += new EventHandler(LayerManager_ActiveLayerChanged);

            _Filter                   = new FeatureLayerDisplayFilter(_App.Map, gridView1);
            _PersistLayout            = new PersistLayoutInMemory(_App.Map, gridView1);
            _SelectionSynchronization = new SelectionSynchronization(_App.Map, gridView1);
            _PreventFirstRowSelection = new PreventFirstRowSelection(gridView1);
            _ShowNoDataMessage        = new ShowMessageWhenDataSourceIsNull(gridView1);

            // When a project is opened the map looses all of its events so we re wireup
            app.SerializationManager.Deserializing += OnDeserializingProject;

            // If we are started after the application has been running, we want to show the selected layer.
            RefreshData(_layerManager.ActiveLayer);
        }
Beispiel #2
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }

                _layerManager.ActiveLayerChanged        -= LayerManager_ActiveLayerChanged;
                _App.SerializationManager.Deserializing -= OnDeserializingProject;
                _SelectionSynchronization = null;
                _Filter.ShowAllFeatures();
                _Filter                   = null;
                _PersistLayout            = null;
                _PreventFirstRowSelection = null;
                LayerManagerExt.ClearCache();
            }

            base.Dispose(disposing);
        }