/// <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); } } }
/// <summary> /// Loads the recent files. /// </summary> public void LoadRecentFiles( Project project) { CloseAllDocuments(); if (project == null) { var text = PersistanceHelper.RestoreValue( MainForm.UserStorageIntelligent, @"RecentFiles") as string; if (!string.IsNullOrEmpty(text)) { foreach (var filePathsRaw in text.Split( new[] { @"###***###" }, StringSplitOptions.RemoveEmptyEntries)) { var filePaths = new List <ZlpFileInfo>(); foreach (var filePath in filePathsRaw.Split(';')) { if (ZlpIOHelper.FileExists(filePath)) { filePaths.Add(new ZlpFileInfo(filePath)); } } DoLoadFiles( // TODO: Possible modify this function. FileGroup.CheckCreate( MainForm.Current.ProjectFilesControl.Project ?? Project.Empty, filePaths.ToArray()), MainForm.Current.ProjectFilesControl.Project ?? Project.Empty); } } } else { foreach (var d in project.GetProjectMruItems()) { DoLoadFiles(d, project); } } }
private void bbi_ItemClick(object sender, ItemClickEventArgs e) { var paths = FileGroup.SplitFilePaths((string)e.Item.Tag); if (paths.Length > 0) { DialogResult r; if (groupFilesControl.CurrentFileGroupControl != null) { r = groupFilesControl.CurrentFileGroupControl.DoSaveFiles( SaveOptions.OnlyIfModified | SaveOptions.AskConfirm); } else { r = DialogResult.OK; } if (r == DialogResult.OK) { addMruFilesFile(FileGroup.JoinFilePaths(paths)); //_mruFilesMenu.SetFirstFile( e.Number ); groupFilesControl.DoLoadFiles( FileGroup.CheckCreate( ProjectFilesControl.Project, paths), ProjectFilesControl.Project); } } else { removeMruFilesFile(FileGroup.JoinFilePaths(paths)); //_mruFilesMenu.RemoveFile( e.Number ); } UpdateUI(); }