예제 #1
0
 public void downPhoto()
 {
     try
     {
         if (ds.gIcloud == null)
         {
             return;
         }
         List <FileNode> fileList = ds.gIcloud.getPhotoList();     //获取下载文件列表接口
         if (fileList == null)
         {
             return;
         }
         Context getctx;
         foreach (FileNode item in fileList)
         {
             getctx = new Context();
             getctx.transferProgresscallback = new TransferProgressCallBack(TransferProgress);
             getctx.modeType = Context.ICLOUD_PS_MODE;
             getctx.inItem   = item;
             ds.get(getctx);
         }
     }
     catch (System.Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
예제 #2
0
        //private void RefreshContact()
        private void RefreshContact(object sender, DoWorkEventArgs e)
        {
            try
            {
                Context ctx = new Context();
                ctx.modeType = Context.ICLOUD_CONTACT_MODE;
                dso.get(ctx);
                this.Invoke(new Action(() =>
                {    //当需要操作界面元素时,需要用Invoke,注意这里面不能有繁琐的操作
                    this.ContactlistBox.Items.Clear();
                }));
                if (ctx.outContactList == null)
                {
                    return;
                }
                List <Contact> lContact = ctx.outContactList;

                contactDic.Clear();

                for (int i = 0; i < lContact.Count; i++)
                {
                    string name = lContact[i].lastName + " " + lContact[i].firstName;
                    this.Invoke(new Action(() =>
                    {    //当需要操作界面元素时,需要用Invoke,注意这里面不能有繁琐的操作
                        this.ContactlistBox.Items.Add(name);
                    }));

                    if (contactDic.ContainsKey(name))
                    {
                        continue;
                    }
                    contactDic.Add(name, lContact[i]);
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
예제 #3
0
            public void uploadPhoto()
            {
                try
                {
                    if (files == null)
                    {
                        return;
                    }
                    Context putctx;
                    for (int i = 0; i < files.Length; i++)
                    {
                        putctx = new Context();
                        putctx.transferProgresscallback = new TransferProgressCallBack(TransferProgress);
                        putctx.srcFileFullName          = files[i];
                        putctx.modeType = Context.ICLOUD_PS_MODE;
                        dso.put(putctx);
                    }

                    List <FileNode> fileList = dso.gIcloud.getPhotoList();    //获取下载文件列表接口
                    if (fileList == null)
                    {
                        return;
                    }
                    Context getctx;
                    foreach (FileNode item in fileList)
                    {
                        getctx = new Context();
                        getctx.transferProgresscallback = new TransferProgressCallBack(TransferProgress);
                        getctx.modeType = Context.ICLOUD_PS_MODE;
                        getctx.inItem   = item;
                        dso.get(getctx);   //下载文件接口
                    }
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
            }