예제 #1
0
        private void register_event(string msg)
        {
            string entry_text = DateTime.Now.ToLongTimeString() + " --- " + msg;

            var add_entry = new AddCallDelegate(listBox_events.Items.Add);

            //Invoke(add_entry, new object[] { entry_text });
            add_entry(entry_text);

            listBox_events.SelectedIndex = listBox_events.Items.Count - 1;
            listBox_events.SelectedIndex = -1;
        }
예제 #2
0
 private void AddCallToListBox(Call call)
 {
     if (this.UnsortedCallsListBox.InvokeRequired && this.UnsortedCallsListBox != null)
     {
         AddCallDelegate d = new AddCallDelegate(AddCallToListBox);
         this.Invoke(d, new object[] { call });
     }
     else
     {
         this.UnsortedCallsListBox.Items.Add(call.GetCallInfo());
     }
 }
예제 #3
0
        private void CallWithCreateObjectAsync(TestService serviceToUse)
        {
            RetrieveAdderDelegate rad = new RetrieveAdderDelegate(serviceToUse.RetrieveAdder);
            // async call
            IAsyncResult ar1 = rad.BeginInvoke(null, null);

            System.Int32 arg1 = m_random.Next(100);
            System.Int32 arg2 = m_random.Next(100);

            // wait for response
            Adder result1 = rad.EndInvoke(ar1);

            Assertion.AssertNotNull(result1);

            AddCallDelegate acd = new AddCallDelegate(result1.Add);
            // async call
            IAsyncResult ar2 = acd.BeginInvoke(arg1, arg2, null, null);

            // wait for response
            System.Int32 result2 = acd.EndInvoke(ar2);
            Assertion.AssertEquals((System.Int32)arg1 + arg2, result2);
        }
예제 #4
0
 private void CallWithCreateObjectAsync(TestService serviceToUse) {
     RetrieveAdderDelegate rad = new RetrieveAdderDelegate(serviceToUse.RetrieveAdder);
     // async call
     IAsyncResult ar1 = rad.BeginInvoke(null, null);
     
     System.Int32 arg1 = m_random.Next(100);
     System.Int32 arg2 = m_random.Next(100);
     
     // wait for response
     Adder result1 = rad.EndInvoke(ar1);
     Assertion.AssertNotNull(result1);
                 
     AddCallDelegate acd = new AddCallDelegate(result1.Add);
     // async call
     IAsyncResult ar2 = acd.BeginInvoke(arg1, arg2, null, null);
     // wait for response
     System.Int32 result2 = acd.EndInvoke(ar2);                                                         
     Assertion.AssertEquals((System.Int32) arg1 + arg2, result2);
 }