Feb 1, 2012 at 2:11 AM
Edited Feb 1, 2012 at 2:12 AM
I have implemented a feature using ViewModelDetailBase that shows a ChildWindow to edit an entity to edit the properties. I have used Notify event and in the code behind, instantiated the childwindow view and set the datacontext with the passed in model
/// Edits the selected treatment module.
public void EditTreatmentModule()
string type = SelectedAppliedTreatment.GetType().ToString();
string modeltype = type.Substring(type.LastIndexOf('.') + 1);
new NotificationEventArgs<ITreatment, bool>
(modeltype, SelectedAppliedTreatment, Calculate));
MessageBox.Show("Cannot cast the to desired object.");
private void Calculate(bool enable)
EnableRemoveTreatments = enable;
THE CODE BEHIND:
void vm_EditTreatmentNotice(object sender, NotificationEventArgs<ITreatment, bool> e)
var tViewModel = new TreatmentViewModel(e.Data as TreatmentModel);
var tView = new TreatmentView(tViewModel);
tView.Closed += (s, ea) => e.Completed(true);
This works fine when I am running in my development machine using visual studio 2010.
I then published this to IIS server (also my development machine running XP SP3). The application runs fine until I click the EDIT button which fires the Notify event with the model data. I get an Application Error.
"Application has generated an exception that could not be handled.
Process ID =0x11bc(4540), Thread ID=0x8e4 (2276)
Click OK to terminate the application.
Click CANCEL to debug the application."
I have no idea what went wrong as it work fine when I running in my machine.
I have implemented the same method for opening up a file in childwindow and it works fine.
Any clues as to what must have gone wrong?
Your help is highly appreciated. Thanking you in advance.