Exemplo n.º 1
0
        void m_doc_CommandEnded(object sender, CommandEventArgs e)
        {
            EM_Helper.StreamMessage(String.Format("CommandEnded - {0}", e.GlobalCommandName));
            Database db = m_doc.Database;

            //Document doc = (Document)sender;

            List <EM_EData> enData = EW_Storage.enData;

            if (e.GlobalCommandName == "ERASE" || e.GlobalCommandName == "E")
            {
                m_doc.CommandEnded     -= m_doc_CommandEnded;
                m_doc.CommandFailed    -= m_doc_CommandEnded;
                m_doc.CommandCancelled -= m_doc_CommandEnded;
                m_dbWatcher.UndoADb(ref db);
                //m_doc.Database.ObjectOpenedForModify -= dbCallback.m_db_ObjectOpenedForModify;
                if (enData != null)
                {
                    EM_Delete.doDelete(enData);
                }
            }

            else if (e.GlobalCommandName == "SAVEAS")
            {
                m_doc.CommandEnded -= m_doc_CommandEnded;
            }

            else if (e.GlobalCommandName == "GRIP_StrETCH" || e.GlobalCommandName == "MOVE")
            {
                m_doc.CommandEnded     -= m_doc_CommandEnded;
                m_doc.CommandFailed    -= m_doc_CommandEnded;
                m_doc.CommandCancelled -= m_doc_CommandEnded;
                m_dbWatcher.UndoADb(ref db);
                //m_doc.Database.ObjectOpenedForModify -= dbCallback.m_db_ObjectOpenedForModify;
                if (enData != null)
                {
                    EM_StretchMove.doStretchMove(enData);
                }
            }
            else if (e.GlobalCommandName == "QUIT")
            {
            }
            else if (e.GlobalCommandName == "CLOSE")
            {
                m_doc.CommandEnded -= m_doc_CommandEnded;
                if (!m_doc.Name.Contains("Drawing1.dwg"))
                {
                    List <string> docList = EM_DocList.emDockList.docList;
                    try {
                        docList.Remove(m_doc.Name);
                    }
                    catch (System.Exception ex) {
                        BaseObjs.writeDebug(ex.Message + " EM_EventsDoc.cs: line: 201");
                    }
                }
            }
            else if (e.GlobalCommandName == "OPEN")
            {
                m_doc.CommandEnded -= m_doc_CommandEnded;
            }
        }
Exemplo n.º 2
0
        private void m_doc_CommandEnded(object sender, CommandEventArgs e)
        {
            EM_Helper.StreamMessage(String.Format("CommandEnded - {0}", e.GlobalCommandName));
            Database db = m_doc.Database;

            System.Windows.Forms.Keys mods = System.Windows.Forms.Control.ModifierKeys;
            btp.shiftKey = (mods & System.Windows.Forms.Keys.Shift) > 0;
            btp.cntrlKey = (mods & System.Windows.Forms.Keys.Control) > 0;
            btp.altX     = (mods & System.Windows.Forms.Keys.Alt) > 0;

            List <EM_EData> enData = EW_Storage.enData;

            if (e.GlobalCommandName == "ERASE" || e.GlobalCommandName == "E")
            {
                m_doc.CommandEnded     -= m_doc_CommandEnded;
                m_doc.CommandFailed    -= m_doc_CommandEnded;
                m_doc.CommandCancelled -= m_doc_CommandEnded;
                m_dbWatcher.UndoADb(ref db);
                if (enData != null)
                {
                    EM_Delete.doDelete(enData);
                }
            }
            else if (e.GlobalCommandName == "SAVEAS")
            {
                m_doc.CommandEnded -= m_doc_CommandEnded;
            }
            else if (e.GlobalCommandName == "GRIP_STRETCH" || e.GlobalCommandName == "MOVE")
            {
                m_doc.CommandEnded     -= m_doc_CommandEnded;
                m_doc.CommandFailed    -= m_doc_CommandEnded;
                m_doc.CommandCancelled -= m_doc_CommandEnded;
                m_dbWatcher.UndoADb(ref db);
                if (enData != null)
                {
                    EM_StretchMove.doStretchMove(enData);
                }
            }
            else if (e.GlobalCommandName == "AECCEDITPIPEPROPERTIES" || e.GlobalCommandName == "AECCEDITPARENTPARTPROPERTIES")
            {
                m_doc.CommandEnded     -= m_doc_CommandEnded;
                m_doc.CommandFailed    -= m_doc_CommandEnded;
                m_doc.CommandCancelled -= m_doc_CommandEnded;
                m_dbWatcher.UndoADb(ref db);
                if (enData != null)
                {
                    EM_StretchMove.doStretchMove(enData);
                }
            }
            else if (e.GlobalCommandName == "QUIT")
            {
            }
            else if (e.GlobalCommandName == "CLOSE")
            {
                m_doc.CommandEnded -= m_doc_CommandEnded;
                if (!m_doc.Name.Contains("Drawing1.dwg"))
                {
                    List <string> docList = EM_DocList.emDockList.docList;
                    try
                    {
                        docList.Remove(m_doc.Name);
                        ObjectId idDict = Dict.dictExists("cmdFL");
                        if (idDict != ObjectId.Null)
                        {
                            Dict.setCmdDefault("cmdFL", "resBot", "FL");
                        }
                        idDict = Dict.dictExists("cmdG");
                        if (idDict != ObjectId.Null)
                        {
                            Dict.setCmdDefault("cmdG", "resBot", "FL");
                            Dict.setCmdDefault("cmdG", "resTop", "TC");
                        }
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " EM_EventsDocument.cs: line: 295");
                    }
                }
            }
            else if (e.GlobalCommandName == "OPEN")
            {
                m_doc.CommandEnded -= m_doc_CommandEnded;
            }
            EW_Storage.enData = null;
        }