コード例 #1
0
        public FileStatus(int status, string dwgPath)
        {
            this.status  = status;
            this.dwgPath = dwgPath;
            if (status == 0)
            {
                db = Application.DocumentManager.MdiActiveDocument.Database;
            }
            else if (status == 1)
            {
                previousDwgPath = Application.DocumentManager.MdiActiveDocument.Name;

                Document doc = Goodies.GetDocumentFromDwgpath(dwgPath);
                db = doc.Database;
                Application.DocumentManager.MdiActiveDocument = doc;
                Application.DocumentManager.CurrentDocument   = doc;
                //Application.DocumentManager.MdiActiveDocument = Application.DocumentManager.Open(dwgPath, false);
                //db = null;
            }
            else if (status == 2)
            {
                db.ReadDwgFile(dwgPath, FileOpenMode.OpenForReadAndAllShare, false, "");
            }
            else if (status == 3)
            {
                db = null;
            }
            else
            {
                db = null;
            }
        }
コード例 #2
0
        /// <summary>
        /// ReadPNote is read Note in general, can be from database, can be from dwg depends on current situation.
        /// If dwgPNote is opened, is active or not, is modified or not (can't check whether or not it is modied), refer to read from DWG and updateDatabase.
        /// If dwgPNote is Not open check date, if if equals, read from database.
        /// Else: read from file + udpate todatabase.
        /// FK IT, JUST FOUND DOWN THE INTEROPT SHIT
        /// </summary>
        /// <param name="connection"></param>
        /// <returns></returns>
        public static NODEDWG ReadDataPNode(SQLiteConnection connection)
        {
            NODEDWG note = null;

            string notePath = GoodiesPath.GetNotePathFromADwgPath(Application.DocumentManager.MdiActiveDocument.Name, connection);

            if (!string.IsNullOrEmpty(notePath))
            {
                if (Goodies.GetListOfDocumentOpening().Contains(notePath))
                {
                    Document doc = Goodies.GetDocumentFromDwgpath(notePath);

                    if (doc == null)
                    {
                        Application.ShowAlertDialog("ReadDwgNoteFile -> There is no Document, weird!");
                        return(null);
                    }

                    AcadDocument acadDoct = (AcadDocument)doc.GetAcadDocument();
                    if (acadDoct.Saved && GoodiesPath.IsDateTheSame(notePath, connection))
                    {
                        note = ReadFromDatabase(connection);
                    }
                    else
                    {
                        using (Database db = doc.Database)
                        {
                            note = GetData(db, connection);
                        }
                    }
                }
                else
                {
                    Database db = new Database();
                    try
                    {
                        if (GoodiesPath.IsDateTheSame(notePath, connection))
                        {
                            note = ReadFromDatabase(connection);
                        }
                        else
                        {
                            db.ReadDwgFile(notePath, FileOpenMode.OpenForReadAndAllShare, false, "");
                            note = GetData(db, connection);
                        }
                    }catch (Exception e)
                    {
                        MessageBox.Show(e.Message);
                    }
                }
            }

            return(note);
        }
コード例 #3
0
 public void ReturnPreviousDocument()
 {
     if (status == 1)
     {
         Document doc = Goodies.GetDocumentFromDwgpath(previousDwgPath);
         using (doc.LockDocument())
         {
             Application.DocumentManager.MdiActiveDocument = doc;
             Application.DocumentManager.CurrentDocument   = doc;
         }
     }
 }