Example #1
0
        private async Task ConnectionChanged()
        {
            try
            {
                await OAuthHelper.SyncOfflineItems();
            }
            catch (Exception ex)
            {
                //ShowError(ex.Message);
            }

            //var userCredentials = App.DAUtil.GetMasterInfoByName("UserCredentials");
            //if (userCredentials != null)
            //{
            //    var cred = JsonConvert.DeserializeObject<dynamic>(userCredentials.content);
            //    string uName = cred.Username;
            //    string pwd = cred.Password;

            //    await OAuthHelper.GetAuthenticationHeader(uName, pwd).ContinueWith(async (x) =>
            //    {
            //        try
            //        {
            //            await OAuthHelper.SyncOfflineItems();
            //        }
            //        catch (Exception ex)
            //        {
            //            ShowError(ex.Message);
            //        }
            //    }).ConfigureAwait(false);
            //}
        }
Example #2
0
        public async static Task SyncOfflineItemsBG()
        {
            try
            {
                var updatedCount = await OAuthHelper.SyncOfflineItems();

                if (updatedCount > 0)
                {
                    CrossLocalNotifications.Current.Show("", "Offline items has been synced");
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
        public async Task SyncLocalData()
        {
            try
            {
                await OAuthHelper.SyncOfflineItems();

                var users = await SPUtility.GetUsersForPicker();

                if (users != null)
                {
                    App.peoplePickerDataSource = new List <PeoplePicker>(users);
                }
            }
            catch (Exception ex)
            {
                ShowError(string.Format("Unable to sync local info: {0}", ex.Message));
            }
        }