public void SetUpFixture() { WixDocumentReader wixReader = new WixDocumentReader(GetWixXml()); dialogIds = wixReader.GetDialogIds(); welcomeDialogId = dialogIds[0]; progressDialogId = dialogIds[1]; wixReader = new WixDocumentReader(GetWixXml()); welcomeDialogLocation = wixReader.GetStartElementLocation("Dialog", welcomeDialogId); wixReader = new WixDocumentReader(GetWixXml()); missingDialogLocation = wixReader.GetStartElementLocation("Dialog", "missingDialogId"); }
/// <summary> /// Gets the dialog element location given the filename and the dialog id. /// </summary> static TextLocation GetDialogElementLocation(string fileName, string id) { try { WorkbenchTextFileReader workbenchTextFileReader = new WorkbenchTextFileReader(); using (TextReader reader = workbenchTextFileReader.Create(fileName)) { WixDocumentReader wixReader = new WixDocumentReader(reader); return wixReader.GetStartElementLocation("Dialog", id); } } catch (XmlException ex) { WixBindingService.ShowErrorInErrorList(fileName, ex); } return TextLocation.Empty; }
/// <summary> /// Gets the dialog element location given the filename and the dialog id. /// </summary> static TextLocation GetDialogElementLocation(string fileName, string id) { try { WorkbenchTextFileReader workbenchTextFileReader = new WorkbenchTextFileReader(); using (TextReader reader = workbenchTextFileReader.Create(fileName)) { WixDocumentReader wixReader = new WixDocumentReader(reader); return(wixReader.GetStartElementLocation("Dialog", id)); } } catch (XmlException ex) { WixBindingService.ShowErrorInErrorList(fileName, ex); } return(TextLocation.Empty); }
/// <summary> /// Jumps to dialog element with corresponding dialog id. This is only used /// when the user opens a dialog from the Setup dialogs window or the cursor /// was not near a dialog when the designer was switched to. Jumping to the /// dialog selected ensures that when the user switches back, if they did /// not make any changes, then the dialog xml is displayed. /// </summary> void JumpToDialogElement(string dialogId) { try { if (dialogId != null) { ITextEditor textEditor = ActiveTextEditor; if (textEditor != null) { WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text); TextLocation location = wixReader.GetStartElementLocation("Dialog", dialogId); textEditor.JumpTo(location.Line, 1); } } } catch (XmlException) { // Ignore } }
/// <summary> /// Jumps to dialog element with corresponding dialog id. This is only used /// when the user opens a dialog from the Setup dialogs window or the cursor /// was not near a dialog when the designer was switched to. Jumping to the /// dialog selected ensures that when the user switches back, if they did /// not make any changes, then the dialog xml is displayed. /// </summary> void JumpToDialogElement(string dialogId) { try { if (dialogId != null) { ITextEditor textEditor = ActiveTextEditor; if (textEditor != null) { WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text); TextLocation location = wixReader.GetStartElementLocation("Dialog", dialogId); textEditor.JumpTo(location.Line, 1); } } } catch (XmlException) { // Ignore } }