Example #1
0
        private void importarUmBancoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            if (open.ShowDialog() == DialogResult.OK)
            {
                Thread tr = new Thread(delegate()
                {
                    ImporterExporter.ImporterExporter importer = new ImporterExporter.ImporterExporter();
                    this.Invoke((MethodInvoker) delegate() { progressBar1.Visible = true; });
                    importer.import(open.FileName, this.currengGloablDbPath, delegate(int max, int att)
                    {
                        this.Invoke((MethodInvoker) delegate()
                        {
                            progressBar1.Maximum = max;
                            progressBar1.Value   = att;
                        });
                    });
                    this.Invoke((MethodInvoker) delegate()
                    {
                        progressBar1.Visible = false;
                        MessageBox.Show("Banco importado com sucesso.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        loadGlobalDb(currengGloablDbPath);
                    });
                });
                tr.Start();
            }
        }
Example #2
0
        private void exportarOBancoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

            if (save.ShowDialog() == DialogResult.OK)
            {
                Thread tr = new Thread(delegate()
                {
                    ImporterExporter.ImporterExporter exporter = new ImporterExporter.ImporterExporter();
                    this.Invoke((MethodInvoker) delegate() { progressBar1.Visible = true; });
                    exporter.export(this.currengGloablDbPath, save.FileName, delegate(int max, int att)
                    {
                        this.Invoke((MethodInvoker) delegate()
                        {
                            if (att > max)
                            {
                                att = max;
                            }
                            progressBar1.Maximum = max;
                            progressBar1.Value   = att;
                        });
                    });
                    this.Invoke((MethodInvoker) delegate()
                    {
                        progressBar1.Visible = false;
                        MessageBox.Show("Banco exportado com sucesso.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    });
                });
                tr.Start();
            }
        }