예제 #1
0
        private void activate_btn_Click(object sender, RoutedEventArgs e)
        {
            string     Number1 = numver_txtbx.Text.Trim();
            string     ApiReq1 = "https://api.urbanpiper.com/api/v1/card/activate/?format=json&customer_phone=91#replace#&username=zubin_urbanpiper&api_key=12345";
            string     ApiReq2 = ApiReq1.Replace("#replace#", Number1);
            WebRequest request = WebRequest.Create(ApiReq2);

            //Stopwatch timer = new Stopwatch();
            //timer.Start();

            WebResponse response   = request.GetResponse();
            Stream      dataStream = response.GetResponseStream();

            //timer.Stop();
            //TimeSpan timetaken = timer.Elapsed;

            //numver_txtbx.Text = timetaken.TotalSeconds.ToString();

            DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ResposeData));
            ResposeData datagot = (ResposeData)serializer.ReadObject(dataStream);

            PayForm1 pf = new PayForm1(numver_txtbx.Text);

            string status = datagot.success;

            if (status == "False")
            {
                this.Hide();
                pf.ShowDialog();
            }
            else
            {
                congrats_lbl1.Visibility = Visibility.Visible;
                //this.Enabled = false;
                //WaitSomeTime();
                this.Hide();
                pf.ShowDialog();
            }

            /*
             * // Open the stream using a StreamReader for easy access.
             * StreamReader reader = new StreamReader(dataStream);
             * // Read the content.
             * string responseFromServer = reader.ReadToEnd();
             * // Display the content.
             * experi_txtbx.Text = responseFromServer;
             */
        }
예제 #2
0
        private void back_btn2_Click_1(object sender, RoutedEventArgs e)
        {
            Success_lbl2.Visibility = Visibility.Hidden;
            Failure_lbl2.Visibility = Visibility.Hidden;
            this.Hide();
            result_txtbx2.Text = null;
            PayForm1 pf2 = new PayForm1(numver_txtbx3.Text);

            pf2.ShowDialog();
        }