public void Init(CallBackArg <T> dispatchCall, T dispatchArgumentParameter, bool waitForExecution, bool safeMode)
 {
     this.safeMode         = safeMode;
     this.dispatchCallArg  = dispatchCall;
     this.dispatchArgParam = dispatchArgumentParameter;
     this.ValidateExecutionOnInit(waitForExecution);
 }
예제 #2
0
        public static THttpDown DoGet(string url, CallBackArg <THttpDown> callback, string contentType)
        {
            THttpDown hNHttpDwon = THttpDown.DoGet(url, callback);

            hNHttpDwon.SetContentType(contentType);
            return(hNHttpDwon);
        }
예제 #3
0
        public static THttpDown DoPost(string url, CallBackArg <THttpDown> callback, string contentType)
        {
            THttpDown hNHttpDwon = THttpDown.DoGet(url, callback);

            hNHttpDwon.SetContentType(contentType);
            hNHttpDwon.isGet          = false;
            hNHttpDwon.postParameters = new Dictionary <string, string>();
            return(hNHttpDwon);
        }
예제 #4
0
        public void DestroySelf()
        {
            this.url         = null;
            this.contentType = null;
            this.tag         = null;
            this.callback    = null;
            this.data        = null;
            bool flag = this.postParameters != null;

            if (flag)
            {
                this.postParameters.Clear();
            }
            this.postParameters = null;
        }
예제 #5
0
 public static void DispatchToMainThread <T>(CallBackArg <T> dispatchCall, T dispatchArgument, bool waitForExecution = false, bool safeMode = true)
 {
     if (MainThreadWatchdog.CheckIfMainThread())
     {
         if (dispatchCall != null)
         {
             dispatchCall(dispatchArgument);
         }
     }
     else
     {
         ThreadDispatchAction <T> t = new ThreadDispatchAction <T>();
         dispatchActions.Enqueue(t);
         t.Init(dispatchCall, dispatchArgument, waitForExecution, safeMode);
     }
 }
예제 #6
0
        public static THttpDown DoGet(string url, CallBackArg <THttpDown> callback)
        {
            bool      flag = THttpDown.IsDown(url, "");
            THttpDown result;

            if (flag)
            {
                Debug.Log(url + "正在下载中,请不 要重复下载!");
                result = null;
            }
            else
            {
                THttpDown hNHttpDwon = new THttpDown(url, callback);
                THttpDown.AddDown(hNHttpDwon);
                result = hNHttpDwon;
            }
            return(result);
        }
        public static void DispatchToMainThread <T>(CallBackArg <T> dispatchCall, T dispatchArgument, bool waitForExecution = false, bool safeMode = true)
        {
            bool flag = MainThreadWatchdog.CheckIfMainThread();

            if (flag)
            {
                bool flag2 = dispatchCall != null;
                if (flag2)
                {
                    dispatchCall(dispatchArgument);
                }
            }
            else
            {
                ThreadDispatchAction <T> threadDispatchAction = new ThreadDispatchAction <T>();
                MainThreadDispatcher.dispatchActions.Enqueue(threadDispatchAction);
                threadDispatchAction.Init(dispatchCall, dispatchArgument, waitForExecution, safeMode);
            }
        }
예제 #8
0
 public THttpDown(string url, CallBackArg <THttpDown> callback)
 {
     this.url      = url;
     this.callback = callback;
 }
예제 #9
0
 static void SumPrime(object _sender, CallBackArg _arg)
 {
     mSum += (_arg as PrimeCallBackArg).Prime;
 }
예제 #10
0
 static void PrintPrime(object _sender, CallBackArg _arg)
 {
     Console.Write((_arg as PrimeCallBackArg).Prime + ", ");
 }