/// <summary> /// Action to be performed on form load. /// If the wiki structure is loaded, populates the spaces ListBox, selects the first space /// and populates the pages ListBox with pages names from selected space. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> protected override void ActionFormLoad(object sender, EventArgs e) { if (Globals.XWord2003AddIn.Wiki != null) { spacesNames = new List <string>(); pagesNames = new List <string>(); foreach (XWiki.Space space in Globals.XWord2003AddIn.Wiki.spaces) { spacesNames.Add(space.name); } XWiki.Space firstSpace = Globals.XWord2003AddIn.Wiki.spaces[0]; foreach (XWiki.XWikiDocument page in firstSpace.documents) { pagesNames.Add(page.name); } editPageForm.ListBoxPagesDataSource = pagesNames; editPageForm.ListBoxPagesSelectedIndex = 0; editPageForm.ListBoxSpacesDataSource = spacesNames; editPageForm.ListBoxSpacesSelectedIndex = 0; } else { UserNotifier.Error(UIMessages.WIKI_STRUCTURE_NOT_LOADED); } }
/// <summary> /// Action to be performed when selected space is changed. /// The pages ListBox is populated with pages names from the selected space. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> protected override void ActionSpaceChange(object sender, EventArgs e) { int selectedIndex = editPageForm.ListBoxSpacesSelectedIndex; XWiki.Space selectedSpace = null; try { selectedSpace = Globals.XWord2003AddIn.Wiki.spaces[selectedIndex]; } catch { } if (selectedSpace != null) { pagesNames.Clear(); foreach (XWiki.XWikiDocument page in selectedSpace.documents) { pagesNames.Add(page.name); } editPageForm.ListBoxPagesDataSource = null; editPageForm.ListBoxPagesDataSource = pagesNames; } }