Example #1
0
        public void OnException(App42Exception exception)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() => {
                switch (pivot.SelectedIndex)
                {
                case 0:
                    if (exception.GetAppErrorCode() == 1401)
                    {
                        MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                    }
                    else
                    {
                        UserOutput.Text = "Exception Caught successfully:-" + exception.Message;
                    }

                    break;

                case 1:
                    if (exception.GetAppErrorCode() == 1401)
                    {
                        MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                    }
                    else
                    {
                        StorageOutput.Text = "Exception Caught successfully:-" + exception.Message;
                    }
                    break;

                case 2:
                    if (exception.GetAppErrorCode() == 1401)
                    {
                        MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                    }
                    else
                    {
                        gameOutput.Text = "Exception Caught successfully:-" + exception.Message;
                    }
                    break;

                case 3:
                    if (exception.GetAppErrorCode() == 1401)
                    {
                        MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                    }
                    else
                    {
                        uploadOutput.Text = "Exception Caught successfully:-" + exception.Message;
                    }
                    break;
                }
            });
        }
        public void OnException(App42Exception exception)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() => {
            switch (pivot.SelectedIndex)
            {
                case 0:
                    if (exception.GetAppErrorCode() == 1401)
                    {
                        MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                    }
                    else
                    {
                        UserOutput.Text = "Exception Caught successfully:-" + exception.Message;
                    }

                    break;
                case 1:
                    if (exception.GetAppErrorCode() == 1401)
                    {
                        MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                    }
                    else
                    {
                        StorageOutput.Text = "Exception Caught successfully:-" + exception.Message;
                    }
                    break;
                case 2:
                    if (exception.GetAppErrorCode() == 1401)
                    {
                        MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                    }
                    else
                    {
                        gameOutput.Text = "Exception Caught successfully:-" + exception.Message;
                    }
                    break;
                case 3:
                    if (exception.GetAppErrorCode() == 1401)
                    {
                        MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                    }
                    else
                    {
                        uploadOutput.Text = "Exception Caught successfully:-" + exception.Message;
                    }
                    break;
            }
            });
        }
Example #3
0
        public void OnException(Exception e)
        {
            App42Exception exception    = (App42Exception)e;
            int            appErrorCode = exception.GetAppErrorCode();

            if (appErrorCode == 2001)
            {
            }
            App42Log.Console("Exception : " + e);
        }
Example #4
0
 public void OnException(App42Exception exception)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         if (exception.GetAppErrorCode() == 1401)
         {
             MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
         }
         else
         {
             MessageBox.Show(exception.Message);
         }
     });
 }
            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);
            }
Example #6
0
        public void OnException(App42Exception exception)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (exception.GetAppErrorCode() == 1401)
                {
                    MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
                }
                else
                {
                    MessageBox.Show(exception.Message);

                }
            });
        }
Example #7
0
    public string get_error_code(App42Exception e)
    {
        string error;

        try
        {
            error = (string)error_codes[e.GetAppErrorCode().ToString()];
        }
        catch
        {
            return e.Message;
        }

        return error;
    }
 public void OnException(App42Exception exception)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         if (exception.GetAppErrorCode() == 1401)
         {
             MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
         }
         else
         {
             MessageBox.Show(exception.Message);
             //UserOutput.Text = string.Empty;
             //UserOutput.Text = "Exception Caught successfully:-" + exception.Message;
         }
     });
 }
 public void OnException(App42Exception exception)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         if (exception.GetAppErrorCode() == 1401)
         {
             MessageBox.Show("Please Enter valid api key and secret key getting from AppHQ Management Console!!!", "App42 Security Exception", MessageBoxButton.OK);
         }
         else
         {
             MessageBox.Show(exception.Message);
             //UserOutput.Text = string.Empty;
             //UserOutput.Text = "Exception Caught successfully:-" + exception.Message;
         }
     });
 }
Example #10
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;
            }
 // callback when server return an Exception on storage query .
 void App42Callback.OnException(App42Exception exception)
 {
     if (exception.GetAppErrorCode().Equals(2601))
     {
         currentPage.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show("No one shared anything for you.");
         });
     }
     else
     {
         currentPage.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show(exception.Message.ToString());
         });
     }
    
 }
            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;
            }
Example #13
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;
        }
 // Call when storage has no document for share or receive image.
 void App42Callback.OnException(App42Exception exception)
 {
     if (exception.GetAppErrorCode().Equals(2601))
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show("You did not shared anything.");
         });
     }
     else
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show(exception.Message.ToString());
         });
     }
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         indicator.IsVisible = false;
     });
 }
Example #15
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();
        }
Example #16
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;
            }
Example #17
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;
            }
Example #18
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;
            }
Example #19
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;
		}
Example #20
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;
			}
 // callback when get an Exception.
 void App42Callback.OnException(App42Exception exception)
 {
     if (exception.GetAppErrorCode().Equals(3107))
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show("Currently No Comments Found On This Image.");
         });
     } 
     else if (exception.GetAppErrorCode().Equals(3106))
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show("Same Comment Could not be send.");
         });
     }
     else
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show(exception.Message.ToString());
         });
     }
     
 }
        public void OnException(Exception e)
        {
            App42Exception exception = (App42Exception)e;

            result = exception.GetAppErrorCode();
        }
Example #23
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;
			}
Example #24
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;
			}
Example #25
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);
			}
Example #26
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();
		}
Example #27
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;
			}