Miscalculation in WpfDesktop.AddPanelsToList()?

Aug 23, 2012 at 9:24 AM

Hi,

Running the CCA sample app, I got a bit confused when the output window (in VS) prompted:

>>>>>>>>> Found 12 Panels

Looking into the XAML of MainWindow, I can only see 9 different panels.

I added the following code to the DesktopService class:

        protected override List<IPanel> AddPanelsToList()
        {
            var ret = base.AddPanelsToList();

            foreach (Microsoft.Uii.Desktop.UI.Controls.Wpf.WpfPanel panel in ret)
            {
                System.Diagnostics.Debug.Print("** Panel.Name is '{0}'", panel.Name);
            }

            return ret;
        }

 This procuced the following result:

** Panel.Name is 'NewSearchPanel'
** Panel.Name is 'CtiPanel'
** Panel.Name is 'SessionTabsPanel'
** Panel.Name is 'ApplicationExplorerPanel'
** Panel.Name is 'TopPanel'
** Panel.Name is 'hiddenpanel'
** Panel.Name is 'WorkflowPanel'
** Panel.Name is 'NotesPanel'
** Panel.Name is 'MainPanel'
** Panel.Name is 'SessionTabsPanel'
** Panel.Name is 'NewSearchPanel'
** Panel.Name is 'CtiPanel'
>>>>>>>>> Found 12 Panels

 Some panels are listed twice! Question: Is this by design?

Since each panel reference seems to be attached to eventhandlers for the events CloseApplicationClick and SelectedAppChanged the ISessionExplorer.FocusOnApplication and ISessionExplorer.RemoveApplicationNode implementations are sometimes called more than once for the same application. I have learned to "live with this" but think it is a bit annoying... So, I tried this workaround :

 protected override List<IPanel> AddPanelsToList()
        {
            var ret = base.AddPanelsToList();
            // To ensure each panel is only listed once
            return ret.Distinct().ToList();
        }

This hasn't (yet) shown to have any "bad" side-effects, but I haven't been brave enough to deploy this code yet though ;-)

Any comments? Is this a bad thing to do?

Best regards,
Johan