Note that there are some explanatory texts on larger screens.

plurals
  1. POCaliburn micro in no Application object mode, like in AutoCAD dll plugin
    text
    copied!<p>I am using Caliburn Micro to develop WPF application. A few of views of this application needs to be loaded in an AutoCAD environment. The AutoCAD programming environment allows developement of AutoCAD plugins (of type dll) and load them into the AutoCAD environment.</p> <p>Because of AutoCAD plugin type(dll), the plugin does not have an Application Object, so the bootstrapper has to be customized for that. According to the Caliburn Micro documentation <a href="http://caliburnmicro.codeplex.com/wikipage?title=Customizing%20The%20Bootstrapper&amp;referringTitle=Documentation" rel="nofollow">here (Scroll down to "Using Caliburn.Micro in Office and WinForms Applications")</a> we can inherit the non-generic bootstrapper and pass "false" to the base constructor's "useApplication" parameter. So, I went ahead and created the customized bootstrapper. </p> <p>The issue is that the ConfigureContainer() override never gets called and nothing gets initialized. Also, I am not sure how to load the ShellView using ViewModel first concept. Here is some code that I have come up till now.</p> <p><strong>The Bootstrapper</strong></p> <pre><code>public class AutocadMefBootStrapper : Bootstrapper { private CompositionContainer container; private ElementHost host; public AutocadMefBootStrapper(ElementHost host) : base(false) { this.host = host; } protected override void Configure() { //Not getting invoked. ... var rootViewModel = container.GetExportedValue&lt;IShell&gt;(); var rootView = ViewLocator.LocateForModel(rootViewModel, null, null); host.Child = rootView; } } </code></pre> <p>I have a windows form which the AutoCAD loads when requested. In the Windows Form's loaded event, I create an instance cuztomized caliburn micro bootstrapper and expect the boot strapper to do all the magic and load the Shell. But the Shell does not load. I get the blank window displayed in the AutoCAD. Here is how the Windows Form is coded.</p> <pre><code>public partial class WinFormHost : Form { private void WinFormHost_Load(object sender, EventArgs e) { ElementHost host = new ElementHost(); host.Dock = DockStyle.Fill; Controls.Add(host); AutocadMefBootStrapper bootStrapper = new AutocadMefBootStrapper(host); } } </code></pre> <p><strong>Here is my ShellView</strong></p> <pre><code>&lt;UserControl x:Class="RelayAnalysis_Autocad.Views.ShellView" ... &lt;Grid&gt; &lt;TextBlock&gt;Hello There&lt;/TextBlock&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p><strong>and the ShellViewModel</strong></p> <pre><code>[Export(typeof(IShell))] public class ShellViewModel : Conductor&lt;object&gt;, IShell { protected override void OnActivate() { base.OnActivate(); } } </code></pre> <p>So in summary, I am trying use Caliburn Micro in an hosted environment which is not loaded using the Application object. I am unable to configure Caliburn Micro, as the ShellView never loads. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload