private void tsiSaveTemplate_Click(object sender, EventArgs e) { if (saveDialogTemplateFile.ShowDialog() == DialogResult.OK) { TemplateFileUtil templateFileUtil = new TemplateFileUtil(); startForm.Template.TableList = this.tablesList; templateFileUtil.createTemplateFile(startForm.Template, saveDialogTemplateFile.FileName); } saveDialogTemplateFile.Dispose(); }
private void btnOpenTemplate_Click(object sender, EventArgs e) { openTemplateFileDialog.Filter = "(*.oddb)|*.oddb"; openTemplateFileDialog.Title = openFileDialogTitleMsg; DialogResult result = openTemplateFileDialog.ShowDialog(); Cursor.Current = Cursors.WaitCursor; if ("OK".Equals(result.ToString())) { templateFilePath = openTemplateFileDialog.FileName.ToString(); try { bool errorData = false; bool errorConnection = false; Template = new TemplateFileUtil().getTemplateFile(templateFilePath); if (validateTemplateFileTable()) readTemplateIntoTableList(); else errorData = true; if (validateTemplateFileConnection()) { this.btnFinish.Enabled = true; this.btnNextStep.Enabled = false; } else { errorConnection = true; templateFilePath = ""; this.btnFinish.Enabled = false; this.btnNextStep.Enabled = true; } if (errorData || errorConnection) if (errorData) showInfoWindow(msgInvalidTemplateDataFile); else showErrorInfoWindow(msgInvalidTemplateConnection); } catch (Exception) { showErrorInfoWindow(msgInvalidTemplateConnection); } } else { templateFilePath = ""; this.btnFinish.Enabled = false; this.btnNextStep.Enabled = true; } this.txbTemplateFilePath.Text = templateFilePath; }