Shell with Multi Views CSLA.net 4 Silverlight MVVM bxf

Shell with Multi Views CSLA.net 4 Silverlight MVVM bxf

Old forum URL: forums.lhotka.net/forums/t/9101.aspx


jjloubser@symbioses.co.za posted on Thursday, June 17, 2010

Normal 0 false false false EN-ZA X-NONE X-NONE MicrosoftInternetExplorer4

Hi

my 1st project was a success in csla.net 3.8.2 Silverlight

I am busy now with a project using csla.net 4 silverlight

I got it to work like the shell, view models, ... I got the collective project to work

I would like to use Lhotka's bxf shell project for navigating, we do not want to use advance navigation; I only want a page with multi views that can change 2+ specific regions content, for example a login content and a middle page content. The login content can be replace with a marketing content, but the middle page content change all the time, also the main user control should change its navigation for full screen navigation also a view...

I can fix this by fixing: I am struggling to get multi views on one page-shell-view:

this code is my problem inside the view Model:

:

 

Shell.Instance.ShowView(
        "StaffSense.LoginScreen, StaffSense",
        "loginViewModelViewSource",
        new LoginViewModel(),
        "Content");

 

Shell.Instance.ShowView(
            "StaffSense.HomePage, StaffSense",
            "homePageViewModelViewSource",
            new HomePageViewModel(),
            "Content");

 

How do I show multi views in the same shell?

I see that the collective project only use 1 view in the shell, but in the videos of Lhotka is describe that a shell can contains multi views ...

I hope that I do not have to modify the bxf project? Or must create multi static shells?

jjloubser@symbioses.co.za replied on Thursday, June 17, 2010

like this is not working :

 

 <Border Grid.Column="6" Grid.Row="4" Margin="0,2,0,0"
                BorderBrush="Black" BorderThickness="2" HorizontalAlignment="Right" VerticalAlignment="Top" Width="366" Height="281" Grid.ColumnSpan="3">
            <app:LoginScreen  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                              DataContext="{StaticResource loginViewModelViewSource}"/>
          
        </Border>

 

 

the binding to the viewmodel is not working. it shows the view without loading the viewmodel

RockfordLhotka replied on Friday, June 18, 2010

Bxf doesn't provide the actual shell - you provide that. The actual shell is your main form or usercontrol, and the viewmodel/presenter to which it is bound. That's where you write the code to handle the OnShowView event, which is where you put the content into the right region of the main form.

The main form typically contains one or more ContentControl controls (or other controls that handle transitions, etc - any container control works really). Each of those content controls is bound to a property on the main form's viewmodel.

So in the main form's viewmodel there's a handler for OnShowView, and that code just sets the viewmodel property to the new content (usually a usercontrol), and data binding updates the actual main form view.

jjloubser@symbioses.co.za replied on Saturday, June 19, 2010

thank you RockfordLhotka. The problem in my code was that it did not run the presenter events you are talking about, but after I fix that I could see the magic of your bxf and viewModel framework. Only thing I can do now is to add more contentcontrols and adjust my case statement, thanks man...

jjloubser@symbioses.co.za replied on Saturday, June 19, 2010

RockfordLhotka

I got the collective project to work and understand it. I create my own project with a client and server side. The CollectiveIdentity is on the server side and shared on the client side, when the login verb of my LoginViewModel execute, it must execute a BeginFetch that run a method on this server side CollectiveIdentity file. Error:

< 

An error occurred while trying to make a request to URI 'http://localhost:21658/WcfSlPortal.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

>

- my web.config file is fine I think. I tried the collective project web.config file and my previouse web.config file both made no diffrence... <but I think I need a better web.config file from you where we use business.server and business.client side projects; the web.config file from silverlight 3 and 4 have some diffrences>

- my start up project is the .web project for this was my common problem...

- what else can I be missing?

jjloubser@symbioses.co.za replied on Saturday, June 19, 2010

Here is my web.config file:

 

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="CslaAuthentication" value="Windows"/>
  </appSettings>
  <connectionStrings>
  


    <!--Description: <add name="MyModel_Entities" connectionString="metadata=res://*/MyNamespace.MyModel.bin.Debug.MyModel.csdl|res://*/MyNamespace.MyModel.bin.Debug.MyModel.ssdl|res://*/MyNamespace.MyModel.bin.Debug.MyModel.msll;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=local;Initial Catalog=MyModelDatabase;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />-->

    <add
         name="StaffSenseDb"
                      
         connectionString="Data Source=xxx;Initial Catalog=xxx;Password=xxx;User ID=sa;MultipleActiveResultSets=True"
                      
         providerName="System.Data.SqlClient"/>


  </connectionStrings>
  <system.web>
    <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
    <compilation debug="true" targetFramework="4.0">
    </compilation>
    <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Windows"/>
    <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <!--
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
       
       
    -->
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="MyBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfPortalBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
        <behavior name="StaffSense.Web.WcfPortalBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
        <behavior name="StaffSense.Web.AuthenticationBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="WcfPortalBehavior" name="Csla.Server.Hosts.Silverlight.WcfPortal">
        <endpoint address="" binding="basicHttpBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal" bindingConfiguration="MyBinding">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>
      <!--<service behaviorConfiguration="StaffSense.Web.WcfPortalBehavior" name="StaffSense.Web.WcfPortal">
    <endpoint address="" binding="wsHttpBinding" contract="StaffSense.Web.IWcfPortal">
     <identity>
      <dns value="localhost"/>
     </identity>
    </endpoint>
   </service>
   <service behaviorConfiguration="StaffSense.Web.AuthenticationBehavior" name="StaffSense.Web.Authentication">
    <endpoint address="" binding="wsHttpBinding" contract="StaffSense.Web.IAuthentication">
     <identity>
      <dns value="localhost"/>
     </identity>
    </endpoint>
   </service>-->
    </services>
  </system.serviceModel>
</configuration>

JJLoubser replied on Wednesday, August 18, 2010

we just had to creat a new project and play with the dll's references, bxf class you just have to understand the case statements and the events that is called, web config file did not play any role in the problems

Copyright (c) Marimer LLC