public void Startup(ref object initializationData)
        {
            _application = initializationData as IApplication;
            if (_application == null) return;

            ArcMapAppHelperClass.GetValidWorkspaces(out _validWorkspaces);
            ArcMapAppHelperClass.GetTypeMaps(out _sqlPredicates, out _typeMapSystemToSql, out _typeMapSQLToSystem);
            _hluLayerStructure = new HluGISLayer.incid_mm_polygonsDataTable();

            SetupDocumentEvents(_application.Document);

            if (PipeManager == null)
            {
                _pipeName = String.Format("{0}.{1}", ArcMapApp.PipeBaseName, _application.hWnd);
                PipeManager = new PipeManager();
                PipeManager.Initialize(_pipeName, _pipeMaxReadBytes);
                PipeManager.IncomingDataReady += new EventHandler(_pipeManager_IncomingDataReady);

                _dummyControl = new System.Windows.Forms.Control();
                _dummyControl.CreateControl();

                _pipeSelDel = new PipeSelectionDelegate(PipeSelection);
                _selectedRowsUniqueDel = new SelectedRowsUniqueDelegate(SelectedRowsUnique);
                _flashSelFeatDel = new FlashSelectedFeatureDelegate(FlashFeature);
                _splitFeatDel = new SplitFeatureDelegate(SplitFeature);
                _splitFeatLogDel = new SplitFeaturesLogicallyDelegate(SplitFeaturesLogically);
                _mergeFeatDel = new MergeFeaturesDelegate(MergeFeatures);
                _mergeFeatLogDel = new MergeFeaturesLogicallyDelegate(MergeFeaturesLogically);
                _updAttsDel = new UpdateAttributesDelegate(UpdateAttributes);
                _updAttsSelDel = new UpdateAttributesSelectionDelegate(UpdateAttributes);
                _updAttsBulkDel = new UpdateAttributesBulkDelegate(UpdateAttributes);
                _selByQDefDel = new SelectByQueryDefDelegate(SelectByQueryDef);
                _selByQFilterDel = new SelectByQueryFilterDelegate(SelectByQueryFilter);
                _selByJoinDel = new SelectByJoinDelegate(SelectByJoin);
                _zoomSelDel = new ZoomSelectedDelegate(ZoomSelected);
                _zoomSelCursorDel = new ZoomSelectedCursorDelegate(ZoomSelectedCursor);
                _exportDel = new ExportDelegate(Export);
                _isHluWorkspaceDel = new IsHluWorkspaceDelegate(IsHluWorkspace);
                _ListHluLayersDel = new ListHluLayersDelegate(ListHluLayers);
                _isHluLayerDel = new IsHluLayerDelegate(IsHluLayer);
                _isEditingDel = new IsEditingDelegate(IsEditing);
            }
        }
        public void Shutdown()
        {
            _hluLayer = null;
            _hluFeatureClass = null;
            _hluFeatureSelection = null;
            _hluWS = null;
            _hluSqlSyntax = null;
            _hluView = null;
            _hluFieldMap = null;
            _hluFieldNames = null;
            _hluUidFieldOrdinals = null;
            _selectFieldOrdinals = null;

            _pipeSelDel = null;
            _selectedRowsUniqueDel = null;
            _flashSelFeatDel = null;
            _splitFeatDel = null;
            _splitFeatLogDel = null;
            _mergeFeatDel = null;
            _mergeFeatLogDel = null;
            _updAttsDel = null;
            _updAttsSelDel = null;
            _updAttsBulkDel = null;
            _selByQDefDel = null;
            _selByQFilterDel = null;
            _selByJoinDel = null;
            _zoomSelDel = null;
            _zoomSelCursorDel = null;
            _exportDel = null;
            _isHluWorkspaceDel = null;
            _ListHluLayersDel = null;
            _isHluLayerDel = null;
            _isEditingDel = null;

            if (PipeManager != null)
            {
                PipeManager = null;
            }

            RemoveActiveViewEvents(_focusMap);
        }