예제 #1
0
        public void FileUploadTest()
        {
            Byte[] data = null;
            using (var stream = File.OpenRead("R:/1.png"))
            {
                data = stream.ReadAsBytes();
            }

            var future = Bmob.FileUploadTaskAsync(new BmobLocalFile(data, "21.png"));

            FinishedCallback(future.Result, null);
        }
예제 #2
0
        // async方式异步请求处理,非阻塞访问
        private async void uploadBtn_Click(object sender, EventArgs e)
        {
            formstatus.Text = "正在上传...";

            var Result = await Bmob.FileUploadTaskAsync(fileText.Text);

            FinishedCallback(Result, resultText);

            bmobFile = Result;

            enterDba.Enabled = true;
            formstatus.Text  = "上传成功!";
        }
예제 #3
0
        public void FileUploadHugeTest()
        {
            try
            {
                Byte[] data = null;
                using (var stream = File.OpenRead("E:/local/opt/eclipse-jee-luna-R-win32-x86_64.zip"))
                {
                    data = stream.ReadAsBytes();
                }

                var future = Bmob.FileUploadTaskAsync(new BmobLocalFile(data, "超大文件.zip"));
                FinishedCallback(future.Result, null);
            }
            catch
            {
                return;
            }

            Assert.Fail("should throw exception. but it sees not!");
        }