/// <summary> /// Change status bar event. /// </summary> /// <param name="sender"> Object sender.</param> /// <param name="e"> Event Args.</param> public void inspector_ChangeStatusBarPanelEvent(object sender,ChangeStatusBarEventArgs e) { stStatus.Panels[e.Index].Text=e.Text; if (e.ClickDelegate!=null) { stStatus.Click+=e.ClickDelegate; } }
/// <summary> /// Sets the html text editor caret change. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtEditor_CaretChange(object sender, EventArgs e) { SyntaxBoxControl editor = (SyntaxBoxControl)sender; ChangeStatusBarEventArgs args = new ChangeStatusBarEventArgs(); if ( ( editor != null ) && ( editor.Caret != null ) && ( editor.Caret.CurrentRow != null ) ) { args.Index=3; args.Text="Line " + (editor.Caret.LogicalPosition.Y+1) + " Col " + (editor.Caret.LogicalPosition.X+1) + " Char " + (editor.Caret.CurrentRow.Index+1); // update status bar ChangeStatusBarPanelEvent(this,args); } }
/// <summary> /// Sets the line column index. /// </summary> /// <param name="charIndex"> The char index.</param> /// <param name="lineStartCharIndex"> The line start char index.</param> /// <param name="textbox"> The textbox control.</param> private void SetLineColumnIndex(int charIndex, int lineStartCharIndex, RichTextBox textbox) { if ( textbox.Text == "" ) return; int cIndex = charIndex; int lineIndex = textbox.GetLineFromCharIndex(cIndex); // new charIndex int columns = 0; int lineCharIndex = 0; columns = cIndex - lineStartCharIndex; lineCharIndex = columns+1; // count tabs char[] chars = textbox.Lines[lineIndex].ToCharArray(); if ( cIndex > 0 ) { for (int k=lineStartCharIndex;k<cIndex;k++) { if ( textbox.Text.Substring(k,1) == "\t" ) { columns += 3; } } } ChangeStatusBarEventArgs e = new ChangeStatusBarEventArgs(); e.Index=3; e.Text="Line " + (lineIndex+1) + " Col " + (columns+1) + " Char " + lineCharIndex + " Abs Char " + cIndex; ChangeStatusBarPanelEvent(this,e); }
/// <summary> /// Raises when a Record Session button is toggle. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RecordSessionChanged(object sender, EventArgs e) { ChangeStatusBarEventArgs statusBarArgs =new ChangeStatusBarEventArgs(); if ( !IsRecording ) { statusBarArgs.Index = 2; statusBarArgs.Text = "Recording"; this.ChangeStatusBarPanelEvent(this, statusBarArgs); this.CurrentSessionRecording = new Session(); IsRecording = true; } else { statusBarArgs.Index = 2; statusBarArgs.Text = ""; this.ChangeStatusBarPanelEvent(this, statusBarArgs); IsRecording = false; if ( this.CurrentSessionRecording.SessionRequests.Count > 0 ) { _scriptingDataDesigner = new ScriptingDataDesigner(); _scriptingDataDesigner.PluginMenus = this.mnSessionMenus; // _scriptingDataDesigner.ApplyMenuSettingsEvent += new ApplyMenuSettingsEventHandler(SessionDesigner_ApplyMenuSettingsEvent); // _scriptingDataDesigner.ApplyToolbarSettingsEvent += new ApplyToolbarSettingsEventHandler(sessionDesigner_ApplyToolbarSettingsEvent); // Loads the sesion into the ui. //UpdateReportDialogTestMenu(false); _scriptingDataDesigner.LoadSession(this.CurrentSessionRecording); _scriptingDataDesigner.DisplayTreeView(); // Remove any existing document and add new document. this.RemoveAndAddDocument(_scriptingDataDesigner, "Scripting Application Designer", true); } } }
/// <summary> /// Loads the form result. /// </summary> /// <param name="result"> The IAsyncResult.</param> private void LoadFormResult(IAsyncResult result) { try { HtmlParser parser = (HtmlParser)result.AsyncState; HtmlFormTagCollection forms = parser.EndLoadFrom(result); this.Invoke(new LoadFormsEditorCallback(DisplayForms), new object[] {forms, false} ); } catch (Exception ex) { ChangeStatusBarEventArgs args = new ChangeStatusBarEventArgs(0,"Error while generating form.",null); this.txtMessaging.SelectionColor = Color.Red; this.txtMessaging.SelectedText = ex.Message; ChangeStatusBarPanelEvent(this,args); // update html textViewerForm.EditorText=CurrentResponseBuffer.GetHtmlXml; } }
/// <summary> /// Display the form collection in editor. /// </summary> /// <param name="forms"></param> /// <param name="showCreateMessage"></param> private void DisplayForms(HtmlFormTagCollection forms, bool showCreateMessage) { if ( forms.Count > 0 ) { // Validate Forms if ( ValidateForms(forms, (Uri)this.CurrentResponseBuffer.ResponseHeaderCollection["Response Uri"])) { // Create new FormEditor Window and apply events formeditor = new FormsEditor(forms, this.CurrentResponseBuffer, this.SnifferProperties, this.InspectorConfig); formeditor.RequestPostEvent += new Ecyware.GreenBlue.GreenBlueMain.FormsEditor.RequestPostEventHandler(formeditor_RequestPostEvent); formeditor.ApplyMenuSettingsEvent += new ApplyMenuSettingsEventHandler(formeditor_ApplyMenuSettingsEvent); formeditor.PluginMenus = this.mnSessionMenus; Uri url = (Uri)CurrentResponseBuffer.ResponseHeaderCollection["Response Uri"]; RemoveAndAddDocument(formeditor, "Forms Editor", false); if ( showCreateMessage ) { string message = "A Forms Editor Tree has been created."; ChangeStatusBarEventArgs args = new ChangeStatusBarEventArgs(0,message,null); ChangeStatusBarPanelEvent(this,args); } } else { string message = ValidateFormsReport(forms); ChangeStatusBarEventArgs args = new ChangeStatusBarEventArgs(0,message,null); ChangeStatusBarPanelEvent(this,args); } } else { if ( showCreateMessage ) { string message = "This page has no forms."; ChangeStatusBarEventArgs args = new ChangeStatusBarEventArgs(0,message,null); ChangeStatusBarPanelEvent(this,args); } } }