Beispiel #1
0
        public void TestMultithread()
        {
            Thread uiThread = new Thread(delegate() {
                using (TestForm testForm = new TestForm()) {
                    using (System.Threading.Timer taskDelay = new System.Threading.Timer(delegate(object state) {
                        testForm.Close();
                    }, null, 7500, Timeout.Infinite)) {
                        Application.Run(testForm);
                    }
                }
            });

            uiThread.Start();

            Thread uiThread2 = new Thread(delegate() {
                using (TestForm testForm = new TestForm()) {
                    using (System.Threading.Timer taskDelay = new System.Threading.Timer(delegate(object state) {
                        testForm.Close();
                    }, null, 7500, Timeout.Infinite)) {
                        Application.Run(testForm);
                    }
                }
            });

            uiThread2.Start();

            uiThread.Join();
            uiThread2.Join();
        }
Beispiel #2
0
        public void TestMultithread()
        {
            int closeTimeout = Debugger.IsAttached ? 60000 * 5 : 7500;

            Thread uiThread = new Thread(delegate() {
                using (TestForm testForm = new TestForm()) {
                    using (System.Threading.Timer taskDelay = new System.Threading.Timer(delegate(object state) {
                        testForm.Close();
                    }, null, closeTimeout, Timeout.Infinite)) {
                        Application.Run(testForm);
                    }
                }
            });

            uiThread.Start();

            Thread uiThread2 = new Thread(delegate() {
                using (TestForm testForm = new TestForm()) {
                    using (System.Threading.Timer taskDelay = new System.Threading.Timer(delegate(object state) {
                        testForm.Close();
                    }, null, closeTimeout, Timeout.Infinite)) {
                        Application.Run(testForm);
                    }
                }
            });

            uiThread2.Start();

            uiThread.Join();
            uiThread2.Join();
        }
Beispiel #3
0
 public void TestMinimalCase()
 {
     using (TestForm testForm = new TestForm()) {
         using (System.Threading.Timer taskDelay = new System.Threading.Timer(delegate(object state) {
             testForm.Close();
         }, null, 7500, Timeout.Infinite)) {
             Application.Run(testForm);
         }
     }
 }