Esempio n. 1
0
 public static void Open(Writer db, bool writer, bool immediate = false)
 {
     if (writer)
     {
         if (dbw == null)
         {
             if (((DatabaseManager)db).databaseType == DatabaseManager.DBType.SQLITE && dbr != null)
             {
                 if (MessageBox.Show("Simultaneous reading and archiving is unsafe in sqlite mode. Close the reader to open the archiver?",
                                  "Conflict",
                                  MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     dbr.Close();
                     dbw = new ArchiverWindow(db);
                 }
                 else
                     return;
             }
             else
                 dbw = new ArchiverWindow(db);
         }
         dbw.Show();
         dbw.Focus();
     }
     else
     {
         if (dbr == null)
         {
             if (((DatabaseManager)db).databaseType == DatabaseManager.DBType.SQLITE && dbw != null)
             {
                 if (MessageBox.Show("Simultaneous reading and archiving is unsafe in sqlite mode. Close the archiver to open the reader?",
                                  "Conflict",
                                  MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     dbw.Close();
                     dbr = new Reader(db);
                 }
                 else
                     return;
             }
             else
                 dbr = new Reader(db);
         }
         dbr.Show();
         dbr.Focus();
     }
 }
Esempio n. 2
0
 public static void Shutdown(Form window, Writer db)
 {
     if (dbr == null && dbw == null)
     {
         Application.Exit();
         return;
     }
     else if (window == null && db == null)
         return;
     if ((window == dbw && dbr == null) || (window == dbr && dbw == null))
     {
         db.Close();
         Application.Exit();
         return;
     }
     if (window == dbr)
         dbr = null;
     else
         dbw = null;
 }