I create a stream. In a flow I cause function. In this function, I write the program code, simultaneously calling other functions.

//ΠŸΡ€ΠΈ Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ΅ Ρ„ΠΎΡ€ΠΌΡ‹ - создаём ΠΏΠΎΡ‚ΠΎΠΊ ΠΈ Π² ΠΏΠΎΡ‚ΠΎΠΊΠ΅ выполняСм "Π³Π»Π°Π²Π½ΡƒΡŽ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ". private void RadForm1_Load(object sender, EventArgs e) { Thread Main_thread = new Thread(main_function); Main_thread.Priority = ThreadPriority.Normal; Main_thread.Start(); } //А Π²ΠΎΡ‚ Ρ‚ΡƒΡ‚ ошибки public void main_function() { //Ѐункция ΠΏΠΎΠΊΠ°Π·Π° Ρ„ΠΎΡ€ΠΌΡ‹ ΠΈΠ· ΠΏΠΎΡ‚ΠΎΠΊΠ°. Код Π½ΠΈΠΆΠ΅ с ошибками - VS ΠΏΠΎΠ΄Ρ‡Π΅Ρ€ΠΊΠΈΠ²Π°Π΅Ρ‚ красным ΠΈ Π½Π΅ ΠΊΠΎΠΌΠΏΠΈΠ»ΠΈΡ€ΡƒΠ΅Ρ‚. this.Invoke(new Action(delegate {show_message_form("Π˜Π΄Π΅Ρ‚ Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ°.", 1)}); //Π­Ρ‚ΠΎ Π½Π΅ ΠΊΠΎΠΌΠΏΠΈΠ»ΠΈΡ€ΡƒΠ΅Ρ‚ //Ѐункция скрытия Ρ„ΠΎΡ€ΠΌΡ‹ ΠΈΠ· ΠΏΠΎΡ‚ΠΎΠΊΠ°. Код Π±Π΅Π· ошибок. this.Invoke(new Action(hide_message_form)); } //Π”Π°Π»Π΅Π΅ ΠΊΠΎΠ΄ Π΄Ρ€ΡƒΠ³ΠΈΡ… Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΉ (ΠΌΠΎΠΆΠ½ΠΎ Π½Π΅ ΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ) //Показ Ρ„ΠΎΡ€ΠΌΡ‹ с сообщСниСм public void show_message_form(string form_text, int show_progress_image) { RadForm3 RadForm3 = new RadForm3(); RadForm3.Show(); RadForm3.radLabel2.Text=form_text; if (show_progress_image == 1) RadForm3.pictureBox1.Visible = true; this.Hide(); } //Π‘ΠΊΡ€Ρ‹Ρ‚ΠΈΠ΅ Ρ„ΠΎΡ€ΠΌΡ‹ с сообщСниСм public void hide_message_form() { this.Show(); RadForm3 RadForm3 = new RadForm3(); RadForm3.Hide(); } 

How to call a function ( show_message_form("Π˜Π΄Π΅Ρ‚ Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ°.", 1) ) with arguments from a stream?

  • one
    An error message with which "does not compile" is of course not necessary, does it? - Vladimir Martyanov
  • one
    Well, the definition of the show_message_from function and hide_message_from would also be nice to see - Alexcei Shmakov
  • Vladimir - An error message with which "does not compile" did not result. "The code below with errors - VS underlines in red" - written impromptu / at random. I did not know what to write, I wrote what seemed more like the truth. - webdav
  • The error code may not help. But if you want ... this. Invoke (new Action (delegate {show_message_form ("Loading (update) directories. Please wait.", 1)}))); Error 1 Required; (after the closing parenthesis}) Error 2 expected) (following the closing parenthesis}), etc. These are syntax errors. I did not know what to write. Alexey code functions added. - webdav

1 answer 1

Replace the line with an error on this:

 this.Invoke(new Action(()=>{ show_message_form("Π˜Π΄Π΅Ρ‚ Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ°.", 1); } )); 
  • Works. But the RadForm3 form (// Hiding the form with the message) was not hidden. Strange. But the main thing is that your code works. - webdav
  • You in the code of the hide_message_form () method create a new form (RadForm3 RadForm3 = new RadForm3 ();) and hide it (RadForm3.Hide ();) and to hide the form created in show_message_form you need to refer to it. - Alexey