On this sample's GitHub repository's Readme, I mentioned that this application was missing a few things. Time to tackle one of them. Every application that communicates with a backend of any type needs a refresh button, or at least a way to refresh the view with the latest from the backend (SQLite, Webservice, etc...).
Let's walk through adding a refresh button!
Add the button on the view.
this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Refresh, refreshTask), true)
Note the choice of the standard 'Refresh' for the button style.
Create a event handler, in this instance, I simply called it refreshTask.
let refreshTask = EventHandler(fun sender eventargs -> let refresh = WebService.Shared.GetWebsites() table.Source<- new PingMeDataSource( refresh, this.NavigationController) table.ReloadData())
I am positive there is a better way to refresh this view, as I simply copied the load items code. I am still working on learning f# and some of the functional ways. I will update later, I just want this to work.
Xamarin did a really good job on tooling for F#, I enjoyed this very basic task of updating the Ping Me F# app, and am happy that I am able to consume the Azure backend in a way that makes sense. I mainly struggle around the F# idioms, I am just not familiar enough with the language to utilize all the benefits. That will change, because I am officially interested in this language.
As always, you can reach me on twitter with any comments or questions. If you want to play with the app and want me to run the scheduled service (otherwise you wait ten whole minutes!) feel free to reach out. If it is convenient time for me I will do so, otherwise, just wait the time. Please make sure you enter an area code, right now the only thing the backend adds to the user's phone number is '+1' for sending twilio SMS messages.