Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
Exception trhown when unpinned the first Panel: An item with the same key has already been added
posted

Hi all, I am getting this excpetion the first time I unppined a panel, after that it works

An item with the same key has already been added. the stack trace is bellow

 

My scenario: I have a ToolBarManager,DockManager and TabbedMDIManager, and I am creating the panels atruntime when the application is starting, the code I am using to create the panels is also bellow:, the issue is that when the user tries to hide any Panel, the exception is being thrown, but only once... after that the application goes smoothly and you can show / hide / resize the panels or do whatever you want... is very weir, so I think that rather a bug, is gotta see with something I am doing wrong.

 

Thanks in Advance 

 The code

#region Perform Load of Docking Panels

( ( System.ComponentModel.ISupportInitialize ) ( this.dockManager ) ).BeginInit ( );
this.SuspendLayout ( );

//Initialize the Docking Areas
DockAreaPane dockAreaPanelLeft         = new DockAreaPane ( DockedLocation.DockedLeft );
DockAreaPane dockAreaPanelRight       = new DockAreaPane ( DockedLocation.DockedRight );
DockAreaPane dockAreaPanelBottom    = new DockAreaPane ( DockedLocation.DockedBottom );

string[ AssembliesPath = Directory.GetFiles ( Application.StartupPath, "XPDesigner.Modules.Panels.*.dll" );
foreach ( string assemblyPath in AssembliesPath )
{
    Assembly assembly = Assembly.LoadFile ( assemblyPath );
    foreach ( Type type in assembly.GetTypes ( ) )
    {
        if ( typeof ( IPanel ).IsAssignableFrom ( type ) && ( typeof ( UserControl ).IsAssignableFrom ( type ) ) )
        {
            IPanel iPanel = ( IPanel ) Activator.CreateInstance ( type );
            this.Controls.Add ( iPanel as UserControl );

            DockableControlPane dockableControl     = new DockableControlPane ( iPanel as UserControl );
            dockableControl.Text                              = iPanel.Caption;
            dockableControl.Key                              = iPanel.Caption.ToString ( ).Replace ( " ", string.Empty );

            switch ( iPanel.DefaultDockingArea )
            {
                case DockStyle.Bottom:
                    dockAreaPanelBottom.Panes.Add ( dockableControl );
                    break;
                case DockStyle.Left:
                    dockAreaPanelLeft.Panes.Add ( dockableControl );
                    break;
                case DockStyle.Right:
                    dockAreaPanelRight.Panes.Add ( dockableControl );
                    break;
            }
        }
    }
}
this.dockManager.DockAreas.Add ( dockAreaPanelLeft );
this.dockManager.DockAreas.Add ( dockAreaPanelRight );
this.dockManager.DockAreas.Add ( dockAreaPanelBottom );

//( ( System.Configuration.IPersistComponentSettings ) ( this.dockManager ) ).LoadComponentSettings ( );
( ( System.ComponentModel.ISupportInitialize ) ( this.dockManager ) ).EndInit ( );
this.ResumeLayout ( false );

#endregion

 

 The exception strack trace

"   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)\r\n   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)\r\n   at Infragistics.Win.AppStyling.StyleUtilities.StyleHashtable`2.Add(TKey key, TValue value)\r\n   at Infragistics.Win.AppStyling.StyleUtilities.UpdateRoleHierarchy(StyleHashtable`2 table, AssemblyStyleInfo[ assemblyInfos)\r\n   at Infragistics.Win.AppStyling.StyleManager.ProcessLoadedAssembliesImpl()\r\n   at Infragistics.Win.AppStyling.StyleManager.GetSharedObjectProperties(String sharedObjectName)\r\n   at Infragistics.Win.AppStyling.StyleManager.SharedObjectCache.GetProperties()\r\n   at Infragistics.Win.AppStyling.StyleManager.PropertyInfoCache.ParseProperty(String propertyName)\r\n   at Infragistics.Win.AppStyling.StyleManager.PropertyInfoCache.GetProperty(String propertyName)\r\n   at Infragistics.Win.AppStyling.StyleManager.GetSharedObjectPropertyValue(ComponentRole componentRole, String sharedObjectName, String propertyName)\r\n   at Infragistics.Win.AppStyling.ComponentRole.GetProperty(String sharedObjectName, String propertyName)\r\n   at Infragistics.Win.ToolTip.get_LeftMarginResolved()\r\n   at Infragistics.Win.ToolTip.CalcLineRect(Rectangle& rect, Graphics g, String text, LocationAdjustInfo adjustInfo, Font font, Int32 excludedWidth)\r\n   at Infragistics.Win.ToolTip.CalcStringSize(String text, Graphics g, LocationAdjustInfo adjustInfo, Font font, Int32 excludedWidth)\r\n   at Infragistics.Win.ToolTip.CalcStringSize(String text, Graphics g, LocationAdjustInfo adjustInfo, Font font)\r\n   at Infragistics.Win.ToolTip.AdjustDimensions(Rectangle& rect, Graphics g, LocationAdjustInfo adjustInfo)\r\n   at Infragistics.Win.ToolTip.ReAdjustForm(Rectangle rect, LocationAdjustInfo adjustInfo)\r\n   at Infragistics.Win.ToolTip.Show(Point displayLocation, Boolean rightAlign)\r\n   at Infragistics.Win.ToolTip.Show(Boolean rightAlign)\r\n   at Infragistics.Win.ToolTip.Show()\r\n   at Infragistics.Win.UltraWinDock.UltraDockManager.ShowToolTip(Control control, String tooltip, Boolean showAlways)\r\n   at Infragistics.Win.UltraWinDock.UltraDockManager.ShowToolTip(UIElement element, String tooltip, Boolean showAlways)\r\n   at Infragistics.Win.UltraWinDock.PaneCaptionButtonUIElement.OnMouseHover()\r\n   at Infragistics.Win.ControlUIElementBase.NotifyMouseHover(UIElement element)\r\n   at Infragistics.Win.ControlUIElementBase.ProcessMouseHover(Object sender, EventArgs e)\r\n   at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)\r\n   at Infragistics.Win.ManagedContainerControlBase.OnMouseHover(EventArgs e)\r\n   at System.Windows.Forms.Control.WmMouseHover(Message& m)\r\n   at System.Windows.Forms.Control.WndProc(Message& m)\r\n   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)\r\n   at System.Windows.Forms.ContainerControl.WndProc(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.Run(Form mainForm)\r\n   at XPDesigner.Core.Win.Program.Main() in D:\\VSProjects\\Glintech\\XPDesigner\\XPDesigner.Core.Win\\Program.cs:line 18\r\n   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[ args)\r\n   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[ args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()" 

Parents
No Data
Reply Children
No Data