private void onBrowserAddressChanged(object sender, AddressChangedEventArgs args) { String url = args.Address; Uri site = new Uri(url); if (site.GetLeftPart(UriPartial.Authority) == rootDomain) { Console.WriteLine("CALLBACK RECEIVED!"); String pState = HttpUtility.ParseQueryString(site.Query).Get("state"); String pCode = HttpUtility.ParseQueryString(site.Query).Get("code"); if (pState != this.state) { Console.WriteLine("States do not match! SECURITY BREACH!?!?!?"); return; } browser.AddressChanged -= onBrowserAddressChanged; PokeSync.Properties.Settings.Default.AuthorizationCode = pCode; PokeSync.Properties.Settings.Default.Save(); PokeSync.Properties.Settings.Default.Reload(); BeginInvoke(new Action(() => { this.Controls.Remove(browser); authWindow.Close(); refreshLinkStatus(); new Task(getAccessToken).Start(); })); } }
private void btn_save_Click(object sender, EventArgs e) { try { if (txt_right_old_sph.Text == "" || txt_right_old_cyl.Text == "" || txt_right_old_axis.Text == "" || txt_right_old_add.Text == "" || txt_left_old_sph.Text == "" || txt_left_old_cyl.Text == "" || txt_left_old_axis.Text == "" || txt_left_old_add.Text == "" || txt_left_present_sph.Text == "" || txt_left_present_cyl.Text == "" || txt_left_present_axis.Text == "" || txt_left_present_add.Text == "" || txt_right_present_sph.Text == "" || txt_right_present_cyl.Text == "" || txt_right_present_axis.Text == "" || txt_right_present_add.Text == "" || txt_right_bc.Text == "" || txt_right_pow.Text == "" || txt_right_dia.Text == "" || txt_right_desz.Text == "" || txt_left_bc.Text == "" || txt_left_pow.Text == "" || txt_left_dia.Text == "" || txt_left_desz.Text == "" || txt_trail.Text == "" || txt_refract.Text == "" || txt_special.Text == "" || txt_remarks.Text == "" || txt_kread.Text == "" || txt_blink.Text == "") { MSG.ERROR(this, "Fields can no be empty.If you want to leave a empty field please put (-) into text fields"); } else { NewContactLenseInvoice.fillFormTwo(txt_right_old_sph.Text, txt_right_old_cyl.Text, txt_right_old_axis.Text, txt_right_old_add.Text, txt_left_old_sph.Text, txt_left_old_cyl.Text, txt_left_old_axis.Text, txt_left_old_add.Text, txt_left_present_sph.Text, txt_left_present_cyl.Text, txt_left_present_axis.Text, txt_left_present_add.Text, txt_right_present_sph.Text, txt_right_present_cyl.Text, txt_right_present_axis.Text, txt_right_present_add.Text, txt_right_bc.Text, txt_right_pow.Text, txt_right_dia.Text, txt_right_desz.Text, txt_left_bc.Text, txt_left_pow.Text, txt_left_dia.Text, txt_left_desz.Text, txt_trail.Text, txt_refract.Text, txt_special.Text, txt_remarks.Text, txt_kread.Text, txt_blink.Text); NewContactLenseInvoice.save(this); new frm_orderComplete(Customer.id, NewContactLenseInvoice.OrderNumber, "LENSE").Show(); contactLense.Close(); this.Close(); } } catch (MySql.Data.MySqlClient.MySqlException) { MSG.ERROR(this, "Can not Save Please try again..."); } }