private void Service_UserGetSpecificDone(object s, UserGetSpecificCompletedEventArgs e) { LOLConnectClient service = (LOLConnectClient)s; if (e.Error == null) { User result = e.Result; #if DEBUG if (result.Errors.Count > 0) System.Diagnostics.Debug.WriteLine ("Error getting user"); #endif userDetails.Add (result); newUserCount++; if (newUserCount < toBeGrabbed) service.UserGetSpecificAsync (AndroidData.CurrentUser.AccountID, newUsersToAdd [newUserCount], new Guid (AndroidData.ServiceAuthToken)); else { service.UserGetSpecificCompleted -= Service_UserGetSpecificDone; doTheAdding (userDetails); } } }
private void Service_UserGetSpecificDone(object s, UserGetSpecificCompletedEventArgs e) { LOLConnectClient service = (LOLConnectClient)s; if (e.Error == null) { User result = e.Result; #if DEBUG if (result.Errors.Count > 0) System.Diagnostics.Debug.WriteLine("Error getting user"); #endif newUsers.Add(result); counter++; if (counter < newUsersToAdd) service.UserGetSpecificAsync(AndroidData.CurrentUser.AccountID, UnknownUser.unknownUsers [counter], new Guid(AndroidData.ServiceAuthToken)); else { service.UserGetSpecificCompleted -= Service_UserGetSpecificDone; counter = 0; AddNewUsers(newUsers); } } }
private void Service_UserGetSpecificCompletedForSenders(object sender, UserGetSpecificCompletedEventArgs e) { LOLConnectClient service = (LOLConnectClient)sender; if (null == e.Error) { User result = e.Result; Pair<Queue<Guid>, Queue<Guid>> stateObj = (Pair<Queue<Guid>, Queue<Guid>>)e.UserState; Guid messageID = stateObj.ItemA.Dequeue (); Guid userID = stateObj.ItemB.Dequeue (); if (result.Errors.Count > 0) { #if DEBUG System.Diagnostics.Debug.WriteLine ("Error downloading user! {0}", StringUtils.CreateErrorMessageFromGeneralErrors (result.Errors.ToArray ())); #endif } else { dbm.InsertOrUpdateUser (result); // Assign the user to the corresponding message. this.MessageItems [messageID].MessageUser = UserDB.ConvertFromUser (result); }//end if else if (stateObj.ItemA.Count > 0) service.UserGetSpecificAsync (AndroidData.CurrentUser.AccountID, stateObj.ItemB.Peek (), new Guid (AndroidData.ServiceAuthToken), stateObj); else { service.UserGetSpecificCompleted -= Service_UserGetSpecificCompletedForSenders; fromLocalOnly = true; RunOnUiThread (delegate { if (progress != null) progress.Dismiss (); GetRowsForMessages (); CreatePreviewUI (); }); }//end if else } else { #if(DEBUG) System.Diagnostics.Debug.WriteLine ("Exception retrieving message sender! {0}--{1}", e.Error.Message, e.Error.StackTrace); #endif }//end if else }
private void Service_UserGetSpecificCompleted(object sender, UserGetSpecificCompletedEventArgs e) { LOLConnectClient service = (LOLConnectClient)sender; #if DEBUG System.Diagnostics.Debug.WriteLine("In Service_UserGetSpecificCompleted"); #endif if (null == e.Error) { LOLAccountManagement.User result = e.Result; if (result.Errors.Count > 0) { #if DEBUG System.Diagnostics.Debug.WriteLine("Error retrieving user: {0}", StringUtils.CreateErrorMessageFromGeneralErrors(result.Errors)); #endif } else { Queue<Guid> userQ = (Queue<Guid>)e.UserState; if (!dbm.CheckUserExists(userQ.Dequeue().ToString())) { // Insert the user to the database dbm.InsertOrUpdateUser(result); }//end if if (userQ.Count > 0) { service.UserGetSpecificAsync(AndroidData.CurrentUser.AccountID, userQ.Peek(), new Guid(AndroidData.ServiceAuthToken), userQ); } else { service.UserGetSpecificCompleted -= Service_UserGetSpecificCompleted; this.isMsgInProgress = false; } } } else { this.isMsgInProgress = false; #if(DEBUG) System.Diagnostics.Debug.WriteLine("Exception fetching user! {0}--{1}", e.Error.Message, e.Error.StackTrace); #endif } }
private void Service_UserGetSpecificCompleted(object sender, UserGetSpecificCompletedEventArgs e) { LOLConnectClient service = (LOLConnectClient)sender; if (null == e.Error) { User result = e.Result; if (result.Errors.Count > 0) { #if DBEUG System.Diagnostics.Debug.WriteLine ("Error retrieving user: {0}", StringUtils.CreateErrorMessageFromGeneralErrors (result.Errors.ToArray ())); #endif } else dbm.InsertOrUpdateUser (result); Pair<int, Pair<int, Queue<Guid>>> stateObj = (Pair<int, Pair<int, Queue<Guid>>>)e.UserState; stateObj.ItemB.ItemB.Dequeue (); if (stateObj.ItemB.ItemB.Count > 0) service.UserGetSpecificAsync (AndroidData.CurrentUser.AccountID, stateObj.ItemB.ItemB.Peek (), new Guid (AndroidData.ServiceAuthToken), stateObj); else { service.UserGetSpecificCompleted -= Service_UserGetSpecificCompleted; RunOnUiThread (delegate { if (progress != null) progress.Dismiss (); }); } } else { service.UserGetSpecificCompleted -= Service_UserGetSpecificCompleted; #if(DEBUG) System.Diagnostics.Debug.WriteLine ("Exception in UserGetSpecific! {0}--{1}", e.Error.Message, e.Error.StackTrace); #endif }//end if else }