public void SaveSettings(bool saveAll) { IMostRecentlyUsedService mruService = ToolsUIApplication.Instance.RootServiceProvider.GetService(typeof(IMostRecentlyUsedService)) as IMostRecentlyUsedService; if (mruService != null) { if (saveAll) { mruService.SetTargetFileDialogSettings(this.targetAlias, this.drive + this.currentPath, this.fileSpec, this.left, this.top, this.width, this.height, this.nameWidth, this.dateWidth, this.sizeWidth); } else { mruService.SetTargetFileDialogSettings(this.targetAlias, this.left, this.top, this.width, this.height, this.nameWidth, this.dateWidth, this.sizeWidth); } } }
public TargetOpenSaveFileData(bool save, KStudioClient client, string targetAlias, string defaultPath, string fileName, bool showReadOnly) { DebugHelper.AssertUIThread(); if (client == null) { throw new ArgumentNullException("client"); } if (String.IsNullOrWhiteSpace(targetAlias)) { throw new ArgumentNullException("targetAlias"); } if (String.IsNullOrWhiteSpace(defaultPath)) { throw new ArgumentNullException("defaultPath"); } this.save = save; this.fileName = fileName; this.showReadOnly = showReadOnly; string currentPath = null; string fileSpec = null; IMostRecentlyUsedService mruService = ToolsUIApplication.Instance.RootServiceProvider.GetService(typeof(IMostRecentlyUsedService)) as IMostRecentlyUsedService; if (mruService != null) { mruService.GetTargetFileDialogSettings(targetAlias, ref currentPath, ref fileSpec, ref this.left, ref this.top, ref this.width, ref this.height, ref this.nameWidth, ref this.dateWidth, ref this.sizeWidth); } if (fileSpec != null) { fileSpec = fileSpec.ToUpperInvariant(); } if (String.IsNullOrWhiteSpace(currentPath)) { currentPath = defaultPath; } if (String.IsNullOrEmpty(fileSpec) || (TargetOpenSaveFileData.fileTypes.FirstOrDefault((ft) => ft.Item1 == fileSpec) == null)) { fileSpec = defaultFileSpec; } int i = currentPath.IndexOf(Path.VolumeSeparatorChar); if (i >= 0) { this.drive = currentPath.Substring(0, i + 1); currentPath = currentPath.Substring(i + 1); } else { this.drive = String.Empty; } if (!currentPath.StartsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) { currentPath = Path.DirectorySeparatorChar.ToString() + currentPath; } this.client = client; this.targetAlias = targetAlias; this.currentPath = currentPath; this.fileSpec = fileSpec; Reload(); }