示例#1
0
            public void OnException(App42Exception exception)
            {
                int appErrorCode  = exception.GetAppErrorCode();
                int httpErrorCode = exception.GetHttpErrorCode();

                string errorMsg = string.Empty;

                switch (appErrorCode)
                {
                case 4600:
                    errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
                    break;

                case 4601:
                    errorMsg = "USAGE ERROR: Friend request already sent for this user. Please add a different friend.";
                    break;

                case 4602:
                    errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
                    break;

                case 4603:
                    errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
                    break;

                case 4604:
                    // User has no friends yet so the App42 API's return this error code. This will always happen for new users
                    //	and user's with empty friends lists but it is not really an error
                    AppServices.operationSuccessful = true;
                    AppServices.app42LoadedFriends  = true;
                    return;

                case 4613:
                    errorMsg = "USAGE ERROR: The entered username is already on your friends list. Please add a different friend.";
                    break;

                default:
                    errorMsg = "ERROR: An error has occured. Please check your network connection and username entry and try again.";
                    break;
                }

                AppServices.operationSuccessful = false;
                AppServices.errorMessage        = errorMsg;
                AppServices.app42LoadedFriends  = true;

                //_friendsModel._page.SetProgressIndicatorAsync(false, string.Empty);
                //_friendsModel._page.EnableInputAsync();
                //_friendsModel._page.PrintMessage(errorMsg);
            }
示例#2
0
            public void OnException(App42Exception exception)
            {
                int appErrorCode  = exception.GetAppErrorCode();
                int httpErrorCode = exception.GetHttpErrorCode();

                string errorMsg = string.Empty;

                switch (appErrorCode)
                {
                case 1400:
                    errorMsg = "Network Error: The request parameters are invalid. Please check your network connection and try again.";
                    break;

                case 1401:
                    errorMsg = "Unauthorized Access Error: The client is not authorized to add a user.";
                    break;

                case 1500:
                    errorMsg = "Internal Server Error: Please try again.";
                    break;

                case 2200:
                    errorMsg = "Service Error: User by the given name does not exist.";
                    break;

                case 2201:
                    errorMsg = "Service Error: Session for user does not exist.";
                    break;

                case 2202:
                    errorMsg = "Service Error: Session with the given id does not exist.";
                    break;

                case 2203:
                    errorMsg = "Service Error: Bad request. The session for the given ID is already invalidated.";
                    break;

                default:
                    errorMsg = "Unknown Error: An unknown error has occured. Please check your network connection and try again.";
                    break;
                }

                AppServices.errorMessage        = errorMsg;
                AppServices.operationSuccessful = false;
                AppServices.app42LoggedIn       = true;
            }
            public void OnException(App42Exception exception)
            {
                int appErrorCode  = exception.GetAppErrorCode();
                int httpErrorCode = exception.GetHttpErrorCode();

                string errorMsg = string.Empty;

                switch (appErrorCode)
                {
                case 0:
                    errorMsg = "ENTRY ERROR: Username cannot be blank. Please try again.";
                    break;

                case 4600:
                    errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
                    break;

                case 4601:
                    errorMsg = "USAGE ERROR: Friend request already sent for this user. Please add a different friend.";
                    break;

                case 4602:
                    errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
                    break;

                case 4603:
                    errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
                    break;

                case 4613:
                    errorMsg = "USAGE ERROR: The entered username is already on your friends list. Please add a different friend.";
                    break;

                default:
                    errorMsg = "ERROR: An error has occured. Please check your network connection and username entry and try again.";
                    break;
                }

                AppServices.operationSuccessful = false;
                AppServices.errorMessage        = errorMsg;
                AppServices.operationComplete   = true;
            }
