Example #1
0
        /// <summary>
        /// Asynchronously query synchronizing records.
        /// </summary>
        /// <param name="files"></param>
        /// <param name="page"></param>
        /// <param name="onOk"></param>
        /// <param name="onErr"></param>
        /// <returns>this</returns>
        public AlbumClientier asyncQuerySyncs(IList <IFileDescriptor> files, SyncingPage page, OnOk onOk, OnError onErr)
        {
            Task.Run(() =>
            {
                DocsResp resp = null;
                try
                {
                    AnsonHeader header = client.Header().act("album.c#", "query", "r/states", "query sync");

                    List <DocsResp> reslts = new List <DocsResp>(files.Count);

                    AlbumReq req = (AlbumReq) new AlbumReq().Syncing(page).A(A.selectSyncs);

                    for (int i = page.start; i < page.end & i < files.Count; i++)
                    {
                        IFileDescriptor p = files[i];
                        req.querySync(p);
                    }

                    AnsonMsg q = client.UserReq(uri, new AlbumPort(AlbumPort.album), req)
                                 .Header(header);


                    resp = (DocsResp)client.Commit(q, errCtx);

                    reslts.Add(resp);

                    onOk.ok(resp);
                }
                catch (Exception e) {
                    onErr.err(new MsgCode(MsgCode.exIo), uri, new string[] { e.GetType().Name, e.Message });
                }
            });
            return(this);
        }