Example #1
0
        private void databaseSchemaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form childForm = new DbSchemaForm
            {
                MdiParent = this
            };

            childForm.Show();
        }
Example #2
0
        private void openStructureButton_Click(object sender, EventArgs e)
        {
            if (_schema == null)
            {
                return;
            }
            Form childForm = new DbSchemaForm(_schema, _agent.CurrentDatabase)
            {
                MdiParent = this.MdiParent
            };

            childForm.Show();
        }
Example #3
0
        private void OpenFile(object sender, EventArgs e)
        {
            string filePath = string.Empty;

            using (var openFileDialog = new OpenFileDialog())
            {
                openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                openFileDialog.Filter           = string.Format("{0} (*.{1})|*.{1}|All Files (*.*)|*.*",
                                                                "xml files", "xml");
                if (openFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    filePath = openFileDialog.FileName;
                }
            }

            if (filePath.IsNullOrWhiteSpace())
            {
                return;
            }

            foreach (var child in MdiChildren)
            {
                if (child is IStandardActionForm && ((IStandardActionForm)child).CurrentFilePath.Trim().ToLower()
                    == filePath.Trim().ToLower())
                {
                    child.Activate();
                    return;
                }
            }

            Form childForm = null;

            try
            {
                var result = new ApplicationRoleSchemaList();
                result.LoadXmlFile(filePath);
                childForm = new ApplicationRoleSchemaListForm(result, filePath);
            }
            catch (Exception) { }

            if (childForm == null)
            {
                try
                {
                    var result = new DbSchema();
                    result.LoadXmlFile(filePath);
                    childForm = new DbSchemaForm(filePath, result);
                }
                catch (Exception) { }
            }

            if (childForm == null)
            {
                try
                {
                    var result = new SqlRepository();
                    result.LoadFile(filePath);
                    childForm = new SqlDictionaryForm(result, filePath);
                }
                catch (Exception) { }
            }

            if (childForm == null)
            {
                MessageBox.Show("File is not recognized as any Apskaita5 cofig file.", "",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            childForm.MdiParent = this;
            childForm.Show();
        }