/// <summary> /// 成功登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e) { if (webBrowser1.DocumentText.IndexOf("oauth_verifier") > -1) { //取得OauthVerify int startIndex = webBrowser1.DocumentText.IndexOf("oauth_verifier"); int endIndex = webBrowser1.DocumentText.IndexOf('\"', startIndex); string verifier = webBrowser1.DocumentText.Substring(startIndex + 15, endIndex - startIndex - 15); OAuthAccessToken accessToken = twitterService.GetAccessToken(requestToken, verifier); if (accessToken != null) { twitterService.AuthenticateWith(accessToken.Token, accessToken.TokenSecret); ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } } else { ButtonStateNext = WizardButtonState.Visible; } }
/// <summary> /// 成功登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e) { if (webBrowser1.DocumentText.IndexOf("oauth_verifier") > -1) { if (accessKey == "" || accessSecret == "") { //取得OauthVerify int startIndex = webBrowser1.DocumentText.IndexOf("oauth_verifier"); OauthVerify = webBrowser1.DocumentText.Substring(startIndex + 15, 6); //取得AccessToken if (GetAccessToken(appKey, appSecret, tokenKey, tokenSecret, OauthVerify) == false) { MessageBox.Show("获取acesskey出错"); return; } accessKey = tokenKey; accessSecret = tokenSecret; } WriteConfig(); ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } }
//-------------------------------------------------------------------------------- /// <summary> /// This method serves as a common constructor initialization location, /// and serves mainly to set the desired size of the container panel in /// the wizard form (see WizardFormBase for more info). I didn't want /// to do this here but it was the only way I could get the form to /// resize itself appropriately - it needed to size itself according /// to the size of the largest wizard page. /// </summary> public void InitPage() { ButtonStateNext &= ~WizardButtonState.Enabled; ButtonStateBack |= WizardButtonState.Enabled; InitializeComponent(); base.Size = Size; ParentWizardForm.DiscoverPagePanelSize(Size); }
/// <summary> /// 杂志选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbMagzine_SelectedIndexChanged(object sender, EventArgs e) { if (cmbMagzine.SelectedIndex != 0) { ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } }
/// <summary> /// 选择变化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chkMediaPublish_CheckedChanged(object sender, EventArgs e) { if (chkFtpUpload.Checked || chkMailSend.Checked || chkMediaPublish.Checked) { ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } }
/// <summary> /// 期号输入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtMagzineNo_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtMagzineNo.Text)) { ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } }
/// <summary> /// 选择变化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chkFaceBook_CheckedChanged(object sender, EventArgs e) { if (isSelected()) { ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } }
private void tBox_TextChanged() { if ((tBoxPhoneNumber.Text.Length == 13) && (tBoxFName.Text != "") && (tBoxLName.Text != "")) { clsGlobalVariables.FirstName = tBoxFName.Text; clsGlobalVariables.LastName = tBoxLName.Text; clsGlobalVariables.PhoneNumber = tBoxPhoneNumber.Text; ButtonStateNext |= WizardButtonState.Enabled; //ButtonStateCancel &= ~WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } }
private void WizardPagePayment_WizardPageActivated(object sender, WizardPageActivateArgs e) { ButtonStateBack &= ~WizardButtonState.Enabled; ButtonStateStart &= ~WizardButtonState.Enabled; ButtonStateNext &= ~WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); pesaPal.TotalCost = clsGlobalVariables.TotalCost; pesaPal.FirstName = clsGlobalVariables.FirstName; pesaPal.LastName = clsGlobalVariables.LastName; pesaPal.PhoneNumber = clsGlobalVariables.PhoneNumber; webBPesaPal.Navigate(pesaPal.GetPesapalUrl()); }
/// <summary> /// 清除文件列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClear_Click(object sender, EventArgs e) { lstMagFileList.Items.Clear(); if (lstMagFileList.Items.Count > 0) { ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } }
//-------------------------------------------------------------------------------- /// <summary> /// Fired when the user selects the USB buttons. In our case the /// "Next" button is disabled and the act of selecting one of the Picture sources /// button allows the user to proceed in the wizard. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void butUSB_Click(object sender, EventArgs e) { clsGlobalFunctions.CollectStatistics(sender); // collect statistics that the USB button was clicked by the user/client DriveLetter(); //Get the USB drive letter - the drive letter will be saved in a global variable if (clsGlobalVariables.USBDriveLetter != "") //if a removable drive is found, { UpdateButtons(sender); //update the Highlight/selection of the appropriate button, Prepare to navigate next } else //if no removable drive is found, do not highlight the selection of the USB button { ButtonStateNext &= ~WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); MessageBox.Show("Insert a USB disk first!!"); //inform the user to plug in a USB disk. } clsGlobalVariables.USB = true; //Store the selected function in preparation of the next wizard page. }
/// <summary> /// 文件追加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { string[] strs = txtMagzineFile.Text.Split(';'); foreach (string str in strs) { lstMagFileList.Items.Add(str); } if (lstMagFileList.Items.Count > 0) { ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } }
/// <summary> /// 成功登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e) { FacebookOAuthResult oauthResult; if (_fb.TryParseOAuthCallbackUrl(e.Url, out oauthResult)) { // The url is the result of OAuth 2.0 authentication FacebookOAuthResult = oauthResult; ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { // The url is NOT the result of OAuth 2.0 authentication. FacebookOAuthResult = null; ButtonStateNext = WizardButtonState.Visible; } }
private void timTransactionStatus_Tick(object sender, EventArgs e) { String Response = pesaPal.UpdateIpnTransactionStatus(pesaPal.ePay_transaction_tracking_id, pesaPal.ePay_merchant_reference); //COMPLETED, if (Response == "COMPLETED") { timTransactionStatus.Enabled = false; //show Completed message, PesaPal and exit webBPesaPal.Url = new Uri(htmlPath + "completed_epaystatus.html"); SaveDetails(Response); ButtonStateNext |= WizardButtonState.Enabled; ButtonStateCancel &= ~WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); retry = 0; return; } //FAILED or INVALID - COMPLETE FAILURE if ((Response == "FAILED") || (Response == "INVALID") || (retry == 10)) { timTransactionStatus.Enabled = false; //show error message, PesaPal contacts and exit webBPesaPal.Url = new Uri(htmlPath + "completefailure_epaystatus.html"); SaveDetails(Response); // btnMakePayment.Enabled = true; retry = 0; return; } //PENDING - RETRYING if (Response == "PENDING") { retry++; //show error message and wait before retry webBPesaPal.Url = new Uri(htmlPath + "retry.html"); } }
/// <summary> /// 文件选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSelect_Click(object sender, EventArgs e) { SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "PDF file|*.PDF"; if (dlg.ShowDialog() == DialogResult.OK) { txtMergePDFFile.Text = dlg.FileName; if (!string.IsNullOrEmpty(txtMergePDFFile.Text)) { ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } //txtCategory.Text = Path.GetFileName(Path.GetDirectoryName(dlg.FileNames[0])); } }
/// <summary> /// 封面文件选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSelectTop_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "PPT file|*.pptx"; if (dlg.ShowDialog() == DialogResult.OK) { txtTopTemplate.Text = dlg.FileName; if (!string.IsNullOrEmpty(txtBottomTemplateFile.Text) && !string.IsNullOrEmpty(txtTopTemplate.Text)) { ButtonStateNext |= WizardButtonState.Enabled; ParentWizardForm.UpdateWizardForm(this); } else { ButtonStateNext = WizardButtonState.Visible; } //txtCategory.Text = Path.GetFileName(Path.GetDirectoryName(dlg.FileNames[0])); } }
private void UpdateButtons(object sender) // Graphics update and preparation of the wizard buttons { Button SelBtn = sender as Button; //Get the ID of the clicked button //Clear selection of the buttons butUSB.BackColor = Color.White; butWeb.BackColor = Color.White; butBTooth.BackColor = Color.White; btnCamera.BackColor = Color.White; btnScanner.BackColor = Color.White; SelBtn.BackColor = Color.Pink; //Highlight the clicked button in color - Pink //this.ParentWizardForm.EnableNextButton(true); ButtonStateNext |= WizardButtonState.Enabled; // Enables the "NEXT" button ParentWizardForm.UpdateWizardForm(this); //Calls the update function of the wizard class //Clear all the global variables storing the selected function as the appropriate variable will be set in the calling function clsGlobalVariables.USB = false; clsGlobalVariables.WEB = false; clsGlobalVariables.BLUETOOTH = false; clsGlobalVariables.CAMERA = false; clsGlobalVariables.SCANNER = false; }