コード例 #1
0
        public void ExecuteWrapper()
        {
            // C# way
            if (ProgressTask == null || ProgressTask.Status == TaskStatus.RanToCompletion)
            {
                ProgressTask = CreateTask();
                ProgressTask.Start();
            }
            else
            {
                CancelToken.Cancel();
                ProgressTask.Wait();
                object val = ProgressTask.Result;
                ProgressTask = null;
            }

            // Android way
            //if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb)
            //{
            //    ExecuteOnExecutor(AsyncTask.ThreadPoolExecutor);
            //}
            //else
            //{
            //    Execute();
            //}
        }