示例#4
0
        // This will be called if there is an error or if there is no session. Error handling is currently not implemented we just assume
        //	that there is no session
        public void OnException(App42Exception exception)
        {
            int appErrorCode  = exception.GetAppErrorCode();
            int httpErrorCode = exception.GetHttpErrorCode();

            if (appErrorCode == 2202)
            {
                // Handle here for Not Found (Session with the id '@sessionId' does not exist.)
                AppServices.operationSuccessful = false;
                AppServices.errorMessage        = "INPUT ERROR: User does not exist. Cannot check for session.";
                AppServices.isFriendOnline      = true;
                AppServices.operationComplete   = true;
                return;
            }
            // This is called when the user is simply offline. So it is not really an error.
            else if (appErrorCode == 2203)
            {
                // Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
                AppServices.isFriendOnline = false;
            }
            else if (appErrorCode == 1401)
            {
                // handle here for Client is not authorized
                AppServices.operationSuccessful = false;
                AppServices.errorMessage        = "NETWORK ERROR: Client not authorized to check for session.";
                AppServices.isFriendOnline      = true;
                AppServices.operationComplete   = true;
                return;
            }
            else if (appErrorCode == 1500)
            {
                // handle here for Internal Server Error
                AppServices.operationSuccessful = false;
                AppServices.errorMessage        = "NETWORK ERROR: An internal server error has occured while attempting check for a session.";
                AppServices.isFriendOnline      = true;
                AppServices.operationComplete   = true;
                return;
            }
            AppServices.operationSuccessful = true;
            AppServices.operationComplete   = true;
        }
示例#5
0
            public void OnException(App42Exception exception)
            {
                int appErrorCode  = exception.GetAppErrorCode();
                int httpErrorCode = exception.GetHttpErrorCode();

                if (appErrorCode == 4601)
                {
                    //Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick')
                }
                else if (appErrorCode == 1401)
                {
                    // handle here for Client is not authorized
                }
                else if (appErrorCode == 1500)
                {
                    // handle here for Internal Server Error
                }

                AppServices.operationSuccessful = false;
                AppServices.operationComplete   = true;
            }
示例#6
0
        public void OnException(App42Exception exception)
        {
            App42Exception ex            = (App42Exception)exception;
            int            appErrorCode  = exception.GetAppErrorCode();
            int            httpErrorCode = exception.GetHttpErrorCode();

            // Attempt to get the mutex to update the number of friends sessions processed
            AppServices.friendCountMutex.WaitOne();
            AppServices.numFriendsProcessed++;

            // If all friends have been processed we signify the main thread we are done
            if (AppServices.numFriendsProcessed == AppServices.friendsData.friendsList.Count)
            {
                AppServices.friendCountMutex.ReleaseMutex();
                AppServices.operationSuccessful = true;
                AppServices.app42LoadedFriends  = true;
                return;
            }

            AppServices.friendCountMutex.ReleaseMutex();
        }
示例#7
0
            public void OnException(App42Exception exception)
            {
                int appErrorCode  = exception.GetAppErrorCode();
                int httpErrorCode = exception.GetHttpErrorCode();

                string errorMsg = "";

                switch (appErrorCode)
                {
                case 2001:
                    errorMsg = "User Entry Error: Username already exists. Please try a different username.";
                    break;

                case 2005:
                    errorMsg = "User Entry Error: User with that email already exists. Please use a different email.";
                    break;

                case 1400:
                    errorMsg = "Network Error: The request parameters are invalid. Please check your network connection and try again.";
                    break;

                case 1401:
                    errorMsg = "Unauthorized Access Error: The client is not authorized to add a user.";
                    break;

                case 1500:
                    errorMsg = "Internal Server Error: Please try again.";
                    break;

                default:
                    errorMsg = "Unknown Error: An unknown error has occured. Please check your network connection and try again.";
                    break;
                }

                AppServices.operationSuccessful = false;
                AppServices.errorMessage        = errorMsg;
                AppServices.operationComplete   = true;
            }
示例#8
0
            public void OnException(App42Exception exception)
            {
                int appErrorCode  = exception.GetAppErrorCode();
                int httpErrorCode = exception.GetHttpErrorCode();

                string errorMsg = string.Empty;

                switch (appErrorCode)
                {
                case 4601:
                    errorMsg = "ERROR: Friend request already sent for this user. Please add a different friend.";
                    break;

                case 1401:
                    errorMsg = "NETWORK ERROR: Client not Authorized. Please try again later.";
                    break;

                case 1500:
                    errorMsg = "NETWORK ERROR: A server error has occured. Please try again later.";
                    break;

                default:
                    // This is called when there are no requests for the user or the user has never used the buddy service yet
                    //	so it is not an error and we set the OperationSuccessful to true
                    AppServices.operationSuccessful = true;
                    AppServices.app42LoadedRequests = true;
                    return;
                }

                //_friendsModel._page.SetProgressIndicatorAsync(false, string.Empty);
                //_friendsModel._page.DisplayFriendRequestsListAsync();
                //_friendsModel._page.EnableInputAsync();

                AppServices.operationSuccessful = false;
                AppServices.errorMessage        = errorMsg;
                AppServices.app42LoadedRequests = true;
            }
