OpenFileDialog
class cAlgo.API Since 5.1
DesktopCLICloud
Represents a common dialog box that allows a user to specify a filename for one or more files to open.
Environment behaviour
CLI — not supported. No dialog can be shown in the CLI: ShowDialog returns FileDialogResult.None and the dialog settings are only stored.
Cloud — not supported. No dialog can be shown in the cloud: ShowDialog returns FileDialogResult.None and the dialog settings are only stored.
Definition
public class OpenFileDialog
Namespace: cAlgo.API · Group: Dialogs
Examples
using cAlgo.API;
namespace cAlgo.Robots;
public partial class TestExample : Robot
{
protected override void OnStart()
{
var openFileDialog = new OpenFileDialog
{
Title = "Select File(s)",
Multiselect = true,
AddExtension = true,
};
var result = openFileDialog.ShowDialog();
if (result == FileDialogResult.Cancel)
return;
foreach (var fileName in openFileDialog.FileNames)
{
Print(fileName);
}
}
}
import clr
clr.AddReference("cAlgo.API")
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
class Test():
def on_start(self):
openFileDialog = OpenFileDialog()
openFileDialog.Title = "Select File(s)"
openFileDialog.Multiselect = True
openFileDialog.AddExtension = True
result = openFileDialog.ShowDialog()
if result == FileDialogResult.Cancel:
return
for fileName in openFileDialog.FileNames:
api.Print(fileName)
{
"AccessRights": "None"
}
Constructors
| Name | Description |
|---|---|
| OpenFileDialogDesktopCLICloud | Creates an OpenFileDialog. |
Methods
| Name | Description |
|---|---|
ResetDesktopCLICloudvoid | Resets all dialog properties to their default values. |
ShowDialog 2 overloadsDesktopCLICloudFileDialogResult | Shows a file dialog, with the owner as the main Window |
Properties
| Name | Description |
|---|---|
AddExtensionDesktopCLICloudbool | Gets or sets a value indicating whether a file dialog automatically adds an extension to a file name if the user omits an extension. |
DefaultExtDesktopCLICloudstring | Gets or sets a value that specifies the default extension string to use to filter the list of files that are displayed. |
FileNameDesktopCLICloudstring | Gets a string containing the full path of the file selected in a file dialog. |
FileNamesDesktopCLICloudstring[] | Gets an array that contains one file name for each selected file. |
FilterDesktopCLICloudstring | Gets or sets the filter string that determines what types of files are displayed in file dialog. |
InitialDirectoryDesktopCLICloudstring | Gets or sets the initial directory that is displayed by a file dialog. |
MultiselectDesktopCLICloudbool | Gets or sets an option indicating whether OpenFileDialog allows users to select multiple files. |
TitleDesktopCLICloudstring | Gets or sets a string shown in the title bar of the dialog. If this property is null, a localized default from the operating system itself will be used. |
ValidateNamesDesktopCLICloudbool | Gets or sets a value indicating whether the dialog accepts only valid file names. |