Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ServiceX {
- void doFoo(x arg , y arg2 , callback arg3){
- //do in your thread
- arg3.success("with return variables you need")
- // or
- arg3.failed("with exception for example");
- }
- }
- interface Callback {
- void success(args...);
- void failed(args ...);
- }
- in your view :
- // do
- ServiceX bar = // get your service
- bar.doFoo(a1,a2,new CallBack(){
- void succes(args ...){
- }
- void failed(args ...){
- }
- });
- // ...
- [RunInBackground]
- public void TakeSomeTimeToRetrieveSomeItems
- {
- var items = _svc.GetSomeItemsFromTheWeb();
- _view.ShowItems(items); // synced to UI automatically; blocks in presenter
- }
- // ...
- public void ShowItems(IList<Item> items)
- {
- itemBindingSource.DataSource = items;
- }
Add Comment
Please, Sign In to add comment