Exemple #1
0
        /// <summary>
        /// Starts an asynchronous service call that will notify callback when any response is done.
        /// </summary>
        /// <param name="device"></param>
        /// <param name="serviceCall"></param>
        /// <param name="callback"></param>
        /// <param name="state"></param>
        public void CallServiceAsync(
            UpDevice device,
            Call serviceCall,
            uOSServiceCallBack callback,
            object state = null
            )
        {
            uOSServiceCallInfo info = new uOSServiceCallInfo {
                device = device, call = serviceCall, asyncState = state
            };

            new Thread(new ThreadStart(
                           delegate()
            {
                try
                {
                    Response r = CallService(device, serviceCall);
                    PushEvent(callback, info, r, null);
                }
                catch (System.Exception e) { PushEvent(callback, info, null, e); }
            })
                       ).Start();
        }
Exemple #2
0
 private void PushEvent(uOSServiceCallBack callback, uOSServiceCallInfo info, Response r, System.Exception e)
 {
     PushEvent(new ServiceCallEvent { callback = callback, info = info, response = r, exception = e });
 }
Exemple #3
0
 /// <summary>
 /// Starts an asynchronous service call that will notify callback when any response is done.
 /// </summary>
 /// <param name="device"></param>
 /// <param name="serviceCall"></param>
 /// <param name="callback"></param>
 /// <param name="state"></param>
 public void CallServiceAsync(
     UpDevice device,
     Call serviceCall,
     uOSServiceCallBack callback,
     object state = null
 )
 {
     uOSServiceCallInfo info = new uOSServiceCallInfo { device = device, call = serviceCall, asyncState = state };
     new Thread(new ThreadStart(
         delegate()
         {
             try
             {
                 Response r = CallService(device, serviceCall);
                 PushEvent(callback, info, r, null);
             }
             catch (System.Exception e) { PushEvent(callback, info, null, e); }
         })
     ).Start();
 }
Exemple #4
0
 private void PushEvent(uOSServiceCallBack callback, uOSServiceCallInfo info, Response r, System.Exception e)
 {
     PushEvent(new ServiceCallEvent {
         callback = callback, info = info, response = r, exception = e
     });
 }