At the moment, I'm just using the plain old delegates/events observer pattern for click events on my buttons. So, I thought I would go Rx.
My first attempt was balls. I thought I'd go for the simplest overload that you see in WinForms examples:
Observable.FromEventPattern<EventArgs>(__navToTestButton, 'click');
But I got an exception that Android buttons don't have a click event. That is a reflection fail of epic proportions. I'm guessing perhaps I'm missing a dll (great, another dll to make my apk even bigger).
Anyhow, I thought I'd forge on with a different overload. Now it looks like this:
navToTest = Observable.FromEventPattern<EventArgs>(
x => _navToTestButton.Click += _navToTestButton_Click,
x => _navToTestButton.Click -= _navToTestButton_Click
).ObserveOn(SynchronizationContext.Current);
Still a fail. No exception. But when I click the button, just crickets and tumbleweeds. Am I meant to subscribe to that? What would that look like, as the subscription seems to have already happened in that overload?
Xamarin is tricky enough, but Rx just makes it bloody hard. Especially with the lack of abundance of people blogging about it (at least my Google searches turned up nothing too useful. I based my code on the few bits and pieces I did find.
Thanks