コード例 #1
0
        public void addOnCanceledListenerTest()
        {
            Debug.Log("UploadTask addOnCanceledListenerTest");

            byte[] data     = new byte[100000];
            string filename = "addOnCanceledListenerTest.data";

            StorageReference storageReference = mAGCStorageManagement.getStorageReference(filename);
            UploadTask       task             = storageReference.putBytes(data, new FileMetadata());


            Debug.Log("add addOnCanceledListener");
            //task.addOnCanceledListener(new MyOnCanceledListener("MyOnCanceledListener"));

            MyOnCanceledListener actitvity_listener = new MyOnCanceledListener("ActivityListener");

            task.addOnCanceledListener(new Activity(), actitvity_listener);

            MyOnCanceledListener executor_listener = new MyOnCanceledListener("ExecutorListener");

            task.addOnCanceledListener(new MyExecutor("ExecutorListener"), executor_listener);

            MyOnCanceledListener listener = new MyOnCanceledListener("NormalListener");

            task.addOnCanceledListener(listener);

            Debug.Log("remove addOnCanceledListener");
            MyOnCanceledListener remove = new MyOnCanceledListener("remove");

            task.addOnCanceledListener(new Activity(), remove);
            task.removeOnCanceledListener(remove);

            // UnityEngine.Debug.Log("cancel");
            Debug.Log("task.isCanceled status: " + task.isCanceled());
            if (!task.isCanceled())
            {
                task.pause();
                task.cancel();
            }

            Debug.Log("after cancel: task.isCanceled status: " + task.isCanceled());

            Debug.Log("UploadTask addOnCanceledListenerTest success");
        }