iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I am developing an app using the ideas presented in the Devforce-ClientUI sample application. From my UXWindow view MemberListView, the user clicks the Edit button to edit an existing member selected in a Grid. On the Member form which is a UXDialog, is a grid listing all the jobs held by the member. The user clicks add to add a new job for the member. The app creates a new job, grabs the next refno # from a table and calls the JobHistoryEditView UXDialog to allow for entry of the new job information. Since this is a Silverlight application, I am doing asynchronous queries. Unfortunately the dialog box is being called and instantiated before the jobhistory object is created is created and the program crashes.
To ensure that the object is created first and that the dialog box is not being called before I do the following. I place the code to open the dialog editor immediately after the completed successfully routine. I think that this will ensure that the object is created first before the dialog box is called. Unfortunately the dialog box appears at runtime and then the OOB app gooes white and stops. I have a feeling that the program does not like a dialog box being called from where it is. Is that true? Is there a better way to ensure that the object is created first before the dialog box is called?
{
CreateJobHistory(CurrentMember);
}
coop.Completed += (sender, args) =>
newJob = coop.Result as JobHistory;
JobHistoryEditor.Open(
newJob,
() =>
{ // Ok callback
CloseEditSession();
},
CloseEditSession); // Cancel
};
Here is my repository method
localInfos.NextJobHistRef = nextRefNo + 1;
changedEntities.Add(localInfos);
saveOp.Completed += (sender, args) =>
SocSecNo = member.SocSecNo,
RefNo = nextRefNo,
Member = member
In my test project, I could successfully open a UXDialogBox programatically using the provided DialogBoxServiceProvider helper class from the ViewModel using this snippet:
DialogBoxServiceProvider.Show(new Settings(), null);
On you snippet you are using Open method on the JobHistoryEditor object, I could not found any available Open method in the UXDialogBox.
Bill,
Thank you for your interest in our new Contacts sample, a joint case study of Intersoft and IdeaBlade.
I'm particularly interested in your referral to the "OOB" in your message. Does this mean that the error occurred only when used in OOB scenario?
I don't notice anything weird with the code you given, they should work fine in both browser and out-of-browser mode.
If you can replicate the same error in the browser mode as well, please elaborate further on the error message and stack trace.
Thanks,Jimmy
No it happens whether it is in browser or OOB. When I move the JobHistorEditor.Open call back to its original locattion as in the sample app, the View displays properly and does not crash. Unfortunately it displays before the object is created and will crash in the constructor because I start using the object there but it is still null. Is there a better way to pause the UI so that the new view does not display until the object being passed to it in this case jobHistory is instantiated properly?
Bill
The open method is a method in the JobHistoryEditor class. I am using the sample app created between Intersoft and Ideablade as my guide. The open method of the editor class calls the dialogboxserverprovider and gets an instance of it and so forth.
Here is the error that I am getting. It occurs just as the dialogbox is finished being displayed. It likes fine, displays for a few secnods and then the OOB window just turns white and the app ppppppppppppppppppppppppppppppppppppppppppp
{System.InvalidOperationException: Collection was modified; enumeration operation may not execute
" at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)\r\n at System.Collections.Generic.List`1.Enumerator.MoveNextRare()\r\n at System.Collections.Generic.List`1.Enumerator.MoveNext()\r\n at System.Linq.Enumerable.WhereListIterator`1.MoveNext()\r\n at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)\r\n at IdeaBlade.EntityModel.PendingEntityMap.Update(EntityWrapper pendingWrapper, EntityWrapper realWrapper)\r\n at IdeaBlade.EntityModel.ScalarEntityReference`1.InformPendingEntityOfRealEntity(EntityWrapper realEntity)\r\n at IdeaBlade.EntityModel.ScalarEntityReference`1.QueryCallback(EntityQueryOperation op)\r\n at IdeaBlade.EntityModel.BaseOperation`2.OnCompleted()\r\n at IdeaBlade.EntityModel.BaseOperation`2.IdeaBlade.EntityModel.IHasAsyncEventArgs.OnCompleted()\r\n at IdeaBlade.EntityModel.AsyncProcessor`1.<>c__DisplayClass2.<.ctor>b__0(TArgs args)\r\n at IdeaBlade.EntityModel.AsyncProcessor`1.Signal()\r\n at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__5(Object x)"
Thank you for providing more information about your scenario,
Okay, it appears that you're trying to modify the collection of the results passed from the collection in the event raised by DevForce, which is not allowed in this context.
CrossPlatform.BeginInvoke( new Action(delegate { // your code here }));
Let me know if that solves your problem.
Nope that didn't make a difference. Since Silverligtht is ideal for LOB apps, this should be a very simple fix. A lot of business rules require that after an object is created it uses a next id of some sort like nextInvoiceNo, nextReceiptNo etc.
In your devforce-clientui sample, your code calls a create method in the repository which instantiates an object and then passes the object back to the calling routine to be passed to the editor class and displayed. since your code is not calling any asynchronous calls in the repository to create the obejct, it returns quickly and is instantiated before the editor is called.
in my code, I am doing the same except I am retrieving a next id from a table to populate the key field in the object. I just want to ensure that the object is instantiated before the code modes to invoke the editor. There must be way to prevent the editor from being called until the object is fully instantiated.
I initially didn't see any relations between the UI and the error that you encountered, but thought that you may add an object in the "callback" context, thus I suggest you using the BeginInvoke technique.
Based on your error stack trace, I still didn't see the relation between the dialog box and the "business rules". At a glance, this seems to be a constraint in DF in which a collection shouldn't be modified while it's being enumerated. Generally, your business rules wouldn't affect the Views, and vice versa.
I suggest you to replicate the problem "without" using dialog box/UI and see if you can successfully perform subsequent edits within the callback context. I presume that you should get the same exception here, I would be definitely interested if your results show otherwise.
Jimmy, can I email you directly? I would like to discuss a book project that I am working on involving building LOB apps with Silverlight and using ClientUI and Devforce as the 2 main tools in the book.
Bill, sure thing. You can reach me at jimmyps [at] intersoftpt.com.
Cannot get rid of this error no matter what I do. Here is my latest code change.
job,
I commented out all my code in the constructor of ViewModel. I am only displaying a blank view to ensure that nothing in my code is causing the problem. when I execute the above code, it creates the viewModel, and opens the dialog box. At that point I get the error
"Collection was modified; enumeration operation may not execute."
Forget it, I solved the problem. It wan't being added properly to the entitymanager.
Glad to hear you figured out the problem. Let me know if you found any glitches when integrating it to the UI.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname