private void btnSave_Click(object sender, EventArgs e) { if (saveFile.GetFileDialog().ShowDialog() == DialogResult.OK) { XElement root = new XElement("Root"); this.SaveToXml(root); root.Save(saveFile.GetFileDialog().FileName); } }
private void btnSave_Click(object sender, EventArgs e) { var dlg = rolesSaveDlg.GetFileDialog(); if (dlg.ShowDialog() == DialogResult.OK) { this.Roles.Save(dlg.FileName); } }
private void btnSaveParam_Click(object sender, EventArgs e) { try { ValidateComponents(); } catch (Exception ex) { MessageBox.Show(this, "Validation failed : " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (saveParamFile.GetFileDialog().ShowDialog() == DialogResult.OK) { ParamFile = saveParamFile.GetFileDialog().FileName; SaveParamToFile(ParamFile); } }
protected override string GetOriginFile() { var fileDialog = targetFile.GetFileDialog(); if (fileDialog.ShowDialog(this) == DialogResult.OK) { return(fileDialog.FileName); } return(null); }
private void btnSaveParam_Click(object sender, EventArgs e) { try { this.ValidateComponents(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var dlg = saveParamFile.GetFileDialog(); if (openParamFile.GetFileDialog().FileName != string.Empty && openParamFile.GetFileDialog().FileName != null) { dlg.FileName = openParamFile.GetFileDialog().FileName; } if (dlg.ShowDialog() == DialogResult.OK) { var bk = this.ConfigFileName; try { this.ConfigFileName = dlg.FileName; try { this.SaveOption(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } finally { this.ConfigFileName = bk; } } }
private void btnSave_Click(object sender, EventArgs e) { try { ValidateComponents(); } catch (Exception ex) { MessageBox.Show(this, "Validation failed : " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var dlg = saveParamFile.GetFileDialog(); if (dlg.ShowDialog() == DialogResult.OK) { var options = FormToOptions(); options.SaveToFile(dlg.FileName); } }
private void btnExport_Click(object sender, EventArgs e) { FileDialog dialog = exportFile.GetFileDialog(); if (dialog.ShowDialog(this) == DialogResult.OK) { IFileWriter <IIdentifiedResult> resultFormat = GetExportFileWriter(); if (resultFormat == null) { return; } try { resultFormat.WriteToFile(dialog.FileName, mr); MessageBox.Show(this, "File " + dialog.FileName + " exported!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(this, "Export " + dialog.FileName + " failed : " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }