/// <summary> /// Gets the dialog element location given the filename and the dialog id. /// </summary> static Location GetDialogElementLocation(string fileName, string id) { try { WorkbenchTextFileReader workbenchTextFileReader = new WorkbenchTextFileReader(); using (TextReader reader = workbenchTextFileReader.Create(fileName)) { return(WixDocument.GetStartElementLocation(reader, "Dialog", id)); } } catch (XmlException ex) { WixBindingService.ShowErrorInErrorList(fileName, ex); } return(Location.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) { TextAreaControl textArea = ActiveTextAreaControl; if (textArea != null) { Location location = WixDocument.GetStartElementLocation(new StringReader(textArea.Document.TextContent), "Dialog", dialogId); textArea.JumpTo(location.Y); } } } catch (XmlException) { // Ignore } }