示例#9
0
			public void OnException(App42Exception exception)
			{
				int appErrorCode = exception.GetAppErrorCode();
				int httpErrorCode = exception.GetHttpErrorCode();

				string errorMsg = string.Empty;
				switch (appErrorCode)
				{
					case 0:
						errorMsg = "ENTRY ERROR: Username cannot be blank. Please try again.";
						break;
					case 4600:
						errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
						break;
					case 4601:
						errorMsg = "USAGE ERROR: Friend request already sent for this user. Please add a different friend.";
						break;
					case 4602:
						errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
						break;
					case 4603:
						errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
						break;
					case 4613:
						errorMsg = "USAGE ERROR: The entered username is already on your friends list. Please add a different friend.";
						break;
					default:
						errorMsg = "ERROR: An error has occured. Please check your network connection and username entry and try again.";
						break;
				}

				AppServices.operationSuccessful = false;
				AppServices.errorMessage = errorMsg;
				AppServices.operationComplete = true;
			}
示例#10
0
			public void OnException(App42Exception exception)
			{
				int appErrorCode = exception.GetAppErrorCode();
				int httpErrorCode = exception.GetHttpErrorCode();

				string errorMsg = string.Empty;
				switch (appErrorCode)
				{
					case 4601:
						errorMsg = "ERROR: Friend request already sent for this user. Please add a different friend.";
						break;					
					case 1401:
						errorMsg = "NETWORK ERROR: Client not Authorized. Please try again later.";
						break;
					case 1500:
						errorMsg = "NETWORK ERROR: A server error has occured. Please try again later.";
						break;
					default:
						// This is called when there are no requests for the user or the user has never used the buddy service yet
						//	so it is not an error and we set the OperationSuccessful to true
						AppServices.operationSuccessful = true;
						AppServices.app42LoadedRequests = true;
						return;
				}

				//_friendsModel._page.SetProgressIndicatorAsync(false, string.Empty);
				//_friendsModel._page.DisplayFriendRequestsListAsync();
				//_friendsModel._page.EnableInputAsync();

				AppServices.operationSuccessful = false;
				AppServices.errorMessage = errorMsg;
				AppServices.app42LoadedRequests = true;
			}
示例#11
0
			public void OnException(App42Exception exception)
			{
				int appErrorCode = exception.GetAppErrorCode();
				int httpErrorCode = exception.GetHttpErrorCode();

				string errorMsg = string.Empty;
				switch (appErrorCode)
				{
					case 4600:
						errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
						break;
					case 4601:
						errorMsg = "USAGE ERROR: Friend request already sent for this user. Please add a different friend.";
						break;
					case 4602:
						errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
						break;
					case 4603:
						errorMsg = "ENTRY ERROR: Username entered does not exist. Please try again.";
						break;
					case 4604:
						// User has no friends yet so the App42 API's return this error code. This will always happen for new users
						//	and user's with empty friends lists but it is not really an error
						AppServices.operationSuccessful = true;
						AppServices.app42LoadedFriends = true;
						return;
					case 4613:
						errorMsg = "USAGE ERROR: The entered username is already on your friends list. Please add a different friend.";
						break;
					default:
						errorMsg = "ERROR: An error has occured. Please check your network connection and username entry and try again.";
						break;
				}

				AppServices.operationSuccessful = false;
				AppServices.errorMessage = errorMsg;
				AppServices.app42LoadedFriends = true;

				//_friendsModel._page.SetProgressIndicatorAsync(false, string.Empty);
				//_friendsModel._page.EnableInputAsync();
				//_friendsModel._page.PrintMessage(errorMsg);
			}
