usingcAlgo.API;namespacecAlgo.Robots;[Robot(AccessRights = AccessRights.None)]publicclassTestExample:Robot{protectedoverridevoidOnStart(){vardropZone=newDropZone{Child=newTextBlock{Text="Drop / Select Files and Directories",BackgroundColor=Color.Blue,Height=200,Width=350,},IsDirectoryDropAllowed=true,// Only these extensions will be acceptedFilterExtensions=new[]{"txt","algo","cs"},HorizontalAlignment=HorizontalAlignment.Center,VerticalAlignment=VerticalAlignment.Center,};dropZone.Dropped+=args=>{// Here you can access the dropped files and directories, open, read, etc...foreach(varpathinargs.FilePaths){Print($"File or directory '{path}' dropped");}};Chart.AddControl(dropZone);}}
importclrclr.AddReference("cAlgo.API")# Import cAlgo API typesfromcAlgo.APIimport*# Import trading wrapper functionsfromrobot_wrapperimport*classTest():defon_start(self):dropZone=DropZone()dropZoneChild=TextBlock()dropZoneChild.Text="Drop / Select Files and Directories"dropZoneChild.BackgroundColor=Color.BluedropZoneChild.Height=200dropZoneChild.Width=350dropZone.Child=dropZoneChilddropZone.IsDirectoryDropAllowed=True# Only these extensions will be accepteddropZone.FilterExtensions=["txt","algo","cs"]dropZone.HorizontalAlignment=HorizontalAlignment.CenterdropZone.VerticalAlignment=VerticalAlignment.CenterdropZone.Dropped+=self.on_droppedapi.Chart.AddControl(dropZone)defon_dropped(self,args):# Here you can access the dropped files and directories, open, read, etc...forpathinargs.FilePaths:print(f"File or directory '{path}' dropped")
Properties
Child
Summary
Gets or sets the drop zone child object.
Signature
1
publicControlBaseChild{get;set;}
Return Value
ControlBase
FilterExtensions
Summary
Gets or sets the file extensions filter.
Signature
1
publicstring[]FilterExtensions{get;set;}
Return Value
string[]
IsDirectoryDropAllowed
Summary
Gets or sets whether user can drop directories or not.