public dialogSelectFile(IPlatform platform, String path, dialogSelectFileMode mode, String extension, String extraComment) : base(platform) { dialogFormatSettings format = new dialogFormatSettings(dialogStyle.blueDialog, dialogSize.fullScreenBox); format.apply(this, platform); selector = new smartFilePathSelector(path, mode, extension, this.height, this.width, 0, 3); selector.doShowTitle = false; switch (mode) { case dialogSelectFileMode.selectFileToOpen: layoutTitleMessage = "Select file to open"; break; case dialogSelectFileMode.selectFileToSave: layoutTitleMessage = "Select file to save"; break; case dialogSelectFileMode.selectPath: layoutTitleMessage = "Select directory path"; break; } layoutStatusMessage = extraComment; addLayer(selector, layerBlending.transparent, 100); init(platform); }
/// <summary> /// Opens dialog to select file of extension /// </summary> /// <param name="__mode">Dialog mode</param> /// <param name="extension">The extension to filter files to</param> /// <param name="startPath">Initial file or directory to start selection from</param> /// <param name="comment">Aditional explanation</param> /// <param name="style">The style.</param> /// <param name="size">The size.</param> /// <returns>Selected path</returns> public static String openSelectFile(dialogSelectFileMode __mode, String extension = "*.*", String startPath = "", String comment = "", dialogStyle style = dialogStyle.redDialog, dialogSize size = dialogSize.fullScreenBox) { if (startPath == "") { startPath = appManager.Application.folder.path; } var format = new dialogFormatSettings(style, size); dialogSelectFile dialog = new dialogSelectFile(aceCommons.platform, startPath, __mode, extension, comment); inputResultCollection result = dialog.open(aceCommons.platform, format); FileSystemInfo defOutput; if (Path.HasExtension(startPath)) { defOutput = new FileInfo(startPath); } else { defOutput = new DirectoryInfo(startPath); } defOutput = result.getResultObject <FileSystemInfo>(defOutput); return(defOutput.FullName); }
public smartScreenFileSelector(T __app, string __title, String __path, dialogSelectFileMode __mode, String __extension) : base(__app, __title) { filePathSection = new smartFilePathSelector(__path, __mode, __extension, application.platform.height, application.platform.width, 0, 0); init(__app.platform); }
public static inputResultCollection open(IPlatform platform, String __path, dialogSelectFileMode __mode, String __extension = ".*", String extraComment = "") { dialogSelectFile dialog = new dialogSelectFile(platform, __path, __mode, __extension, extraComment); var format = new dialogFormatSettings(dialogStyle.redDialog, dialogSize.mediumBox); return(dialog.open(platform, format)); }
public smartFilePathSelector(String __path, dialogSelectFileMode __mode, String __ext, int _height, int __width, int __leftRightMargin = 0, int __leftRightPadding = 0) : base(new aceMenu(), _height, __width, __leftRightMargin, __leftRightPadding) { path = __path; selectMode = __mode; extension = __ext; margin.top = 1; margin.bottom = 2; pageManager = new textPageManager <aceMenuItem>(); refresh(); }
public fileSystemList(String path, dialogSelectFileMode mode, String extension = "") { if (String.IsNullOrEmpty(path)) { var pt = Directory.GetCurrentDirectory(); path = Environment.CurrentDirectory; } rootDirectory = new DirectoryInfo(path); if (rootDirectory.Exists) { selfPopulate(mode, extension); } }
protected void selfPopulate(dialogSelectFileMode mode, String extension) { pattern = "*".add(extension, "."); directories.Clear(); files.Clear(); if (rootDirectory != null) { directories.Add(rootDirectory); } if (rootDirectory.Parent != null) { directories.Add(rootDirectory.Parent); } switch (mode) { case dialogSelectFileMode.selectPath: foreach (var d in rootDirectory.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) { directories.Add(d); } break; case dialogSelectFileMode.selectFileToOpen: case dialogSelectFileMode.selectFileToSave: foreach (var d in rootDirectory.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) { directories.Add(d); } foreach (var d in rootDirectory.EnumerateFiles(pattern, SearchOption.TopDirectoryOnly)) { files.Add(d); } break; } }