<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : DockPanelWorkspace. Reactivation of smartpart: error</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : DockPanelWorkspace. Reactivation of smartpart: error</description>
  <pubDate>Thu, 11 Jun 2026 09:23:03 -700</pubDate>
  <lastBuildDate>Thu, 10 Jan 2008 01:38:30 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=631</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>DockPanelWorkspace. Reactivation of smartpart: error : as I remember, the problem is:...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=631&amp;PID=2392#2392</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=126" rel="nofollow">DeLight</a><br /><strong>Subject:</strong> 631<br /><strong>Posted:</strong> 10-Jan-2008 at 1:38am<br /><br />as I remember, the problem is: <DIV>1.<table width="99%"><tr><td><pre class="BBcode">&nbsp;&nbsp;&nbsp; public void Show() {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MainWorkspace.Show(MainView);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( IsFirstShow ) OnFirstShow();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&nbsp;&nbsp;&nbsp; }</DIV><DIV>...</DIV><DIV>&nbsp;&nbsp;&nbsp; private void OnFirstShow() {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( IsFirstShow ) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IWorkspace editorWs = MainWorkspace;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; editorWs.SmartPartClosing += EditorClosingHandler;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IsFirstShow = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }</DIV><DIV></pre></td></tr></table></DIV><DIV>in EntityEditorController.</DIV><DIV>2. MainWorkspace.Show(MainView) calls Form.ShowDialog() (in case of modal dialogs)&nbsp;so OnFirstShow() is not called until dialog window is closed. So editorWs.SmartPartClosing += EditorClosingHandler; is not called until dialog is closed. So <FONT size=2>SmartPartClosing event is not processed (not "not fired").</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>btw, solwed the "<FONT color=#004000>Reactivation of smartpart: error" problem with:</FONT></FONT></DIV><DIV><FONT color=#004000 size=2>1. processing closing event in all pagecontrollers (not only editors).</FONT></DIV><DIV><FONT color=#004000 size=2><table width="99%"><tr><td><pre class="BBcode"></FONT><FONT size=2>mainWs.SmartPartClosing += PageClosingHandler;</DIV><DIV><DIV></FONT><FONT size=2></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> PageClosingHandler(</FONT><FONT color=#0000ff size=2>object</FONT><FONT size=2> sender, </FONT><FONT color=#2b91af size=2>WorkspaceCancelEventArgs</FONT><FONT size=2> e)</P><P>{</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (e.SmartPart != MainView)</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>; </FONT><FONT color=#008000 size=2>// not this Editor</P></FONT><FONT size=2><P>PageClosingHandlerCore(sender, e);</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (e.Cancel)</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>;</P><P>Terminate(e);</P><P>}</P><DIV></FONT><FONT color=#0000ff size=2><P>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>virtual</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> PageClosingHandlerCore(</FONT><FONT color=#0000ff size=2>object</FONT><FONT size=2> sender, </FONT><FONT color=#2b91af size=2>WorkspaceCancelEventArgs</FONT><FONT size=2> e) { }</P><DIV></pre></td></tr></table></DIV><DIV>2. if we need the page to be hidden (not closed) when pushing the close button:</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>override</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> PageClosingHandlerCore(</FONT><FONT color=#0000ff size=2>object</FONT><FONT size=2> sender, </FONT><FONT color=#2b91af size=2>WorkspaceCancelEventArgs</FONT><FONT size=2> e)</DIV><DIV><P>{</P><P>((</FONT><FONT color=#2b91af size=2>IWorkspace</FONT><FONT size=2>) sender).Hide(</FONT><FONT color=#0000ff size=2>this</FONT><FONT size=2>.MainView);</P><P>e.Cancel = </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>;</P><P>}</pre></td></tr></table></FONT></FONT></P></DIV><DIV><FONT size=1>&#1097;&#1100;&#1105;&#1088;&#1090;, &#1085;&#1077; &#1079;&#1072;&#1084;&#1077;&#1090;&#1080;&#1083; Russian Federation. &#1082;&#1086; &#1084;&#1085;&#1077; &#1084;&#1086;&#1078;&#1085;&#1086; &#1080; &#1087;&#1086;-&#1088;&#1091;&#1089;&#1089;&#1082;&#1080;. &#1072; &#1083;&#1091;&#1095;&#1096;&#1077; &#1074; &#1072;&#1089;&#1100;&#1082;&#1077; &#1089;&#1088;&#1072;&#1079;&#1091; - 376440623 (&#1088;&#1072;&#1073;&#1086;&#1095;&#1072;&#1103;), 108588 (&#1076;&#1086;&#1084;&#1072;&#1096;&#1085;&#1103;&#1103;). &#1086;&#1087;&#1099;&#1090; &#1088;&#1072;&#1073;&#1086;&#1090;&#1099; &#1089; &#1082;&#1072;&#1073;&#1072;&#1085;&#1086;&#1081; &#1087;&#1086;&#1095;&#1090;&#1080; &#1075;&#1086;&#1076; &#1091;&#1078;&#1077;,&nbsp;&#1087;&#1086;&#1076;&#1077;&#1083;&#1080;&#1090;&#1100;&#1089;&#1103; &#1085;&#1077; &#1087;&#1088;&#1086;&#1090;&#1080;&#1074;.</FONT></DIV></DIV></DIV></DIV><span style="font-size:10px"><br /><br />Edited by DeLight - 10-Jan-2008 at 2:29am</span>]]>
   </description>
   <pubDate>Thu, 10 Jan 2008 01:38:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=631&amp;PID=2392#2392</guid>
  </item> 
  <item>
   <title>DockPanelWorkspace. Reactivation of smartpart: error : Thank you very much, Bill!It is...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=631&amp;PID=2314#2314</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=201" rel="nofollow">vecs</a><br /><strong>Subject:</strong> 631<br /><strong>Posted:</strong> 29-Dec-2007 at 1:10am<br /><br />Thank you very much, Bill!<br>It is exactly what we needed.<br>This work perfect with <font size="2"><font size="2">DockPanelWorkspace too.<br><br>But I found it does not work with "ModalWindows" workspace when I set this:<br>((WindowSmartPartInfo)MainView.SmartPartInfo).Modal = true;<br>The reason is that controller.MainWorkspace.SmartPartClosing event not </font></font>fired<font size="2"><font size="2"> after dialog closing.<br><br><br></font></font>]]>
   </description>
   <pubDate>Sat, 29 Dec 2007 01:10:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=631&amp;PID=2314#2314</guid>
  </item> 
  <item>
   <title>DockPanelWorkspace. Reactivation of smartpart: error : Well, you could try this:  In...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=631&amp;PID=2309#2309</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=97" rel="nofollow">Bill Jensen</a><br /><strong>Subject:</strong> 631<br /><strong>Posted:</strong> 28-Dec-2007 at 4:50pm<br /><br />Well, you could try this:<DIV>&nbsp;</DIV><DIV>In your PageController's static ShowPage() method, after calling the ShowPage&lt;TController&gt; base method, get the controller instance and setup a handler for the SmartPartClosing event of the main workspace:</DIV><DIV>&nbsp;</DIV><FONT size=2><P></FONT><FONT color=#008000 size=2>// Get the controller instance</P></FONT><FONT size=2><P></FONT><FONT color=#008080 size=2>Page1PageController</FONT><FONT size=2> controller = GetPageController&lt;</FONT><FONT color=#008080 size=2>Page1PageController</FONT><FONT size=2>&gt;(pParentWorkItem, pPageWorkItemId);</P><P></FONT><FONT color=#008000 size=2>// Handle the SmartPartClosing event (with an instance event handler)</P></FONT><FONT size=2><P>controller.MainWorkspace.SmartPartClosing += </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> System.</FONT><FONT color=#008080 size=2>EventHandler</FONT><FONT size=2>&lt;</FONT><FONT color=#008080 size=2>WorkspaceCancelEventArgs</FONT><FONT size=2>&gt;(controller.MainWorkspace_SmartPartClosing);</P><DIV></DIV><DIV>Then add the handler:</DIV><DIV>&nbsp;</DIV><FONT size=2><P></FONT><FONT color=#008000 size=2>// A SmartPart in the main workspace is closing</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>// Check to see if it's ours</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> MainWorkspace_SmartPartClosing(</FONT><FONT color=#0000ff size=2>object</FONT><FONT size=2> sender, </FONT><FONT color=#008080 size=2>WorkspaceCancelEventArgs</FONT><FONT size=2> e)</P><P>{</P><P></FONT><FONT color=#008000 size=2>// If it's our main view that's closing</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (e.SmartPart.Equals(</FONT><FONT color=#0000ff size=2>this</FONT><FONT size=2>.MainView))</P><P>{</P><P></FONT><FONT color=#008000 size=2>// Terminate this controlled workitem</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>// So a new controller will be created and initialized on the next Show() call</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>this</FONT><FONT size=2>.Terminate(e);</P><P>}</P><P>}</P><DIV></DIV><P>The Terminate(WorkspaceCancelEventArgs e) method is a a little bit tricky.&nbsp; It sets the cancel flag in the event args to true.&nbsp; If this isn't done, exceptions happen.</P><DIV></DIV>I've tried this briefly with a WindowWorkspace and it seems to work, but I'm not sure it will work with your DockPanelWorkspace.<DIV>&nbsp;</DIV><DIV><DIV></DIV><DIV></DIV><DIV></DIV>Let me know if this helps.</DIV><DIV></DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>Good luck,</DIV><DIV></DIV>Bill Jensen</FONT></FONT>]]>
   </description>
   <pubDate>Fri, 28 Dec 2007 16:50:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=631&amp;PID=2309#2309</guid>
  </item> 
  <item>
   <title>DockPanelWorkspace. Reactivation of smartpart: error :      Hello,I have made new...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=631&amp;PID=2285#2285</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=201" rel="nofollow">vecs</a><br /><strong>Subject:</strong> 631<br /><strong>Posted:</strong> 25-Dec-2007 at 2:55am<br /><br />Hello,<br><br>I have made new shell layout contained freeware <b>DockPanelWorkspace </b>from <a href="http://www.codeplex.com/cabext" target="_blank">http://www.codeplex.com/cabext</a> as "ShellContent":<br><img src="uploads/20071227_025329_cabdockworkspac.jpg" height="297" width="620" border="0" alt="CAB%20dock%20workspace" /><br>But I am getting an exception when try to close and then reopen the same page.<br>Itseems that View (SmartPart) were disposed and removed from its WorkItemwhen I closed tab. So when I try to activate this View(SmartPart) again the PageController can not find this View andraises exception ("<span style="font-style: italic;">Cannot access a disposed object. Object name: '...'.</span>"). Or sometimes SmartPart removed from Workspace and "<span style="font-style: italic;">The smartpart is not present in the workspace</span>" error raised when try to activate View second time.<br><b><font color="#ff0000">BTW</font> </b>I found the same problem with <b>ModalWindowsWorkspace</b> ("<span style="font-style: italic;">The smartpart is not present in the workspace</span>" error) on reactivation.<br><br>Any suggestions how to solve this problem?<br><br>For now I suppose one solution for this:<br>Find the way to dispose PageController when its MainView closed in DockWorkspace or in ModalWindowsWorkspace. But I dont know how implement this.<br><br>For a while I have disabled tabs closing so that tab once appeared remain alive till the end of user session. But IMHO it is not rational..<br><br><br><span style="font-size:10px"><br /><br />Edited by vecs - 27-Dec-2007 at 1:33am</span>]]>
   </description>
   <pubDate>Tue, 25 Dec 2007 02:55:15 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=631&amp;PID=2285#2285</guid>
  </item> 
 </channel>
</rss>