/// <summary> /// Generate xml output from the specified xml data to the OutputXml textbox. /// </summary> private void GenerateXmlOutput ( string xmldata ) { XmlCommentsDocument parser = new XmlCommentsDocument ( xmldata ) ; if ( parser. IsValid ) { CheckOutputButton. Enabled = true ; OutputXml.Text = parser. ToString ( ) ; } else DisplayParseErrors ( parser ) ; }
/// <summary> /// Displays parsing errors in a modal form. /// </summary> private void DisplayParseErrors ( XmlCommentsDocument parser ) { if ( ErrorListForm == null ) ErrorListForm = new WutheringCommentsErrorList ( ) ; ErrorListForm. ShowDialog ( parser. ValidationMessages ) ; }
private void TestComments ( string text ) { XmlCommentsDocument parser = new XmlCommentsDocument ( text ) ; DisplayCommentForm form = new DisplayCommentForm ( parser ) ; form. ShowDialog ( ) ; }
/// <summary> /// Update line numbers and status bar once the form has been loaded. /// </summary> private void WutheringCommentsEditor_Shown ( object sender, EventArgs e ) { ConfigurationEditor. Focus ( ) ; ConfigurationEditor. SelectionStart = 0 ; ConfigurationEditor. SelectionEnd = 0 ; UpdateLineNumbers ( 1 ) ; UpdateStatusbar ( ) ; // Validate the document upon startup XmlCommentsDocument parser = new XmlCommentsDocument ( ConfigurationEditor. Text ) ; if ( ! parser. IsValid ) DisplayParseErrors ( parser ) ; }
/// <summary> /// Checks (validates) the specified xml data. /// </summary> private void CheckXml ( string text ) { XmlCommentsDocument parser = new XmlCommentsDocument ( text ) ; if ( parser. IsValid ) MessageBox. Show ( "Xml contents are valid" ) ; else DisplayParseErrors ( parser ) ; }
/// <summary> /// Validates xml contents using the xsd definition. /// </summary> private void ValidateButton_Click ( object sender, EventArgs e ) { XmlCommentsDocument parser = new XmlCommentsDocument ( ConfigurationEditor. Text ) ; if ( parser. IsValid ) MessageBox. Show ( "Xml contents are valid" ) ; else DisplayParseErrors ( parser ) ; }
public DisplayCommentForm ( XmlCommentsDocument parser ) { InitializeComponent ( ) ; Parser = parser ; }
public Author ( XmlCommentsDocument document, XmlNode node ) : base ( document, node ) { }
public Comment ( XmlCommentsDocument document, XmlNode node ) : base ( document, "category", node ) { TextLines = node. GetAlignedTextLines ( ) ; }
/// <summary> /// Performs the following : /// <list type="-"> /// <item>Registers the callback for handling the Insertxxx menu items</item> /// </list> /// </summary> protected override void Initialize ( ) { base. Initialize ( ) ; // Register commands as a "Comments" submenu in the "Edit" menu // Initially disable everything RegisterMenuCommands ( Symbols. Guids. SourceCommentsMenu, CommentsMenuCommands. Select ( x => x. Key ). ToArray ( ), OnMenuCommand ) ; EnableCommentsMenu ( false ) ; // Get the DTE object EnvDTE = GetDTE ( ) ; // Get the comments options page CommentsOptionsPage = GetDialogPage<WutheringCommentsOptionsPage> ( ) ; XmlComments = CommentsOptionsPage. GetXmlDefinitions ( ) ; // Install event handlers EnvDTE. Events. WindowEvents. WindowActivated += new WindowActivatedEventHandler ( OnWindowActivated ) ; }