Skip to content

SaveFileDialog

class cAlgo.API Since 5.1

DesktopCLICloud

Represents a common dialog box that allows a user to specify a filename to save.

Environment behaviour

CLI — not supported. No dialog can be shown in the CLI: ShowDialog returns FileDialogResult.None, nothing is written and the dialog settings are only stored.

Cloud — not supported. No dialog can be shown in the cloud: ShowDialog returns FileDialogResult.None, nothing is written and the dialog settings are only stored.

Definition

public class SaveFileDialog

Namespace: cAlgo.API · Group: Dialogs

Examples

using cAlgo.API;

namespace cAlgo.Robots;

public partial class TestExample : Robot
{
    protected override void OnStart()
    {
        var saveFileDialog = new SaveFileDialog
        {
            Title = "Save File",
            AddExtension = true,
        };

        var result = saveFileDialog.ShowDialog();

        if (result == FileDialogResult.Cancel)
            return;

        saveFileDialog.WriteToFile("Write to selected user file here");
    }
}
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):
        saveFileDialog = SaveFileDialog()
        saveFileDialog.Title = "Save File"
        saveFileDialog.AddExtension = True

        result = saveFileDialog.ShowDialog()

        if result == FileDialogResult.Cancel:
            return

        saveFileDialog.WriteToFile("Write to selected user file here")
{
  "AccessRights": "None"
}

Constructors

Name Description
SaveFileDialogDesktopCLICloud Creates a SaveFileDialog.

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
WriteToFile 2 overloadsDesktopCLICloudvoid Writes data to selected file.

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.
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.
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.