I want to do the following (C #)
- I have a form, call Form1
- Form1 creates Form2
- The Form2 constructor (GUI, variables ..) is executed. Latest Form2 instructions: create and show Form3
- Form 2 contains Label1
- Form2 creates Form3 and passes a link to Form3
- Form3 edit the shortcut1 (form2) many times (say 100)
This is normal ... everything works, but .. The problem is that Form3 takes a long time to start all operations (let it be 10 seconds). At the end (at the same time), two forms Form2 and Form3 are displayed, but I want Form2 to be visible BEFORE FORM3 because I want that although Form3 operations are performed (including editing label1 in Form2), Form2 shows each Label1 update (for example, "Execution: operation 1", then "Execution: operation 2", etc.).
I also tried to make the button (Button1) in Form2 by specifying the Button1_onClick () event and executing its contents using "create and show Form3". But when I press Button1, Form2 “disappears” (for example, when a Windows application is locked and it becomes “paused”), and it only shows the last label (“Operation: 100”) at the very moment that Form3 appears.
Summary of my question: -> I have 3 forms
- Form1
- Form 2 (labeled 1)
- Form3 (editing label 1 on form2)
-> What should happen:
- Form1 creates and displays Form2
- Form2 creates and shows Form3
- Form3 performs various operations (for example, creating a list, ordering it ...), and for each operation Label1 is updated (and the user MUST see the update process) in Form2
All Form2 operations are called from a function called in the Form2 constructor, like: Form2_Constructor () => call makeOperations () -> makeOperations () => call Operation1 (), then Operation2 (), and finally Operation3 (), where each operationX () contains a loop (say, out of 30 iterations) that performs some operation and calls Form2.setLabel1 ("Operation Name");
My idea (as the name says) is to make two different threads. .. or at least find a way to have two forms running in "parallel mode" (this way Form2 does not work when Form3 performs operations).
Any idea how to solve this problem?
source share