Esempio n. 1
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (FormExtensions.Close(this))
     {
         Application.Exit();
     }
 }
Esempio n. 2
0
        private bool Disconnect(DatabaseNode dbNode)
        {
            List <Document> documents = new List <Document>(GetDocumentsFrom(dbNode.Database));

            if (documents.Count > 0 && MessageBox.Show(this, Properties.Resources.DisconnectDatabase, Text,
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return(false);
            }

            foreach (Document doc in documents)
            {
                if (!FormExtensions.Close(doc))
                {
                    return(false);
                }
            }
            dbNode.Disconnect();
            if (dbNode.Database.IsConnected)
            {
                return(false);
            }
            Unpopulate(dbNode);
            return(true);
        }
Esempio n. 3
0
        private bool CloseAllDocuments()
        {
            bool allClosed = true;

            for (int i = 0; i < dockPanel.Contents.Count;)
            {
                Document doc = dockPanel.Contents[i] as Document;
                if (doc != null)
                {
                    if (!FormExtensions.Close(doc))
                    {
                        allClosed = false;
                        i++;
                    }
                }
                else
                {
                    i++;
                }
            }
            return(allClosed);
        }