protected override void FillControlsToItem() { base.FillControlsToItem(); var storage = MainForm.Current.ProjectFilesControl.Project.DynamicSettingsGlobalHierarchical; DevExpressExtensionMethods.PersistSettings( destinationLanguagesListBox, storage, @"AddNewFileGroupForm.destinationLanguagesListBox"); PersistanceHelper.SaveValue( storage, @"AddNewFileGroupForm.extensionComboBoxEdit", extensionComboBoxEdit.SelectedIndex.ToString(CultureInfo.InvariantCulture)); PersistanceHelper.SaveValue( storage, @"AddNewFileGroupForm.baseFolderTextEdit.Text", baseFolderTextEdit.Text); PersistanceHelper.SaveValue( storage, @"AddNewFileGroupForm.baseFileNameTextEdit.Text", baseFileNameTextEdit.Text); }
/// <summary> /// Opens the with dialog. /// </summary> public void OpenWithDialog() { using (var ofd = new OpenFileDialog()) { ofd.Multiselect = true; ofd.Filter = $@"{Resources.SR_MainForm_openToolStripMenuItemClick_ResourceFiles} (*.resx;*.resw)|*.resx;*.resw"; ofd.RestoreDirectory = true; var initialDir = ConvertHelper.ToString( PersistanceHelper.RestoreValue( MainForm.UserStorageIntelligent, @"filesInitialDir")); ofd.InitialDirectory = initialDir; if (ofd.ShowDialog(this) == DialogResult.OK) { PersistanceHelper.SaveValue( MainForm.UserStorageIntelligent, @"filesInitialDir", ZlpPathHelper.GetDirectoryPathNameFromFilePath(ofd.FileName)); var fileGroup = FileGroup.CheckCreate( MainForm.Current.ProjectFilesControl.Project ?? Project.Empty, ofd.FileNames); bool isNew; var editorControl = checkGetAddEditorControl(fileGroup, out isNew); editorControl.OpenWithDialog(fileGroup); } } }
public void PersistsState(string key) { SaveState(); var s = StringHelper.SerializeToString(this); PersistanceHelper.SaveValue(key, s); }
private void buttonBrowse_Click(object sender, EventArgs e) { using (var form = new OpenFileDialog()) { form.InitialDirectory = (string) PersistanceHelper.RestoreValue( @"receiveFileFromTranslator.destinationFilePathTextEdit.InitialDirectory", _project.ProjectConfigurationFilePath.DirectoryName); form.Multiselect = false; form.CheckFileExists = true; form.CheckPathExists = true; form.Filter = Resources.SR_ExportWizard_buttonBrowseClick_ExcelFilesXlsxls; if (form.ShowDialog(this) == DialogResult.OK) { PersistanceHelper.SaveValue( @"receiveFileFromTranslator.destinationFilePathTextEdit.InitialDirectory", Path.GetDirectoryName(form.FileName)); sourceFileTextEdit.Text = form.FileName; parseFileGroups(); parseLanguageCode(); UpdateUI(); } } }
private void baseFolderSelectButton_Click(object sender, EventArgs e) { using (var dialog = new ExtendedFolderBrowserDialog()) { dialog.Description = Resources.AddNewFileGroupForm_baseFolderSelectButton_Click_Please_select_the_base_folder_where_to_create_the_files_; var initialDir = ConvertHelper.ToString( PersistanceHelper.RestoreValue( MainForm.UserStorageIntelligent, @"filesInitialDir")); if (string.IsNullOrEmpty(initialDir) || !ZlpIOHelper.DirectoryExists(initialDir)) { var d = _project.ProjectConfigurationFilePath.Directory; initialDir = d.FullName; } dialog.SelectedPath = initialDir; dialog.ShowEditBox = true; if (dialog.ShowDialog(this) == DialogResult.OK) { PersistanceHelper.SaveValue( MainForm.UserStorageIntelligent, @"filesInitialDir", dialog.SelectedPath); baseFolderTextEdit.Text = dialog.SelectedPath; UpdateUI(); } } }
private void buttonBrowse_Click(object sender, EventArgs e) { using (var form = new OpenFileDialog()) { form.InitialDirectory = (string) PersistanceHelper.RestoreValue( _project.DynamicSettingsGlobalHierarchical, @"sendFileToTranslator.destinationFilePathTextEdit.InitialDirectory", _project.ProjectConfigurationFilePath.DirectoryName); form.Multiselect = false; form.CheckFileExists = false; form.CheckPathExists = true; form.Filter = Resources.SR_ExportWizard_buttonBrowseClick_ExcelFilesXlsxls; if (form.ShowDialog(this) == DialogResult.OK) { using (new SilentProjectStoreGuard(_project)) { PersistanceHelper.SaveValue( _project.DynamicSettingsGlobalHierarchical, @"sendFileToTranslator.destinationFilePathTextEdit.InitialDirectory", ZlpPathHelper.GetDirectoryPathNameFromFilePath(form.FileName)); } destinationFileTextEdit.Text = form.FileName; UpdateUI(); } } }
private void saveState( IPersistentPairStorage storage) { PersistanceHelper.SaveValue( storage, @"autoTranslateForm.prefixTextBox.Text", prefixTextBox.Text); PersistanceHelper.SaveValue( storage, @"autoTranslateForm.prefixCheckBox.Checked", prefixCheckBox.Checked); PersistanceHelper.SaveValue( storage, @"autoTranslateForm.useExistingTranslationsCheckBox.Checked", useExistingTranslationsCheckBox.Checked); PersistanceHelper.SaveValue( storage, @"autoTranslateForm.useOnlyExistingTranslationsCheckEdit.Checked", useOnlyExistingTranslationsCheckEdit.Checked); PersistanceHelper.SaveValue( storage, @"autoTranslateForm.referenceLanguageComboBoxEdit.SelectedIndex", referenceLanguageGroupBox.SelectedIndex); DevExpressExtensionMethods.PersistSettings( languagesToTranslateCheckListBox, storage, @"autoTranslateForm.languagesToTranslateCheckListBox"); }
/// <summary> /// Checks and shows the trial version form if necessary. /// </summary> public static void CheckShow() { if (!ConvertHelper.ToBoolean( ConfigurationManager.AppSettings[@"disableExitAdvertisementForm"]) /*&& !ZetaResourceEditorCommandLineInfo.Current.IsNonblockingGui*/) { if (HostSettings.Current.License.LicenseType == ZreLicenseType.Freeware) { var lastExitAdvertisementShownAt = ConvertHelper.ToDateTime( PersistanceHelper.RestoreValue(@"ExitAdvertisement.LastShown")); if (lastExitAdvertisementShownAt <= DateTime.Now.AddDays(-1) || ConvertHelper.ToBoolean( ConfigurationManager.AppSettings[@"forceExitAdvertisementForm"])) { PersistanceHelper.SaveValue(@"ExitAdvertisement.LastShown", DateTime.Now); using (var form = new ExitAdvertisementForm()) { var af = ActiveForm; if (af != null) { af.Visible = false; } form.ShowDialog(af); } } } } }
private void textBoxForm_FormClosing( object sender, FormClosingEventArgs e) { WinFormsPersistanceHelper.SaveState(this); PersistanceHelper.SaveValue(@"TextBoxForm.Wrap", wordWrapCheckEdit.Checked); }
public static void CheckShowNewTranslationInfos() { var version = PersistanceHelper.RestoreValue(@"TranslationInfos.LastShownVersion"); var show = version == null || new Version(version.ToString()) < new Version(2, 2, 0, 10) && new Version(version.ToString()) < Assembly.GetExecutingAssembly().GetName().Version; if (show) { PersistanceHelper.SaveValue( @"TranslationInfos.LastShownVersion", Assembly.GetExecutingAssembly().GetName().Version); if (XtraMessageBox.Show( ActiveForm, Resources.AutoTranslateForm_CheckShowNewTranslationInfos_Google_changed_their_translation_settings__Do_you_want_to_read_how_you_can_continue_using_Google_Translate_, @"Zeta Resource Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { Process.Start(new GoogleRestfulTranslationEngine().AppIDLink); } } }
public static void CheckShowNewTranslationInfos() { var version = PersistanceHelper.RestoreValue(@"TranslationInfos.LastShownVersion"); var show = version == null || new Version(version.ToString()) < new Version(2, 2, 0, 10) && new Version(version.ToString()) < Assembly.GetExecutingAssembly().GetName().Version; if (show) { PersistanceHelper.SaveValue( @"TranslationInfos.LastShownVersion", Assembly.GetExecutingAssembly().GetName().Version); if (XtraMessageBox.Show( ActiveForm, Resources.HowToGoogleTranslate, @"Zeta Resource Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { Process.Start(((ITranslationEngine) new GoogleRestfulTranslationEngine()).AppIDLink); } } }
private void saveState( IPersistentPairStorage storage) { using (new SilentProjectStoreGuard(_project)) { PersistanceHelper.SaveValue( storage, @"sendProjectWizardForm.exportProjectFileCheckEdit.Checked", exportProjectFileCheckEdit.Checked); PersistanceHelper.SaveValue( storage, @"sendProjectWizardForm.exportResourceFilesCheckEdit.Checked", exportResourceFilesCheckEdit.Checked); PersistanceHelper.SaveValue( storage, @"sendProjectWizardForm.exportLocalSettingsCheckEdit.Checked", exportLocalSettingsCheckEdit.Checked); PersistanceHelper.SaveValue( storage, @"sendProjectWizardForm.zulReceiversTextEdit.Text", zulReceiversTextEdit.Text); PersistanceHelper.SaveValue( storage, @"sendProjectWizardForm.zulSubjectTextEdit.Text", zulSubjectTextEdit.Text); PersistanceHelper.SaveValue( storage, @"sendProjectWizardForm.zulBodyTextEdit.Text", zulBodyTextEdit.Text); } }
private void saveComboBox() { WinFormsPersistanceHelper.SaveState(textToFindComboBox); PersistanceHelper.SaveValue( textToFindComboBox.Name + @".Text", whiteSpaceAwareCheckEdit.Checked ? textToFindComboBox.Text : textToFindComboBox.Text.Trim()); PersistanceHelper.SaveValue( textToFindComboBox.Name + @".Count", textToFindComboBox.Properties.Items.Count); var index = 0; foreach (string item in textToFindComboBox.Properties.Items) { PersistanceHelper.SaveValue( textToFindComboBox.Name + @".Item." + index, item); index++; } }
private static void coreStoreMruProjectFiles( string[] paths) { var splitted = paths == null || paths.Length < 0 ? string.Empty : string.Join(@"###~~~###", paths); PersistanceHelper.SaveValue(@"Mru.ProjectFiles", splitted); }
private static void coreStoreMruFileFiles( string[] paths) { var splitted = paths == null ? string.Empty : string.Join(@"###~~~###", paths); PersistanceHelper.SaveValue(@"Mru.FileFiles", splitted); }
private static void saveState( IPersistentPairStorage storage, TextEdit c) { var prefix = c.Name; PersistanceHelper.SaveValue( storage, prefix + @".Text", c.Text); }
private static void saveState( IPersistentPairStorage storage, CheckEdit c) { var prefix = c.Name; PersistanceHelper.SaveValue( storage, prefix + @".Checked", c.Checked); }
private void FindForm_FormClosing( object sender, FormClosingEventArgs e) { WinFormsPersistanceHelper.SaveState(this); saveComboBox(); PersistanceHelper.SaveValue( whiteSpaceAwareCheckEdit.Name + @"Checked", whiteSpaceAwareCheckEdit.Checked); }
private void btnConnectionStringExpander_Click(object sender, EventArgs e) { advancedOptionsPanel.Visible = !advancedOptionsPanel.Visible; using (new SilentProjectStoreGuard(_project)) { PersistanceHelper.SaveValue( _project.DynamicSettingsGlobalHierarchical, @"advancedOptionsPanel.Visible", advancedOptionsPanel.Visible); } updateExpandState(); }
public static void SaveState(RibbonControl ribbon) { using var ms = new MemoryStream(); ribbon.Toolbar.SaveLayoutToStream(ms); ms.Seek(0, SeekOrigin.Begin); string s; using (var sr = new StreamReader(ms, Encoding.UTF8)) { s = sr.ReadToEnd(); } PersistanceHelper.SaveValue(ribbon.Name + @".Toolbar", s); }
public void Save() { using (var ms = new MemoryStream()) { saveSettings(gridView, ms, XtraGridAppName); ms.Seek(0, SeekOrigin.Begin); string s; using (var sr = new StreamReader(ms, Encoding.UTF8)) { s = sr.ReadToEnd(); } PersistanceHelper.SaveValue(_storage, key, s); } }
public static void PersistSettingsByName( CheckedListBoxControl c, IPersistentPairStorage storage, string key) { var names = new List <string>(); for (var i = 0; i < c.Items.Count; ++i) { if (c.GetItemChecked(i)) { names.Add(c.GetItem(i).ToString()); } } PersistanceHelper.SaveValue(storage, key, string.Join(@"###{{{}}}###", names.ToArray())); }
private void saveState( IPersistentPairStorage storage) { PersistanceHelper.SaveValue( storage, @"receiveFileFromTranslator.sourceFilePathTextEdit.Text", sourceFileTextEdit.Text); DevExpressExtensionMethods.PersistSettings( fileGroupsListBox, storage, @"receiveFileFromTranslator.fileGroupsListBox"); DevExpressExtensionMethods.PersistSettings( languagesToImportCheckListBox, storage, @"receiveFileFromTranslator.languagesToImportCheckListBox"); }
private static void saveState( IPersistentPairStorage storage, ComboBoxEdit c) { var prefix = c.Name; PersistanceHelper.SaveValue( storage, prefix + @".SelectedIndex", c.SelectedIndex); if (c.Properties.TextEditStyle == TextEditStyles.Standard) { PersistanceHelper.SaveValue( storage, prefix + @".Text", c.Text); } }
protected override void FillControlsToItem() { base.FillControlsToItem(); PersistanceHelper.SaveValue( @"QuickTranslationForm.sourceLanguageComboBox.SelectedIndex", sourceLanguageComboBox.SelectedIndex); PersistanceHelper.SaveValue( @"QuickTranslationForm.destinationLanguageComboBox.SelectedIndex", destinationLanguageComboBox.SelectedIndex); PersistanceHelper.SaveValue( @"QuickTranslationForm.sourceTextTextBox.Text", sourceTextTextBox.Text); PersistanceHelper.SaveValue( @"QuickTranslationForm.copyDestinationTextToClipboardCheckBox.Checked", copyDestinationTextToClipboardCheckBox.Checked); }
private static void saveState( IPersistentPairStorage storage, TreeList c) { var prefix = c.Name; using var tfc = new ZetaTemporaryFileCreator(); c.SaveLayoutToXml( tfc.FilePath, new OptionsLayoutTreeList { AddNewColumns = false, RemoveOldColumns = true, StoreAppearance = false }); PersistanceHelper.SaveValue( storage, prefix + @".TreeList", tfc.FileContentString); }
private void ReportIssueForm_FormClosing( object sender, FormClosingEventArgs e) { PersistanceHelper.SaveValue( @"ReportIssueForm.emailAddressTextBox.Text", emailAddressTextBox.Text); PersistanceHelper.SaveValue( @"ReportIssueForm.additionalRemarksTextBox.Text", additionalRemarksTextBox.Text); WinFormsPersistanceHelper.SaveState(this); foreach (var tempFilePath in _temporaryFilePathsToDelete) { if (ZlpIOHelper.FileExists(tempFilePath)) { ZlpIOHelper.DeleteFile(tempFilePath); } } }
private static void saveState( IPersistentPairStorage storage, GridView c) { var prefix = c.Name; using var tfc = new ZetaTemporaryFileCreator(); c.SaveLayoutToXml( tfc.FilePath, new OptionsLayoutGrid { StoreAllOptions = false, StoreDataSettings = true, StoreVisualOptions = false, StoreAppearance = false }); PersistanceHelper.SaveValue( storage, prefix + @".GridView", tfc.FileContentString); }
protected override void FillControlsToItem() { base.FillControlsToItem(); var storage = (MainForm.Current.ProjectFilesControl.Project ?? Project.Empty).DynamicSettingsGlobalHierarchical; PersistanceHelper.SaveValue( storage, @"CreateNewFilesForm.prefixTextBox.Text", prefixTextBox.Text); PersistanceHelper.SaveValue( storage, @"CreateNewFilesForm.prefixCheckBox.Checked", prefixCheckBox.Checked); PersistanceHelper.SaveValue( storage, @"CreateNewFilesForm.referenceLanguageComboBox.SelectedIndex", referenceLanguageComboBox.SelectedIndex); DevExpressExtensionMethods.PersistSettings( destinationLanguagesListBox, storage, @"CreateNewFilesForm.destinationLanguagesListBox"); PersistanceHelper.SaveValue( storage, @"CreateNewFilesForm.copyTextsCheckBox.Checked", copyTextsCheckBox.Checked); PersistanceHelper.SaveValue( storage, @"CreateNewFilesForm.automaticallyTranslateCheckBox.Checked", automaticallyTranslateCheckBox.Checked); }
/// <summary> /// Saves the recent files info. /// </summary> public void SaveRecentFilesInfo() { var project = MainForm.Current.ProjectFilesControl.Project ?? Project.Empty; var text = string.Empty; if (project != null && project != Project.Empty) { project.ClearMruElements(); } foreach (XtraTabPage tabPage in mainTabControl.TabPages) { var editorControl = (ResourceEditorUserControl)tabPage.Controls[0]; if (!string.IsNullOrEmpty(text)) { text += @"###***###"; } if (editorControl.GridEditableData != null) { text += editorControl.GridEditableData.JoinedFilePaths; } if (project != null && project != Project.Empty) { project.AddMruElement(editorControl.GridEditableData); } } PersistanceHelper.SaveValue( MainForm.UserStorageIntelligent, @"RecentFiles", text); }