/// <summary></summary> public ConverterTest() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); ofDlg = new OpenFileDialogAdapter(); ofDlg.DefaultExt = "txt"; ofDlg.Filter = FileUtils.FileDialogFilterCaseInsensitiveCombinations(FwCoreDlgs.ofDlg_Filter); saveFileDialog = new SaveFileDialogAdapter(); saveFileDialog.DefaultExt = "txt"; saveFileDialog.RestoreDirectory = true; saveFileDialog.Filter = ofDlg.Filter; if (DesignMode) { return; } InputArgsChanged(); // set the initial state of the Convert button // Set view properties. m_fHasOutput = false; m_svOutput = new SampleView(); m_svOutput.WritingSystemFactory = FwUtils.CreateWritingSystemManager(); m_svOutput.Dock = DockStyle.Fill; m_svOutput.Visible = true; m_svOutput.Enabled = false; m_svOutput.BackColor = OutputPanel.BackColor; m_svOutput.TabIndex = 1; m_svOutput.TabStop = true; OutputPanel.Controls.Add(m_svOutput); }
private void OnSaveAsHtmlButtonClick(object sender, EventArgs e) { if (File.Exists(m_sHtmlFileName)) { using (var dlg = new SaveFileDialogAdapter()) { InitSaveAsWebpageDialog(dlg); if (dlg.ShowDialog() == DialogResult.OK) { string dlgFileName = dlg.FileName; // For those poor souls who have run into LT-6264, // we need to be nice and remove the read-only attr. // Besides, the reporter may not believe the bug is dead, // as it still won't be in a copy state. :-) RemoveWriteProtection(dlgFileName); File.Copy(m_sHtmlFileName, dlg.FileName, true); // If m_sHtmlFileName is the initial doc, then it will be read-only. // Setting the attr to normal fixes LT-6264. // I (RandyR) don't know why the save button is enabled, // when the sketch has not been generated, but this ought to be the 'fix/hack'. RemoveWriteProtection(dlgFileName); if (File.Exists(m_sAlsoSaveFileName)) { InitAlsoSaveDialog(dlg); if (dlg.ShowDialog() == DialogResult.OK) { DoAlsoSaveAs(dlg); } } } } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor for FwUpdateReportDlg /// </summary> /// ------------------------------------------------------------------------------------ public FwUpdateReportDlg() { InitializeComponent(); saveFileDialog = new SaveFileDialogAdapter(); saveFileDialog.DefaultExt = "txt"; saveFileDialog.SupportMultiDottedExtensions = true; saveFileDialog.Filter = FileUtils.FileDialogFilterCaseInsensitiveCombinations(FwCoreDlgs.TextFileFilter); }
/// <summary> /// Class to choose input, output files for Db4o to XML conversion /// </summary> public FileInOutChooser() { InitializeComponent(); Db4oFile = new OpenFileDialogAdapter(); Db4oFile.Filter = "Db4o Files|*.fwdb|All Files|*.*"; XmlFile = new SaveFileDialogAdapter(); XmlFile.DefaultExt = "fwxml"; }
/// <summary> /// Respond to an export UI button push by letting the user specify what file to export to, and starting the export process. /// </summary> private void OnExportConfiguration(object sender, EventArgs e) { // Not capable of exporting new configurations yet. if (IsDirty) { MessageBox.Show(_view, xWorksStrings.kstidConfigsChanged); return; } if (string.IsNullOrEmpty(SelectedConfiguration.FilePath)) { throw new ArgumentNullException("The configuration selected for export has an empty file path."); } if (Path.GetDirectoryName(SelectedConfiguration.FilePath) == _defaultConfigDir) { SelectedConfiguration.FilePath = Path.Combine(_projectConfigDir, Path.GetFileName(SelectedConfiguration.FilePath)); SelectedConfiguration.Save(); } var disallowedCharacters = MiscUtils.GetInvalidProjectNameChars(MiscUtils.FilenameFilterStrength.kFilterBackup) + " $%"; string outputPath; using (var saveDialog = new SaveFileDialogAdapter()) { saveDialog.Title = xWorksStrings.kstidChooseExportFile; saveDialog.FileName = StringUtils.FilterForFileName(SelectedConfiguration + "_FLEx-Dictionary-Configuration_" + DateTime.Now.ToString("yyyy-MM-dd"), disallowedCharacters); saveDialog.DefaultExt = "zip"; saveDialog.AddExtension = true; saveDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var result = saveDialog.ShowDialog(_view); if (result != DialogResult.OK) { return; } outputPath = saveDialog.FileName; } // Append ".zip" if user entered something like "foo.gif", which loses the hidden ".zip" extension. if (!outputPath.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase)) { outputPath += ".zip"; } ExportConfiguration(SelectedConfiguration, outputPath, _cache); }
private void m_btnBrowse_Click(object sender, EventArgs e) { using (var dlg = new SaveFileDialogAdapter()) { dlg.AddExtension = true; dlg.DefaultExt = String.IsNullOrEmpty(m_defaultExt) ? ".xml" : m_defaultExt; dlg.Filter = String.IsNullOrEmpty(m_filter) ? "*.xml" : m_filter; dlg.Title = String.Format(xWorksStrings.ExportTo0, String.IsNullOrEmpty(m_titleFrag) ? "Translated List" : m_titleFrag); dlg.InitialDirectory = m_propertyTable.GetStringProperty("ExportDir", Environment.GetFolderPath(Environment.SpecialFolder.Personal)); if (dlg.ShowDialog(this) != DialogResult.OK) { return; } m_tbFilepath.Text = dlg.FileName; EnableExportButton(); } }