First, we will add another button to the main page (Home.xaml) for creating new events.
I opened Home.xaml, selected a button from the Toolbox, and dropped it into the view for Home.xaml. Next, I repositioned the button, and changed a few properties, such as the text, name, etc.
Next, I created the click handler, in which I added code to create an event with some placeholders, and then navigate to the edit page to edit it with actual data. I do not like this way of doing things. What if the user does not put in actual data immediately. Then we will have an application with a bunch of phantom events. Why can we not straight away ask the user for details, and then save the event only when the use creates the details.
Anyways, got the application working till now. I am able to create new events. However, from a usability perspective, when we save an event, at the moment we do not get any notification. At least we should take the user back to the HomePage so they can view the updated list. Implemented this feature by invoking NavigationService.Navigate in the click handler of the 'Save' button.
The lab page for the assignment explains why we create a new domain context object instead of re-using the one we already have (similar to the the domainDataSource object we used in editEvent... though I do not know what scope this object is available in, and how/(if at all) it is shared among the views).
No comments:
Post a Comment