public void CreateAccount()
        {
            ErrorMessage = "";
            if (password == confirmPassword)
            {
                string creationResponse = RecipeHelper.CreateAccount(username, email, password);

                var creationResponseMessage = SimpleJson.SimpleJson.DeserializeObject(creationResponse);

                if (creationResponseMessage.GetType() == typeof(string))
                {
                    string SessionState = RecipeHelper.Login(username, password);
                    isError = false;
                    setSessionID(SessionState);
                    userSettings.InvokeAsync(username);
                    refreshParent.InvokeAsync("");
                }
                else
                {
                    //its probably errors
                    IList <object> creationResponseObject = (IList <object>)creationResponseMessage;

                    if (creationResponseObject.Count() > 0)
                    {
                        isError = true;
                        foreach (var i in creationResponseObject)
                        {
                            IDictionary <string, object> creationResponseItem = (IDictionary <string, object>)i;
                            object error = "";
                            creationResponseItem.TryGetValue("Description", out error);
                            ErrorMessage += "" + error + " ";
                        }
                    }
                }
            }
            else
            {
                isError      = true;
                ErrorMessage = "Passwords do not match";
            }
        }
Esempio n. 2
0
        public async void Login()
        {
            string SessionState = RecipeHelper.Login(Username, Password);

            if (SessionState != "false")
            {
                isError = false;
                setSessionID(SessionState);
                string test = await getSessionID();

                string sesh = state;
            }
            else
            {
                isError = true;
            }
            ErrorMessage = "Login Failed";

            if (!isError)
            {
                userSettings.InvokeAsync(Username);
                refreshParent.InvokeAsync("");
            }
        }