Exemple #1
0
        private void loadDeviceInfo()
        {
            System.Threading.ThreadStart ts = new System.Threading.ThreadStart (() => {
                DeviceInfo di = DeviceInfo.CurrentDevice;
            });

            ts.BeginInvoke (null, null);
        }
Exemple #2
0
 private void _Send(Uri uri, string method, Action <String> action)
 {
     System.Threading.ThreadStart start = new System.Threading.ThreadStart(delegate()
     {
         action(_Send(uri, method));
     });
     start.BeginInvoke(null, null);
 }
Exemple #3
0
 /// <summary>
 /// Esegue pulizia entry non più referenziate
 /// </summary>
 /// <param name="issync"></param>
 public void CleanDeadEntries(bool issync)
 {
     if (issync)
     {
         this.performCleanDeadEntries();
     }
     else
     {
         System.Threading.ThreadStart pr = this.performCleanDeadEntries;
         pr.BeginInvoke(null, null);
     }
 }
        private void DoTest_Put_ContentLength(byte[] requests, byte[] expectedResponses,
                                              int?expectedContentLengthHeaderValue)
        {
            ObexListenerContext ctx = DoTest(requests, expectedResponses);
            ObexListenerRequest req = ctx.Request;

            //
            if (expectedContentLengthHeaderValue.HasValue)
            {
                Assert.AreEqual(expectedContentLengthHeaderValue.Value, req.ContentLength64, "ContentLength64");
            }
            //
            AreEqualBuffers(NewWholeProcessTests_Data.SimplePut1_Data, (MemoryStream)req.InputStream);
            //
            MemoryStream data2 = new MemoryStream();

            System.Threading.ThreadStart dlgt = delegate {
                req.WriteFile(data2);
            };
            IAsyncResult ar        = dlgt.BeginInvoke(null, null);
            bool         signalled = ar.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(2));

            if (!signalled)
            {
                // Need to kill the WriteFile thread or there'll be big CPU usage!
                data2.Close(); // Cause WriteFile to fail!
                bool signalledAfter = ar.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(2));
                Assert.IsTrue(signalledAfter, "WriteFile aborted but still hung");
                try {
                    dlgt.EndInvoke(ar);
                } catch (ObjectDisposedException) {
                }
            }
            else
            {
                Assert.IsTrue(signalled, "WriteFile hung");
                dlgt.EndInvoke(ar);
            }
            AreEqualBuffers(NewWholeProcessTests_Data.SimplePut1_Data, data2);
            Assert.IsTrue(signalled, "WriteFile hung [end]");
        }
Exemple #5
0
 public void CancelWorker()
 {
     if (MyWorker != null && MyWorker.IsBusy)
     {
         MyWorker.CancelAsync();
         System.Threading.ThreadStart WaitThread = new System.Threading.ThreadStart(delegate() {
             while (MyWorker.IsBusy)
             {
                 System.Threading.Thread.Sleep(100);
             }
         });
         WaitThread.BeginInvoke(a => {
             Invoke((MethodInvoker) delegate() {    //Invoke your StuffAfterCancellation call back onto the UI thread
                 StuffAfterCancellation();
             });
         }, null);
     }
     else
     {
         StuffAfterCancellation();
     }
 }
        void TouchRunButton(object sender, EventArgs e)
        {
            if(_runButton.Title (UIControlState.Normal) == "Running")
                return;

            _runButton.SetTitle ("Running", UIControlState.Normal);
            UIApplication.SharedApplication.IdleTimerDisabled = true;

            System.Threading.ThreadStart ts = new System.Threading.ThreadStart (() => {

                MatrixTestEngine engine = new MatrixTestEngine ();
                _currentTests[0] = engine.RunCSTest ();
                _currentTests[1] = engine.RunCTest (false);
                _currentTests[2] = engine.RunCTest (true);

                this.InvokeOnMainThread ( () => {
                    this.TableView.ReloadData ();
                    _runButton.SetTitle ("Run", UIControlState.Normal);
                    UIApplication.SharedApplication.IdleTimerDisabled = false;
                });

                postResults ();
            });

            ts.BeginInvoke (null, null);
        }
Exemple #7
0
 public void LoadImage_Async()
 {
     System.Threading.ThreadStart thread = new System.Threading.ThreadStart(LoadImage);
     thread.BeginInvoke(null, null);
 }
Exemple #8
0
 public void LoadImage_Async()
 {
     System.Threading.ThreadStart thread = new System.Threading.ThreadStart(LoadImage);
     thread.BeginInvoke(null, null);
 }