Discussion of article "Developing graphical interfaces based on .Net Framework and C# (part 2): Additional graphical elements" - page 2
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
A very serious error of working with C#-windows has been detected. If you move C#-window continuously, Terminal disappears from the screen after a few seconds, and the CPU-core load of terminal64.exe exceeds 100%. I have 8 cores, so the full core load in TaskManager at CPU is 12-13%. When the C#-window is moving, it is 19%.
Oh, that's cool. Tried it - it really disappears. Or rather, it doesn't disappear, but minimises to the tray, as if you pressed the "minimise" button.
As for 100% loading - I don't see it. Perhaps it's because you have it built in and I don't.
Removing GuiControllerElementsDemo manually through the Terminal menu leads to freezing for a few seconds.
There is such a thing. It happens only if the form is not closed manually beforehand. I don't know how to get round it yet. I tried to close the form in Deinit() in several ways, but none of them worked. If anyone knows how to do it, I will be grateful.
There's this. It happens only if you don't close the form manually beforehand. I don't know how to get around it yet. I tried several ways of extinguishing the form in Deinit(), but none of them worked. If anyone knows how to do it, I will be grateful.
why the standard handler private void Form2_FormClosing(object sender, FormClosingEventArgs e)
doesn't want to work?
when I was experimenting with dll an C#, for some reason everything crashed on exit because I didn't destroy the created components outside the form itself, that's how it was:
if I didn't destroy before closing the form from MQL - it slowed down terribly or crashed.
Oh, cool. I tried it and it does disappear. Or rather, it doesn't disappear, but minimises to the tray, as if the "minimise" button was pressed.
I tried to move the Terminal window itself (C# is not running). In about 10 seconds absolutely all windows (ME, browsers, etc.) minimised, leaving the desktop bare.
As for 100% loading - I don't see it. Perhaps it is really because you have it built in and I do not.
At the same time I monitored the execution of the Expert Advisor. Here is the result
You can clearly see that the Expert Advisor stopped its work while the Terminal window was moving.
At the same time I monitored the execution of the Expert Advisor. Here is the result
You can clearly see that the Expert Advisor stopped its work while the Terminal window was moving.
I made a check through the timer - I do not see any hangs. It sends everything to the log very quickly.
and why the standard handler private void Form2_FormClosing(object sender, FormClosingEventArgs e)
doesn't want to work?
when I was experimenting with dll an C#, for some reason everything crashed on exit because I didn't destroy the created components outside the form itself, that's how it was:
If I didn't destroy before closing the form from MQL, it slowed down terribly or crashed.
I tried to do through the standard form.Dispose(). That is, when GuiController::HideForm() is called, Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
I tried to do it through the standard form.Dispose(). That is, when GuiController::HideForm() is called, the Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
Here it is unloaded instantly.
It unloads instantlyhere.
Yes, I've seen your panel. What function do you use to unload?
I tried to do it through the standard form.Dispose(). That is, when GuiController::HideForm() is called, the Dispose of the corresponding form is called. Everything worked fine in the test application in C#. But it doesn't work in MT. But if we close the form manually before deleting the Expert Advisor, everything works fine.
You should definitely google it, some process is hanging around.
Alternatively, you still need to call Form.Close() for Windows to close the application.
https://stackoverflow.com/questions/3097364/c-sharp-form-close-vs-form-dispose
Not calling Close probably bypasses sending a bunch of Win32 messages which one would think are somewhat important though I couldn't specifically tell you why...
Close has the benefit of raising events (that can be cancelled) such that an outsider (to the form) could watch for FormClosing and FormClosed in order to react accordingly.
I'm not clear whether FormClosing and/or FormClosed are raised if you simply dispose the form but I'll leave that to you to experiment with.
Yes, I have seen your panel. What function do you use to unload?
public static class FormsMT5 { private static Form1 MainForm; private static Form2 OrderForm; private static Thread ThreadMainform, ThreadOrderForm; .................... public static void FormDeinit(int reason) { if (reason == 3 || reason == 5) return; if (MainForm != null) { MainForm.Close(); } if (OrderForm != null) { OrderForm.Close(); } if (ThreadMainform != null) ThreadMainform.Join(); if (ThreadOrderForm != null) ThreadOrderForm.Join(); MainForm = null; OrderForm = null; ThreadMainform = null; ThreadOrderForm = null; }Yes, I've seen your panel. What function do you use to unload?
That's Igor's panel. I just published it.