I have an app in MonoTouch.Dialog where I try to use the ActivityElement.
My plan was to first show an activity element, then make my webservice call and when I got the response I would remove the activity element and instead add some new string elements.
This does not work. I am unable to remove or add elements once the view has been displayed.
How do I solve this?
rootElement = new RootElement ("Mobile Servicedesk"){
(requestSection = new Section ("My requests"){
new ActivityElement()
})
};
new Thread (() => {
var incidents = IncidentProvider.LoadMyRequests ();
requestSection.Elements.Clear ();
foreach (var item in incidents) {
requestSection.Elements.Add (new StringElement(item.Name))
}
}
).Start ();
EDIT:
OK, now I got the updating part solved, at least in one part of my solution.
InvokeOnMainThread (() => {
ReloadData();
});
ReloadData() works in my appDelegate view, but not in my subviews. I even tried to ensure that it is invokedd on the main thread but still no luck…
Any help would be appreciated!
Ah! Got it!
Since I had a second RootElement I needed call ReloadData on that specific root… now it works!