Esempio n. 1
0
        public void Start()
        {
            clientsList = new BindingList <Socket>();
            clientsList.RaiseListChangedEvents = true;

            AsyncOperationDelegate asyncDel = new AsyncOperationDelegate(StartServer);

            asyncDel.BeginInvoke(new AsyncCallback(EndServer), asyncDel);
        }
Esempio n. 2
0
        private void EndServer(IAsyncResult result)
        {
            lock (synclock)
            {
                clientsList.Clear();
            }

            AsyncOperationDelegate asyncDel = result.AsyncState as AsyncOperationDelegate;

            asyncDel.EndInvoke(result);
        }
Esempio n. 3
0
            public bool TryGetDelegate(
                [MaybeNullWhen(false)]
                out AsyncOperationDelegate asyncDelegate)
            {
                if (!this.IsImplemented)
                {
                    asyncDelegate = null !;
                    return(false);
                }

                asyncDelegate = this.Delegate !;
                return(true);
            }
Esempio n. 4
0
        private void EndConnect(IAsyncResult result)
        {
            AsyncOperationDelegate asyncDel = result.AsyncState as AsyncOperationDelegate;

            asyncDel.EndInvoke(result);

            stopped = true;

            if (OnStopped != null)
            {
                OnStopped(this);
            }
        }
 void Start()
 {
     var op1 = new AsyncOperationDelegate(CounterDelegate);
     var op2 = new AsyncOperationDelegate(CounterDelegate);
     var op3 = new AsyncOperationDelegate(CounterDelegate);
     op1.Success += (sender, e) => {
         Debug.Log("finish op1");
     };
     op2.Success += (sender, e) => {
         Debug.Log("finish op2");
     };
     op3.Success += (sender, e) => {
         Debug.Log("finish op3");
     };
     op1.Execute();
     op2.Execute();
     op3.Execute();
 }
Esempio n. 6
0
        public void Start()
        {
            AsyncOperationDelegate asyncDel = new AsyncOperationDelegate(ConnectToServer);

            asyncDel.BeginInvoke(new AsyncCallback(EndConnect), asyncDel);
        }