Example #1
0
 public void Put(double sum, User user)
 {
     delPut.BeginInvoke(sum, this, user, new AsyncCallback(asyncResult => MessageBox.Show(delPut.EndInvoke(asyncResult))), null);
 }
Example #2
0
 public void Withdraw(double sum, User user)
 {
     IAsyncResult result = delWithDraw.BeginInvoke(sum, this, user, new AsyncCallback(asyncResult => MessageBox.Show(delWithDraw.EndInvoke(asyncResult))), null);
 }
Example #3
0
        static void Main(string[] args)
        {
            int sum, sum1;
            int mainThredId = Thread.CurrentThread.ManagedThreadId;

            Account account = new Account(200);

            account.RegisterHandler(new AccountStateHandler(Show_Message));

            AccountStateHandler handler = new AccountStateHandler(Show_Message);

            IAsyncResult result = handler.BeginInvoke("начало операции",
                                                      new AsyncCallback((incomingResult) =>
                                                                        Console.WriteLine(handler.EndInvoke(incomingResult))), null);

            Console.WriteLine("введите сумму");
            int.TryParse(Console.ReadLine(), out sum);
            account.Put(sum);

            Console.WriteLine("введите сумму для снятие суммы");
            int.TryParse(Console.ReadLine(), out sum1);
            account.Withdraw(sum1);


            Console.ReadLine();
        }