6 Replies Latest reply on Jun 18, 2015 12:06 PM by Lee CS Young

    EPDM Custom Task Add-In - Setup Pages

    Greg Thomson

      Does anyone know, can I only have one Setup Page on a Custom Task?  When I add one, everything works fine.  When I add a second page, it appears to crash on IEdmTaskProperties.SetSetupPages().  I even tried to add the first page twice in the event the second page (User Control) was misbehaving...

       

      If someone could just confirm multiple setup pages works I could probably determine the rest.

       

      Greg,

       

      Partial code excerpt - One Setup Page...

       

      //Page name that appears in the navigation pane of the Add Task dialog in the Administration tool
      pages[0].mbsPageName = "Task";
      pages[0].mlPageHwnd = _TaskSelectionPage.Handle.ToInt32();
      pages[0].mpoPageImpl = _TaskSelectionPage;

       

      // Submit custom setup pages

      Properties.SetSetupPages(pages); // EdmTaskSetupPage[1]

       

       

      Two Setup Pages...

       

      //Page name that appears in the navigation pane of the Add Task dialog in the Administration tool
      pages[0].mbsPageName = "Task";
      pages[0].mlPageHwnd = _TaskSelectionPage.Handle.ToInt32();
      pages[0].mpoPageImpl = _TaskSelectionPage;

       

       

      pages[1].mbsPageName = "File Age";
      pages[1].mlPageHwnd = _FileAgeSelectionPage.Handle.ToInt32();
      pages[1].mpoPageImpl = _FileAgeSelectionPage;

       

      // Submit custom setup pages
      Properties.SetSetupPages(pages); // EdmTaskSetupPage[2]

        • Re: EPDM Custom Task Add-In - Setup Pages
          Charley Saint

          Hey Greg,

           

          Maybe you need to redimension the array.

           

          //Page name that appears in the navigation pane of the Add Task dialog in the Administration tool
          pages[0].mbsPageName = "Task";
          pages[0].mlPageHwnd = _TaskSelectionPage.Handle.ToInt32();
          pages[0].mpoPageImpl = _TaskSelectionPage;

           

          ReDim Preserve pages(1);

           

          pages[1].mbsPageName = "File Age";
          pages[1].mlPageHwnd = _FileAgeSelectionPage.Handle.ToInt32();
          pages[1].mpoPageImpl = _FileAgeSelectionPage;

           

          // Submit custom setup pages
          Properties.SetSetupPages(pages); // EdmTaskSetupPage[2]

          • Re: EPDM Custom Task Add-In - Setup Pages
            Lee CS Young

            Here's how I do it;

             

            I created a base class each page inherits from. I create a list of those;

             

            List<BaseSetupPage> setupPages = new List<BaseSetupPage>();
            

             

            Create and add my pages (all these inherit from BaseSetupPage);

             

            SetupPage currentSetupPage = new SetupPage();
            currentSetupPage.CreateControl();
            currentSetupPage.LoadData(ref poCmd);
            setupPages.Add(currentSetupPage);
            
            
            MenuCommandPage menuCommandPage = new MenuCommandPage();
            menuCommandPage.CreateControl();
            menuCommandPage.LoadData(ref poCmd);
            setupPages.Add(menuCommandPage);
            

             

            Cast the list to an array of the correct type and add those.

             

            List<EdmTaskSetupPage> pages = new List<EdmTaskSetupPage>();
            foreach (var page in setupPages)
            {
              EdmTaskSetupPage setupPage = new EdmTaskSetupPage();
              setupPage.mbsPageName = page.PageName;
              setupPage.mlPageHwnd = page.Handle.ToInt32();
              setupPage.mpoPageImpl = page;
              pages.Add(setupPage);
            }
            Array pageArray = pages.OfType<EdmTaskSetupPage>().ToArray();              
            props.SetSetupPages(pageArray);
            

             

            That's one way to do it. Just make sure the object you're setting for mpoPageImpl isn't null. (The control has been created.)