Hallo,
Ich habe ne Frage:
Wie kann mein Programm weiter laufen wenn ich zuvor Application.Run aufgerufen habe.
ein kleines Beispiel:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
| public class ProgramTEST { public ProgramTEST() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MyApplicationContext(new string[] {})); }
public ControlTester buttonTester;
public void Test() { buttonTester = new ControlTester("_okButton", "myForm");
buttonTester.FireEvent("Click"); } } |
Ich kann auch so was nicht benutzen: (es darf nicht instanziert werden, wegen andere Sachen, wie unter anderen Backgroundworker)
C#-Quelltext
1: 2:
| MyMainForm myForm = new MyMainForm(); myForm.ShowDialog(); |
ich habe sowas probiert, aber man kann es nicht debugen und es funktioniert nicht ganz gut, aber das ist mein Ziel:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7:
| public ProgramTEST() { ApplicationTestStart _applicationTestStart = new ApplicationTestStart(); ThreadStart ts = new ThreadStart(_applicationTestStart.Run); Thread t1 = new Thread(ts); t1.Start(); } |
und:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
| public class ApplicationTestStart { public ApplicationTestStart() { }
public void Run() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(fals e); Application.Run(new MyApplicationContext(new string[] {})); } } |
Moderiert von
Christian S.: Code- durch C#-Tags ersetzt