コード例 #1
0
ファイル: Login.xaml.cs プロジェクト: nevver/ChronosClient
        /// <summary>
        /// Login action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void login_Click(object sender, RoutedEventArgs e)
        {
            DataContainer.User = userID_Box.Text.ToString();

            if (check_Input() == false)
            {
                enable_Buttons(false);
                try
                {
                    HttpResponseMessage responseMessage = await "https://chronoschat.co/authenticate".PostUrlEncodedAsync(new
                    {
                        email    = userID_Box.Text.ToString(),
                        password = password_Box.Password.ToString()
                    });

                    string login_Response = await responseMessage.Content.ReadAsStringAsync();

                    string    sent = responseMessage.ToString();
                    jsonParse json = JsonConvert.DeserializeObject <jsonParse>(login_Response);
                    DataContainer.Token = json.auth_token.ToString();
                    update_StatusBar("blue");
                    update_StatusText("Authenticated!");
                    Debug.WriteLine(sent);
                    Debug.WriteLine(login_Response.ToString());
                    Debug.WriteLine(DataContainer.Token);
                    Boolean keyCheck = await checkKeysDirectory();

                    if (keyCheck == false)
                    {
                        Frame.Navigate(typeof(AsymmetricKeys));
                    }
                    else if (keyCheck == true)
                    {
                        Frame.Navigate(typeof(ListUsers));
                    }
                }
                catch (FlurlHttpException ex)
                {
                    update_StatusBar("red");
                    update_StatusText("User must be registered to login. Try again.");
                    Debug.WriteLine(ex.ToString());
                }
                catch (HttpRequestException hre)
                {
                    update_StatusBar("red");
                    update_StatusText("Login failed. Try again.");
                    Debug.WriteLine(hre.ToString());
                }
                catch (Exception ex)
                {
                    update_StatusBar("red");
                    update_StatusText("Login failed. Contact administrator.");
                    Debug.WriteLine(ex.ToString());
                }
            }
        }
コード例 #2
0
        protected void ButtonGo2_Click(object sender, EventArgs e)
        {
            jsonParse jp  = new jsonParse();
            string    zip = DropDownListZip.SelectedItem.Text;

            switch (zip)
            {
                //case :
            }
        }
コード例 #3
0
        protected void ButtonGo_Click(object sender, EventArgs e)
        {
            DropDownListState.Items.Clear();
            DropDownListZip.Items.Clear();
            jsonParse test    = new jsonParse();
            JArray    tempArr = test.parseLocation(TextBoxIn.Text);
            //Response.Write(test.parseLocation(TextBoxIn.Text));
            //LabelOut.Text = test.parseLocation[]
            int dataLength = tempArr.Count();

            //List<string> tempList = new List<string>();
            for (int i = 0; i < dataLength; i++)
            {
                DropDownListState.Items.Add(tempArr[i]["AdministrativeArea"]["ID"].ToString());
            }
            for (int i = 0; i < dataLength; i++)
            {
                DropDownListZip.Items.Add(tempArr[i]["PrimaryPostalCode"].ToString());
            }
            //LabelOut.Text = tempList.ToString();
        }