Skip to content

FileAssociations.FileOpened

event · FileAssociations · cAlgo.API Since 5.1

DesktopCLICloud

Event triggered when a file associated with a registered extension is opened.

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

event Action<FileAssociationsFileOpenedEventArgs> FileOpened;
api.FileAssociations.FileOpened += handler  # handler(obj: FileAssociationsFileOpenedEventArgs)

Examples

protected override void OnStart()
{
    FileAssociations.Add(".mydata");
    FileAssociations.FileOpened += OnFileOpened;
}

private void OnFileOpened(FileAssociationsFileOpenedEventArgs args)
{
    Print("User opened file: {0}", args.FilePath);
}
def on_start(self):
    api.FileAssociations.Add(".mydata")
    api.FileAssociations.FileOpened += self.on_file_opened

def on_file_opened(self, args):
    api.Print(f"User opened file: {args.FilePath}")