Esempio n. 1
0
        public override void OnCreate(object hook)
        {
            try
            {
                if (hook != null)
                {
                    //m_pHookHelper.Hook = hook;

                    if (hook is IMxApplication)
                    {
                        // create / access core AO variables.
                        m_app = (IApplication)hook;
                        //m_pMxDoc = (IMxDocument)m_app.Document;

                        UID pUID;
                        pUID = new UIDClass();

                        pUID.Value = "esriEditor.Editor";
                        m_pEditor = (IEditor)m_app.FindExtensionByCLSID(pUID);

                        //the code in extension enabled block was here...
                        // Create delegate instances of editor events
                        m_OnStartEditing = new IEditEvents_OnStartEditingEventHandler(OnStartEditing_Handler);
                        m_OnStopEditing = new IEditEvents_OnStopEditingEventHandler(OnStopEditing_Handler);
                        m_OnCurrentLayerChanged = new IEditEvents_OnCurrentLayerChangedEventHandler(OnCurrentLayerChanged_Hander);

                        //add delgates to the appropriate events to enable listening
                        ((IEditEvents_Event)m_pEditor).OnStartEditing += m_OnStartEditing;
                        ((IEditEvents_Event)m_pEditor).OnStopEditing += m_OnStopEditing;
                        ((IEditEvents_Event)m_pEditor).OnCurrentLayerChanged += m_OnCurrentLayerChanged;

                        m_frmSourceLayer.cboSourceLayer.SelectedIndexChanged += new System.EventHandler(cboSourceLayer_SelectedIndexChanged);

                        try
                        {
                            m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName("SUITT Extension");
                        }
                        catch
                        {
                            throw new Exception("Could not access SUITT Extension.");
                        }
                    }
                }
            }
            catch(Exception ex)
            {
                Debug.WriteLine(ex.Message + "\n" + ex.StackTrace);
                util.Logger.Write(" Descrip  : Creating Source Layer dropdown combo box command tool class. " +
                    "\n Message  : " + ex.Message +
                    "\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);
            }
        }
Esempio n. 2
0
        // form constructor -> sets some class level variables and an editing event listener
        public CreateBusinessFeaturesForm(IApplication pApp)
        {
            try
            {
                InitializeComponent();
                m_pApp = pApp;

                UID pUID;
                pUID = new UIDClass();

                pUID.Value = "esriEditor.Editor";
                m_pEditor = (IEditor)m_pApp.FindExtensionByCLSID(pUID);

                //try
                //{
                //    m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_pApp.FindExtensionByName("SUITT Extension");
                //    this.ISDUTschema =  m_pISDUTExt.get_SystemValue("db.isdut.schema") + ".";

                //    if (m_pISDUTExt.TransactionManager.Current().OperationalDatasetName.ToUpper() == "TANT")
                //    {
                //        this.OSDBschema = m_pISDUTExt.get_SystemValue("db.tant.schema") + ".";
                //    }
                //    else if(m_pISDUTExt.TransactionManager.Current().OperationalDatasetName.ToUpper() == "FADM")
                //    {
                //        this.OSDBschema =  m_pISDUTExt.get_SystemValue("db.fadm.schema") + ".";
                //    }
                //}
                //catch
                //{}

                //try
                //{
                //    m_pISDUTExt.ISDUTState_Event += new ISDUTState(ISDUTState_Event);
                //}
                //catch { }

                // Create delegate instances of editor events
                m_OnStopEditing = new IEditEvents_OnStopEditingEventHandler(OnStopEditing);

                //and delgates to the appropriate events to enable listening
                ((IEditEvents_Event)m_pEditor).OnStopEditing +=  m_OnStopEditing;

                // try to connect to ISDUT db and cache the business features table
                //if (CacheBusinessFeatures() == false)
                //{
                //    MessageBox.Show("Could not read Business Features table: \n" +
                //        ISDUTschema + ISDUT_SDELAYERS + "\n" +
                //        "Please check your Transation Manager Connections", "SUITT Warning");
                //    this.Visible = false;
                //    this.Dispose();
                //    return;
                //}

                //implement the column sorter on lvBF

                m_columnSorter = new ColumnSorter();
                lvBF.ListViewItemSorter = m_columnSorter;

                m_columnSorter.ColumnToSort = 1;
                m_columnSorter.SortOrder = SortOrder.Ascending;

                lvBF.Sort();
            }
            catch(Exception ex)
            {

                Debug.WriteLine(ex.Message + "\n" + ex.StackTrace);

                util.Logger.Write(" Descrip  : Constructing the business feature form." +
                    "\n Message  : " + ex.Message +
                    "\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);
            }
        }