MessageBox new alternative
MessageBox new alternative
23 Sep 2020, 19:07
Hi,
I am writing my first cAglo robot {using the desktop version} and I need to get a pop up message when a certain event happens.
Actually it would be perfect if it looks like the price levels alerts popup messages that you can set up manually.
I have been searching the API Reference and the site for an hour now and the only thing that I found is the MessageBox {which seems to be what I need} that is no longer available. What should I be using now?
Your help will be much appreciated!
Replies
westend.trading
15 Mar 2021, 21:25
RE: Here is what I found on the matter...
heliodorstar said:
So basically in cAlgo they don't have a message or alert popup so you have to used the generic System.Windows.Forms which should be referenced from "Manage References".
By default the AccessRights of the robot are set to None and when you try to access System.Windows.Forms you get a pretty nasty error. That thing alone cost me the whole evening looking for and testing all kinds of weird stuff.
Two things are to be done here: 1. First in Control Panel > Administrative Tools > Microsoft Net > Runtime Security Policy > Adjust Zone Security you need to put almost everything {except Untrusted Sites} to "Full Trust". And 2) {Yepp, you guessed right!} you need to change the robot AccessRights to "FullAccess". I assure you it is very easy to do when you know it ;)))
Next thing you write in your algo:
using System.Windows.Forms; // Of course ;)
...
var message = MessageBox.Show("New bar!"); // end of code
...and Voila! You get a really ugly Message {or Alert} Box!
I gonna find a way to make the thing much more pretty for I can't stand the present "beauty" of it for 15 hours a day!
Really helpful. Although it seems not to be necessary anymore to adjust Zone Security settings. Works just by adding forms reference and settings AccessRights to full.
@westend.trading
heliodorstar
23 Sep 2020, 23:41
Here is what I found on the matter...
So basically in cAlgo they don't have a message or alert popup so you have to used the generic System.Windows.Forms which should be referenced from "Manage References".
By default the AccessRights of the robot are set to None and when you try to access System.Windows.Forms you get a pretty nasty error. That thing alone cost me the whole evening looking for and testing all kinds of weird stuff.
Two things are to be done here: 1. First in Control Panel > Administrative Tools > Microsoft Net > Runtime Security Policy > Adjust Zone Security you need to put almost everything {except Untrusted Sites} to "Full Trust". And 2) {Yepp, you guessed right!} you need to change the robot AccessRights to "FullAccess". I assure you it is very easy to do when you know it ;)))
Next thing you write in your algo:
using System.Windows.Forms; // Of course ;)
...
var message = MessageBox.Show("New bar!"); // end of code
...and Voila! You get a really ugly Message {or Alert} Box!
I gonna find a way to make the thing much more pretty for I can't stand the present "beauty" of it for 15 hours a day!
@heliodorstar