I’ve been tinkering in Xamarin, to allow my development to more easily target multiple mobile platforms.
I’ve made a start on two apps, and I just hit a little wall that was easily fixed but I thought was worth sharing:
The Xamarin tutorials show navigation as being done with a “Push” like this:
await Navigation.PushAsync (newPage2Xaml ());
Which is great, except it doesn’t work out of the box.
The issue is for this to function, you need your app to be utilizing a NavigationPage element. A Navigation page is a page which holds other pages and navigation… I suppose (very) roughly like a Frame in UWP.
But the default templates don’t include one. So the easy way to change it is to go to your App.xaml.cs and change the constructor from opening a regular page like this:
MainPage = new MyAppName.Views.MainView();
to this creating a NavigationPage and then “Push”-ing to the start view**:
var p = new NavigationPage();
MainPage = p;
Now your whole application exists within the NavigationPage element and navigation should work as intended.
** Yes the var is not required, however this is a logical layout to show the example.
I needed this week, a particular kind of colour picker. I couldn’t find one so I made one.
I tried using a gradient background, but was unable to find a way to pick the tapped colour out of it, even though I could get the POINT co-ordinate.
Instead, I had to do it like this.
It isn’t a custom control, just a usercontrol so I can re-use it.
It’s a Image of the gradient, and in the background it holds the original image as a WriteableBitmapEX.
On the right is a grid with the background set to the colour selected.
On the Tap event I got the position of the tap along with the width of the visible image control (as it could stretch with the users screen).
Then I bilinear resize the background image to match the visible image and grab the pixel from the tap events position. Push it back into the property and ta-da!
It’s now getting some further work (stop the image from resampling resampling if the image hasn’t resized (speed and avoid loss of quality) and it would be great if it set the colour while holding so you could drag a finger/cursor and see the color change without lifting). But this first iteration was interesting so I wanted to share.
It’s been a little quiet here on the blog, but we have been busy behind the scenes;
We’ve been experimenting with Microsoft’s AI suite, and coming up with some cool new ideas, some of which have been trialed in beta. More on these soon.
Also, we’ve been making consistent improvements to Simple PoS. Our new thermal printer is on it’s way; which will allow us to test the new Thermal Printing (docket printer) option in Simple PoS ready to be released to the production version.
Finally; I’ve just finished adding in the new FFMPEG CODECS for Voyer. The previous version was getting a little long in the tooth and I had noticed more videos that it couldn’t decode. I do full local recompiles of FFMPEG, which is touchy to say the least and not a job I look forward to but very valuable to do every 6 months or so. There are components I could use rather than do this onerous task myself but most lack ARM capability or other features I want. Thus I do it the old fashioned way.