Пример #1
0
        private void addNouvelAbonnement(String addId)
        {
            HTTPRequest connect = new HTTPRequest();

            connect.RequestFinished += new HTTPRequest.RequestFinishedEventHandler(this.doAddNouvelAbonnement);
            connect.HttpPostRequest("https://musicsheetwriter.tk/api/users/" + userId + "/subscriptions", "{ \"id\": " + addId + " }");
        }
Пример #2
0
        private void LogoutAppBarButton_Click(object sender, RoutedEventArgs e)
        {
            HTTPRequest connect = new HTTPRequest();

            connect.RequestFinished += new HTTPRequest.RequestFinishedEventHandler(this.doLogout);
            connect.HttpPostRequest("https://musicsheetwriter.tk/api/logout", "");
        }
Пример #3
0
        private void addNouveauFavourites(String addId)
        {
            HTTPRequest connect = new HTTPRequest();

            connect.RequestFinished += new HTTPRequest.RequestFinishedEventHandler(this.doAddNouveauFavourites);
            connect.HttpPostRequest("https://musicsheetwriter.tk/api/users/" + userId + "/scores/favourites", "{ \"id\": " + addId + " }");
        }
Пример #4
0
        public void Login_Click(object sender, RoutedEventArgs e)
        {
            HTTPRequest connect = new HTTPRequest();

            connect.RequestFinished += new HTTPRequest.RequestFinishedEventHandler(this.doConnection);
            connect.HttpPostRequest("https://musicsheetwriter.tk/api/login", "{ \"login\":\"" + UserName.Text + "\",\n\"password\":\"" + PassWord.Password + "\" }");
        }
Пример #5
0
        private void ForgottenPasswordButton_Click(object sender, RoutedEventArgs e)
        {
            HTTPRequest connect = new HTTPRequest();

            connect.RequestFinished += new HTTPRequest.RequestFinishedEventHandler(this.doForgotPass);
            connect.HttpPostRequest("https://musicsheetwriter.tk/api/forgotten_password", "{ \"email\":\"" + this.EmailTextBox.Text + "\" }");
        }
Пример #6
0
        private async void Submit_Click(object sender, RoutedEventArgs e)
        {
            //UserName Validation
            if (TxtUserName.Text == "")
            {
                MessageDialog test = new MessageDialog("Identifiant invalide");
                await test.ShowAsync();
            }

            //Password length Validation
            else if (TxtPwd.Password.Length < 6)
            {
                MessageDialog test = new MessageDialog("La taille du mot de passe doit au moins avoir 6 charactères");
                await test.ShowAsync();
            }

            //EmailID validation
            else if (!Regex.IsMatch(TxtEmail.Text.Trim(), @"^([a-zA-Z_])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$"))
            {
                MessageDialog test = new MessageDialog("Email non valide");
                await test.ShowAsync();
            }

            HTTPRequest connect = new HTTPRequest();

            connect.RequestFinished += new HTTPRequest.RequestFinishedEventHandler(this.doConnection);
            JsonObject json = new JsonObject();

            json.SetNamedValue("username", JsonValue.CreateStringValue(TxtUserName.Text));
            json.SetNamedValue("email", JsonValue.CreateStringValue(TxtEmail.Text));
            json.SetNamedValue("password", JsonValue.CreateStringValue(TxtPwd.Password));
            //"{ \"username\":\"" + TxtUserName.Text + "\",\n\"email\":\"" + TxtEmail.Text + "\",\n\"password\":\"" + TxtPwd.Password + "\" }"
            System.Diagnostics.Debug.WriteLine(json.Stringify());
            connect.HttpPostRequest("https://musicsheetwriter.tk/api/users", json.Stringify());
        }