示例#12
0
			public void OnException(App42Exception exception)
			{
				int appErrorCode = exception.GetAppErrorCode();
				int httpErrorCode = exception.GetHttpErrorCode();

				string errorMsg = string.Empty;

				switch (appErrorCode)
				{
					case 1400:
						errorMsg = "Network Error: The request parameters are invalid. Please check your network connection and try again.";
						break;
					case 1401:
						errorMsg = "Unauthorized Access Error: The client is not authorized to add a user.";
						break;
					case 1500:
						errorMsg = "Internal Server Error: Please try again.";
						break;
					case 2200:
						errorMsg = "Service Error: User by the given name does not exist.";
						break;
					case 2201:
						errorMsg = "Service Error: Session for user does not exist.";
						break;
					case 2202:
						errorMsg = "Service Error: Session with the given id does not exist.";
						break;
					case 2203:
						errorMsg = "Service Error: Bad request. The session for the given ID is already invalidated.";
						break;
					default:
						errorMsg = "Unknown Error: An unknown error has occured. Please check your network connection and try again.";
						break;
				}

				AppServices.errorMessage = errorMsg;
				AppServices.operationSuccessful = false;
				AppServices.app42LoggedIn = true;
			}
示例#13
0
			public void OnException(App42Exception exception)
			{
				int appErrorCode = exception.GetAppErrorCode();  
				int httpErrorCode = exception.GetHttpErrorCode();  
				if(appErrorCode == 4601)  
				{  
					//Handle here for Bad Request (The request parameters are invalid. Request already sent for user 'Nick')  
				}  
				else if(appErrorCode == 1401)  
				{  
					// handle here for Client is not authorized  
				}  
				else if(appErrorCode == 1500)  
				{  
					// handle here for Internal Server Error  
				}  

				AppServices.operationSuccessful = false;
				AppServices.operationComplete = true;
			}
示例#14
0
		public void OnException(App42Exception exception)
		{
			App42Exception ex = (App42Exception)exception;
			int appErrorCode = exception.GetAppErrorCode();
			int httpErrorCode = exception.GetHttpErrorCode();

			// Attempt to get the mutex to update the number of friends sessions processed
			AppServices.friendCountMutex.WaitOne();
			AppServices.numFriendsProcessed++;

			// If all friends have been processed we signify the main thread we are done
			if (AppServices.numFriendsProcessed == AppServices.friendsData.friendsList.Count)
			{
				AppServices.friendCountMutex.ReleaseMutex();
				AppServices.operationSuccessful = true;
				AppServices.app42LoadedFriends = true;
				return;
			}

			AppServices.friendCountMutex.ReleaseMutex();
		}
示例#15
0
		// This will be called if there is an error or if there is no session. Error handling is currently not implemented we just assume
		//	that there is no session
		public void OnException(App42Exception exception)
		{
			int appErrorCode = exception.GetAppErrorCode();
			int httpErrorCode = exception.GetHttpErrorCode();
			if (appErrorCode == 2202)
			{
				// Handle here for Not Found (Session with the id '@sessionId' does not exist.) 
				AppServices.operationSuccessful = false;
				AppServices.errorMessage = "INPUT ERROR: User does not exist. Cannot check for session.";
				AppServices.isFriendOnline = true;
				AppServices.operationComplete = true;
				return;
			}
			// This is called when the user is simply offline. So it is not really an error.
			else if (appErrorCode == 2203)
			{
				// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.) 
				AppServices.isFriendOnline = false;
			}
			else if (appErrorCode == 1401)
			{
				// handle here for Client is not authorized
				AppServices.operationSuccessful = false;
				AppServices.errorMessage = "NETWORK ERROR: Client not authorized to check for session.";
				AppServices.isFriendOnline = true;
				AppServices.operationComplete = true;
				return;
			}
			else if (appErrorCode == 1500)
			{
				// handle here for Internal Server Error  
				AppServices.operationSuccessful = false;
				AppServices.errorMessage = "NETWORK ERROR: An internal server error has occured while attempting check for a session.";
				AppServices.isFriendOnline = true;
				AppServices.operationComplete = true;
				return;
			}
			AppServices.operationSuccessful = true;
			AppServices.operationComplete = true;
		}