Example #1
0
        private void importInstrumentTemplatesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var folderDialog = new OpenFileDialog { Filter = "Myrimatch Files(.db)|*.db|All files|*.*" };
            string importFile;
            if (folderDialog.ShowDialog() == DialogResult.OK)
                importFile = folderDialog.FileName;
            else
                return;

            var exportForm = new ImportTemplateForm(importFile);
            if (!string.IsNullOrEmpty(importFile) && exportForm.ShowDialog() == DialogResult.OK)
            {
                var configList = exportForm.GetConfigs();
                foreach (var config in configList)
                    _session.SaveOrUpdate(config);
                ResetTemplateLists();
            }
        }
Example #2
0
        private void exportInstrumentsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var folderDialog = new SaveFileDialog {DefaultExt = ".db"};
            string exportFile;
            if (folderDialog.ShowDialog() == DialogResult.OK)
                exportFile = folderDialog.FileName;
            else
                return;

            if (File.Exists(exportFile))
                File.Delete(exportFile);
            var exportForm = new ImportTemplateForm(_session);
            if (!string.IsNullOrEmpty(exportFile) && exportForm.ShowDialog() == DialogResult.OK)
            {
                var configList = exportForm.GetConfigs();
                var manager = SessionManager.CreateSessionFactory(exportFile, true);
                var tempSession = manager.OpenSession();
                foreach (var config in configList)
                    tempSession.SaveOrUpdate(config);
                tempSession.Flush();
                tempSession.Close();
            }
        }