예제 #1
0
파일: Form1.cs 프로젝트: khiemnv/chatApp
        private async Task CheckOutAsync()
        {
            ContentSync   sync = new ContentSync();
            List <UInt64> ids  = await sync.GetIdsAsync("logs");


            //check out
            List <UInt64> oldIds = m_cp.GetIds("logs");
            List <UInt64> newIds;

            newIds = ids.FindAll(x => !oldIds.Contains(x));
            List <object> objs = await sync.GetObjAsync("logs", newIds);

            List <MyLog> checkOutLst = new List <MyLog>();

            foreach (var obj in objs)
            {
                checkOutLst.Add(obj as MyLog);
            }
            m_cp.AddLogs(checkOutLst);
        }
예제 #2
0
파일: Form1.cs 프로젝트: khiemnv/chatApp
        private async Task CheckInAsync()
        {
            ContentSync sync = new ContentSync();
            //List<UInt64> oldIds = null;
            //var task1 =  sync.GetIdsAsync("logs");
            //Task.Run(async ()=> oldIds = await sync.GetIdsAsync("logs"));
            //task1.RunSynchronously();
            //task1.Wait();
            //List<UInt64> oldIds = task1.Result;
            List <UInt64> oldIds = await sync.GetIdsAsync("logs");

            List <UInt64> ids = m_cp.GetIds("logs");
            //check in

            List <UInt64> newIds = ids.FindAll(x => !oldIds.Contains(x));

            List <MyLog> checkInLst = m_cp.GetLogs(newIds);
            await sync.PutLogAsync("logs", checkInLst);

            //var task2 = sync.PutLogAsync("logs", checkInLst);
            //task2.RunSynchronously();
            //task2.Wait();
        }