예제 #1
0
        private void _4()
        {
            //Probably equivalent like _2()
            WaitDelegate wd = Wait;
            IAsyncResult ar = wd.BeginInvoke(3000, null, null);

            while (ar.AsyncWaitHandle.WaitOne(50, true)) /* waiting */ } {
 public void WaitConnectionAsync()
 {
     if (connectState == ConnectState.born)
     {
         connectState = ConnectState.waitingConnection;
         waitDelegate.BeginInvoke(null, null);
     }
 }
예제 #3
0
        //Global variable for example _3 - not necessery (see third parameter BeginInvoke in _3)
        //private WaitDelegate wd;

        private void _3()
        {
            WaitDelegate wd = Wait;
            //Equivalent, but parameters are seen
            //AsyncCallback ac = new AsyncCallback(WaitCallback)

            //Is properly passing delegate instance like third (object) parameter
            IAsyncResult ar = wd.BeginInvoke(1000, WaitCallback, wd);
        }
 public void WaitConnectionAsync()
 {
     if (connectState == ConnectState.born)
     {
         connectState = ConnectState.waitingConnection;
         Console.WriteLine("名前付きパイプ:接続待ち開始");
         waitDelegate.BeginInvoke(null, null);
     }
 }
예제 #5
0
        /// <summary>
        /// Waits for millis milliseconds
        /// </summary>
        /// <param name="millis"></param>
        public void wait(int millis)
        {
            Wait         wait = new Wait();
            WaitDelegate wDel = new WaitDelegate(wait.waitFor);

            System.Console.WriteLine("CALLING WAIT " + millis);
            isSleep = true;
            wDel.BeginInvoke(millis, new AsyncCallback(CallBackMethod), wDel);
        }
예제 #6
0
파일: Room.cs 프로젝트: djdeathgirl/Jabbo
        public void sendRoomData(ConnectedUser User)
        {
            WaitDelegate X  = new WaitDelegate(sendRoomData2);
            IAsyncResult ar = X.BeginInvoke(User, null, null);

            ar.AsyncWaitHandle.WaitOne(1000, false);
            if (ar.IsCompleted)
            {
                X.EndInvoke(ar);
            }
        }
예제 #7
0
        private void _2()
        {
            //Cyclic polling
            WaitDelegate wd = Wait;
            IAsyncResult ar = wd.BeginInvoke(2000, null, null);

            //Running
            while (!ar.IsCompleted)
            {
                Console.WriteLine("!ar.IsCompleted");
                Thread.Sleep(100);
            }

            //Get result
            int res = wd.EndInvoke(ar);

            Console.WriteLine(res);

            //If the main process is terminated, so subprocess is terminate too
        }
예제 #8
0
파일: Room.cs 프로젝트: jabbo/Jabbo
 public void sendRoomData(ConnectedUser User)
 {
     WaitDelegate X = new WaitDelegate(sendRoomData2);
     IAsyncResult ar = X.BeginInvoke(User, null, null);
     ar.AsyncWaitHandle.WaitOne(1000, false);
     if (ar.IsCompleted)
     {
         X.EndInvoke(ar);
     }
 }
예제 #9
0
파일: Client.cs 프로젝트: sanchaz/PADITable
 /// <summary>
 /// Waits for millis milliseconds
 /// </summary>
 /// <param name="millis"></param>
 public void wait(int millis)
 {
     Wait wait = new Wait();
     WaitDelegate wDel = new WaitDelegate(wait.waitFor);
     System.Console.WriteLine("CALLING WAIT " + millis);
     isSleep = true;
     wDel.BeginInvoke(millis, new AsyncCallback(CallBackMethod), wDel);
 }