I am new to MVC# and am trying to extend the TasksInTabs example. I am struggling to understand how the Application layer (TabTask1 for example) can communicate with the view (for example to change the text on the label).
I realise this is probably a very simple question but any help is appreciated.
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In MVC/MVP patterns it's usually controllers/presenters who initiate changes in UI (in other words they control their views).
So I recommend that your Task sends a message to the controller which then would access its view. Here's an example how a task can access a controller:
this.Navigator.GetController(TabTask1.View2);
In particular you can access the current view:
this.Navigator.GetController(this.CurrViewName);
Make sure to initialize the view before accessing it. If the view hasn't been displayed or created yet, accessing it may result in an exception.
Kind Regards,
--
Oleg Zhukov
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am new to MVC# and am trying to extend the TasksInTabs example. I am struggling to understand how the Application layer (TabTask1 for example) can communicate with the view (for example to change the text on the label).
I realise this is probably a very simple question but any help is appreciated.
Thanks
Hi,
In MVC/MVP patterns it's usually controllers/presenters who initiate changes in UI (in other words they control their views).
So I recommend that your Task sends a message to the controller which then would access its view. Here's an example how a task can access a controller:
In particular you can access the current view:
Make sure to initialize the view before accessing it. If the view hasn't been displayed or created yet, accessing it may result in an exception.
Kind Regards,
--
Oleg Zhukov
Hi Oleg,
Thanks for your prompt response. I understood the basic principle just not how to implement it!
Regards,
Richard