c# - DockPanel Suite DockContent all appearing at top left of DockPanel -


enter image description heresometimes when program starts fails place dockpanel dockcontent in correct places assigned in configuration file.

the config file looks this:

<?xml version="1.0" encoding="utf-16"?> <!--dockpanel configuration file. author: weifen luo, rights reserved.--> <!--!!! automatically generated file. not modify !!!--> <dockpanel formatversion="1.0" dockleftportion="0.25" dockrightportion="0.25" docktopportion="0.25" dockbottomportion="0.25" activedocumentpane="-1" activepane="-1">   <contents count="5">     <content id="0" persiststring="imogen3.forms.dockable.frmlogging" autohideportion="0.25" ishidden="false" isfloat="false" />     <content id="1" persiststring="imogen3.forms.dockable.frmtimers" autohideportion="0.25" ishidden="false" isfloat="false" />     <content id="2" persiststring="imogen3.forms.dockable.frmimageassessmentcontrol" autohideportion="0.25" ishidden="false" isfloat="false" />     <content id="3" persiststring="imogen3.forms.dockable.frmrestrictedbrowser" autohideportion="0.25" ishidden="false" isfloat="false" />     <content id="4" persiststring="imogen3.forms.dockable.frmgroupcandidates" autohideportion="0.25" ishidden="false" isfloat="false" />   </contents>   <panes count="3">     <pane id="0" dockstate="dockbottom" activecontent="0">       <contents count="1">         <content id="0" refid="0" />       </contents>     </pane>     <pane id="1" dockstate="dockbottom" activecontent="1">       <contents count="1">         <content id="0" refid="1" />       </contents>     </pane>     <pane id="2" dockstate="document" activecontent="2">       <contents count="3">         <content id="0" refid="2" />         <content id="1" refid="3" />         <content id="2" refid="4" />       </contents>     </pane>   </panes>   <dockwindows>     <dockwindow id="0" dockstate="document" zorderindex="1">       <nestedpanes count="1">         <pane id="0" refid="2" prevpane="-1" alignment="right" proportion="0.5" />       </nestedpanes>     </dockwindow>     <dockwindow id="1" dockstate="dockleft" zorderindex="2">       <nestedpanes count="0" />     </dockwindow>     <dockwindow id="2" dockstate="dockright" zorderindex="3">       <nestedpanes count="0" />     </dockwindow>     <dockwindow id="3" dockstate="docktop" zorderindex="4">       <nestedpanes count="0" />     </dockwindow>     <dockwindow id="4" dockstate="dockbottom" zorderindex="0">       <nestedpanes count="2">         <pane id="0" refid="0" prevpane="-1" alignment="right" proportion="0.5" />         <pane id="1" refid="1" prevpane="0" alignment="right" proportion="0.215625" />       </nestedpanes>     </dockwindow>   </dockwindows>   <floatwindows count="0" /> </dockpanel> 

within code have these 3 dockpanel methods gets contentfrompersiststring, saves , loads configuration file.

private readonly deserializedockcontent _deserializedockcontent;   private idockcontent getcontentfrompersiststring(string persiststring)         {             mainlog("getcontentfrompersiststring " + persiststring);             if (persiststring == typeof(frmlogging).tostring())             {                 logtoolstripmenuitem.checked = true;                 _frmlogging.dock = dockstyle.fill;                 return _frmlogging;             }             else if (persiststring == typeof(frmtimers).tostring())             {                 timerstoolstripmenuitem.checked = true;                 _frmtimers.dock = dockstyle.fill;                 return _frmtimers;             }             else if (persiststring == typeof(frmimageassessmentcontrol).tostring())             {                 imageassessmenttoolstripmenuitem.checked = true;                 _frmiac.dock = dockstyle.fill;                 return _frmiac;             }             else if (persiststring == typeof(frmrestrictedbrowser).tostring())             {                 restrictedbrowsertoolstripmenuitem.checked = true;                 _frmrb.dock = dockstyle.fill;                 return _frmrb;             }             else if (persiststring == typeof(frmgroupcandidates).tostring())             {                 groupcandidatestoolstripmenuitem.checked = true;                 _frmgc.dock = dockstyle.fill;                 return _frmgc;             }             else             {                 mainlog("received window persiststring: " + persiststring);                 return null;             }         }          private void loaddockingwindowsconfiguration()         {             mainlog("loaddockingwindowsconfiguration()");             // resharper disable once assignnulltonotnullattribute             string configfile = path.combine(path.getdirectoryname(application.executablepath), "dockpanel.config");              try             {                 if (file.exists(configfile))                     dockpanel1.loadfromxml(configfile, _deserializedockcontent);             }             catch (exception ex)             {                 mainlog("error: loaddockingwindowsconfiguration " + ex.message);             }          }          private void savedockingwindowconfiguration()         {             mainlog("savedockingwindowconfiguration()");             // resharper disable once assignnulltonotnullattribute             string configfile = path.combine(path.getdirectoryname(application.executablepath), "dockpanel.config");             if (_savelayout)                 dockpanel1.saveasxml(configfile);             else if (file.exists(configfile))                 file.delete(configfile);         } 

in mainform initializer have this:

 _deserializedockcontent = getcontentfrompersiststring;   

we load docking configuration in form load event this:

 loaddockingwindowsconfiguration();   

this real nuisance, in getting dockcontent placed in correct locations appreciated.

concluded design,

https://github.com/dockpanelsuite/dockpanelsuite/issues/338

users of dps suggested handle exceptions on own.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -