Sample App

Jul 9, 2011 at 1:44 AM

Hi Marcel,

After numerous false starts to use both Ideablade and MMVM, (MVVM Light)  I was very excited to see your project address the needs of someone just like myself. In the past I've found the solutions either to simple or complex and really appreciate the style and effort that's gone into this approach. I really believe a comprehensive demo ( see ligthswitch ) fully implementing CRUD with a few screens menus , links and tabs for opened forms will go a long way in helping others wrap their brains around this. That said I successfully built the search customer example by carefully reading the documentation. I'm using a licenced version of 6.1.1.1 silverlight from Devforce and the latest from Caliburn. While I have no problem with debug mode test data I've tried numerous changes to get the main sample to work with the NorthwindIB database., I can see the database in VS2010 solution explorer and used the same database in the search tutorial. Any insight what's wrong is much appricated.

Thanks for the great work and I hope to contribute one day soon.

John
App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <connectionStrings><add name="NorthwindIBEntities" connectionString="metadata=res://*/NorthwindIB.csdl|res://*/NorthwindIB.ssdl|res://*/NorthwindIB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=JRTWIN7-HP\SQLEXPRESS;initial catalog=NorthwindIB;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>

</configuration>


Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPDTDF; BRI/1; .NET4.0C; .NET4.0E; InfoPath.2)
Timestamp: Fri, 8 Jul 2011 20:40:45 UTC


Message: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: EntityServerException: Key 'NorthwindIBEntities': The connection string for Key 'NorthwindIBEntities' was not found or is invalid.  Check that either a connectionStrings element or EdmKey is defined for this key in the configuration file, or implement a custom IDataSourceKeyResolver.  ---> IdeaBlade.EntityModel.EntityServerException: The connection string for Key 'NorthwindIBEntities' was not found or is invalid.  Check that either a connectionStrings element or EdmKey is defined for this key in the configuration file, or implement a custom IDataSourceKeyResolver.  ---> System.ArgumentException: Parameter 'connectionString' is not valid. String arguments cannot be empty.
Parameter name: connectionString
   at System.Data.EntityUtil.CheckStringArgument(String value, String parameterName)
   at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
   at System.Data.Objects.ObjectContext..ctor(String connectionString)
   at IdeaBlade.EntityModel.Edm.EdmKey.CreateContext()
   --- End of inner exception stack trace ---
   at IdeaBlade.EntityModel.Edm.EdmKey.CreateContext()
   at IdeaBlade.EntityModel.Edm.EdmKey.Initialize()
   at IdeaBlade.EntityModel.Edm.EdmKey.CreateContext()
   at IdeaBlade.EntityModel.AsyncProcessor`1.<>c__DisplayClass2.<.ctor>b__0(TArgs args)
   at IdeaBlade.EntityModel.AsyncProcessor`1.Signal()
   at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__5(Object x)    

Line: 56
Char: 13
Code: 0
URI: http://localhost:20246/

Coordinator
Jul 9, 2011 at 5:52 AM

John,
Thanks for the feedback and your interest in my framework. Yes, a full example application is on my list of things to do. I'm glad the documentation and tutorial was helpful to you.

As to your issue, you need to define the connection string in the web.config of your web project. Silverlight apps don't have app.config files. Although, DevForce does support an app.config file in a Silverlight application, but it's rarley needed. It's the server part of your application that connects to the database and it's looking in the web.config for the connection string.

If you don't mind, can you give me some information about your project?

Jul 9, 2011 at 6:51 PM

Hi Marcel,

I was in the process of comparing the two projects to see what the difference was when you emailed me the solution. This is the most productive I've been in this area since I purchased Devforce last September. Before you emailed me I modified the Search Contacts with the following.

1) Added * to search on all records

2) Replaced data grid with DevExpress data grid for eye candy and state of the art features (sorts, filters, grouping).

3) Replaced database with Firebird 2.5 Sql server.

I originally was planning to use the product for an architect group but went the safe route with ASP.NET server side scripting. See http://www.gtz.com/Editing/ActionTree.aspx for the demo.

I have a 3rd Party Insurance company that I've developed a client/server app using Firebird 2.5/ Delphi 2007 ... that I need to augment with a web front end that I think will work great with this combo.

While I still have much to learn, I'm quite encouraged and totally willing to post mods as I go along if you want. FYI, I've had discussions with Derick Chung from Devforce telling him what I thought was lacking in the product for new developers to this paradigm.

Thanks again,

John

John R. Tomaselli

Greater Than Zero, Inc.

148 West 24th Street

12th Floor

NYC 10009

212 989 7385

917 807 1772

www.gtz.com

From: marcelgood [email removed]
Sent: Saturday, July 09, 2011 1:53 AM
To: John R. Tomaselli
Subject: Re: Sample App [devforcecaliburn:264498]

From: marcelgood

John,
Thanks for the feedback and your interest in my framework. Yes, a full example application is on my list of things to do. I'm glad the documentation and tutorial was helpful to you.

As to your issue, you need to define the connection string in the web.config of your web project. Silverlight apps don't have app.config files. Although, DevForce does support an app.config file in a Silverlight application, but it's rarley needed. It's the server part of your application that connects to the database and it's looking in the web.config for the connection string.

If you don't mind, can you give me some information about your project?

Jul 12, 2011 at 6:44 PM

Hi Marcel,

I've successfully added more features to you sample app and quite happy with results. While mostly cosmetic using Developer Express Silverl.ight controls, the sample is looking quite sophiticated with their grid and layout controls. I have 2 questions:

1) In order to save the data from any other place beside the Data Form I;ve added a Command Save button. I'm not sure how to automate the trigger save from the grid or Layout controls.

 <Button Grid.Column="0" Content="Save" Height="23" Width="75" x:Name="Save"  Command="{Binding ElementName=Save}" Visibility="Visible" />

2) I'm not clear where the button "CustomerListViewModel" gets created.

Thanks,

John

Jul 12, 2011 at 7:42 PM

Hi John. I'm not Marcel, but another John!
I'm interested in what your doing with DevExpress controls as I use them too.

Have you modified the example called, "SampleApplication" or the one, "HelloWorld"?

But in relation to your Q1, is <Button ...> a DevExpress control? If so then I think Caliburn.Micro might need a Custom Binding Convention. If a MS control the x:Name="Save" should bind automatically to a Method called Save() you have to add to the ViewModel.
For Q2, I'll have to look at the origin code...

best wishes

John R

Jul 12, 2011 at 11:28 PM
Hi, The button works, just curious how to wire it up with the trigger. I will publish what I've done later this week. Sharing and learning is what this is about. John Sent from my Windows Phone

-----Original Message-----
From: jradxl
Sent: Tuesday, July 12, 2011 3:42 PM
To: [email removed]
Subject: Re: Sample App [devforcecaliburn:264498]

From: jradxl

Hi John. I'm not Marcel, but another John!
I'm interested in what your doing with DevExpress controls as I use them too.Have you modified the example called, "SampleApplication" or the one, "HelloWorld"?But in relation to your Q1, is <Button ...> a DevExpress control? If so then I think Caliburn.Micro might need a Custom Binding Convention. If a MS control the x:Name="Save" should bind automatically to a Method called Save() you have to add to the ViewModel.
For Q2, I'll have to look at the origin code...best wishesJohn R

Coordinator
Jul 13, 2011 at 10:20 PM

johntom,

To your first question, you'll find the answer in the Caliburn Micro documentation on CodePlex. If you don't have conventions for the control, you can either use interaction triggers:

        <Button Content="Click Me">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click"> <cal:ActionMessage MethodName="SayHello" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>

or Message.Attach

<Button Content="Click Me" cal:Message.Attach="[Event Click] = [Action SayHello(Name.Text)]" />

SayHello is the method in your view model. In this case, the method even takes a parameter.

To your second question. The SampleApplication is an example for how to use the Development Harness capability of the framework. I still have to document the Development Harness. The idea behind it is that you can quickly develop all your view models and launch them with one click in the Harness instead of integrating them in the real application and the then having to login, navigate to the screen you are working on, testing and if it doesn't work, fix the problem and do it all over. The Development Harness increases productivity. So, the buttons on the left, which launch the view models on the right get created by the HarnessViewModel in Caliburn.Micro.Extensions. It discovers all view models that are marked with the IDiscoverableViewModel and automatically generates a button for it.

Jul 14, 2011 at 6:28 PM

Hi

Thanks for your through explanations. I'm doing my caliburn homework and things are starting to make sense. As a test I added the first button to the Sample Application and all works as described. When I replace it with the second button, I received the following error below. Note, my test of using both buttons in the caliburn.micro.hello sln work fine. Certainly nothing urgent, just curious as to what I've done wrong.

TIA,

John

First Button

<Button x:Name="SayHello" Content="Click Me" Grid.Row="1" Height="29" VerticalAlignment="Top" Width="120" Margin="35,0,799,0" >

<i:Interaction.Triggers>

<i:EventTrigger EventName="Click">

<cal:ActionMessage MethodName="SayHello" />

</i:EventTrigger>

</i:Interaction.Triggers>

</Button>

Second Button

<Button Content="Click Me" Grid.Row="1" x:Name="SayHello" cal:Message.Attach="[Event Click] = [Action SayHello(Name.Text)]" Margin="184,0,639,0" />

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPDTDF; BRI/1; .NET4.0C; .NET4.0E; InfoPath.2)

Timestamp: Thu, 14 Jul 2011 16:55:14 UTC

Message: Unhandled Error in Silverlight Application

Code: 4004

Category: ManagedRuntimeError

Message: System.Exception: No target found for method SayHello.

at Caliburn.Micro.ActionMessage.Invoke(Object eventArgs)

at System.Windows.Interactivity.TriggerBase.InvokeActions(Object parameter)

at System.Windows.Interactivity.EventTriggerBase.OnEvent(EventArgs eventArgs)

at System.Windows.Interactivity.EventTriggerBase.OnEventImpl(Object sender, EventArgs eventArgs)

at System.Windows.Controls.Primitives.ButtonBase.OnClick()

at System.Windows.Controls.Button.OnClick()

at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)

at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)

at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

Line: 56

Char: 13

Code: 0

URI: http://localhost:20246/

Coordinator
Jul 15, 2011 at 1:58 AM

You need to change the second button. Sorry I probably confused you. The two examples were from different contexts. If the SayHello method doesn't have any parameters, then it's just [Action SayHello]. [Action SayHello(Name.Text)] looks for a method that has a single parameter of type string.

<Button Content="Click Me" Grid.Row="1" x:Name="SayHello" cal:Message.Attach="[Event Click] = [Action SayHello]" Margin="184,0,639,0" />

Jul 15, 2011 at 2:05 AM

Thanks! I'm getting there.

J

From: marcelgood [email removed]
Sent: Thursday, July 14, 2011 9:58 PM
To: John R. Tomaselli
Subject: Re: Sample App [devforcecaliburn:264498]

From: marcelgood

You need to change the second button. Sorry I probably confused you. The two examples were from different contexts. If the SayHello method doesn't have any parameters, then it's just [Action SayHello]. [Action SayHello(Name.Text)] looks for a method that has a single parameter of type string.

<Button Content="Click Me" Grid.Row="1" x:Name="SayHello" cal:Message.Attach="[Event Click] = [Action SayHello]" Margin="184,0,639,0" />

Jul 15, 2011 at 12:04 PM

Hi Marcel,

As I continue to build my sample I've made a simple change so he data is updatable from the data grid(1). I'd added a save button (2) that I'd like to enabled only when the data is dirty using (_repository.DataChanged) to notify the SaveBtn (3) . I've tried a few things without success and would like to know where to place NotifyOfPropertyChange(() => CanSaveBtn);

TIA

John

1) <sdk:DataGrid AutoGenerateColumns="True" Name="Customers" ItemsSource="{Binding Customers}"

SelectedItem="{Binding CurrentCustomer, Mode=TwoWay}" Grid.RowSpan="1" >

<i:Interaction.Triggers>

<i:EventTrigger EventName="RowEditEnded">

<cal:ActionMessage MethodName="Save" />

</i:EventTrigger>

</i:Interaction.Triggers>

</sdk:DataGrid>

note: change also available to devexpress grid

2) <Button x:Name="SaveBtn" Content="Save" Grid.Row="1" cal:Message.Attach="[Event Click] = [Action Save]" Width="120" />

3)

public bool CanSaveBtn

{

get { return !string.IsNullOrWhiteSpace(Name); }

}

From: marcelgood [email removed]
Sent: Thursday, July 14, 2011 9:58 PM
To: John R. Tomaselli
Subject: Re: Sample App [devforcecaliburn:264498]

From: marcelgood

You need to change the second button. Sorry I probably confused you. The two examples were from different contexts. If the SayHello method doesn't have any parameters, then it's just [Action SayHello]. [Action SayHello(Name.Text)] looks for a method that has a single parameter of type string.

<Button Content="Click Me" Grid.Row="1" x:Name="SayHello" cal:Message.Attach="[Event Click] = [Action SayHello]" Margin="184,0,639,0" />

Coordinator
Jul 18, 2011 at 6:24 PM

Moved johntom's post:

Marcel,

I've been doing my homework and reviewed some of Ward's tutorials. With this in mind I've successfully ported Part 5 of the tutorial tourOfDevforce splitting the view grid to an Employee Data grid, an Employee Data form and finally a Orders detail grid sync'd with each employee. This is a great learning tool and must say the Caliburn.micro and your sample is really helping big time. The only thing I can't seem to accomplish is turning on/off the busy indicator. I'd love to push this project along very willing to contribute. Please let me know how I can send you the code for consideration.

On another note I searched the sample code for toggling the save button and tried various methods but have not succeeded yet.

Thanks,

John

Added the following (no 3rd party controls)

IEmployeeRepository.cs

EmployeeRepository.cs

EmployeeListView.xaml

EmployeeListViewModel.cs

Modfied model

Added Employee, Order and Order Detail Tables. Followed Ward's recommendations on renaming navigation properties on Employee.

Coordinator
Jul 18, 2011 at 6:26 PM
Edited Jul 18, 2011 at 6:26 PM

John,

To contribute code, you can use the "Upload Patch" feature.

http://devforcecaliburn.codeplex.com/SourceControl/list/patches/upload