Today I was trying to implement reading of ushort values from a little-endian byte array. The code to retrieve a single value was pretty simple – shift the second byte by 8 to the left and add the first byte: What could possibly go wrong? It turned out quite a bit. The code was giving
There are countless times in the life of a Universal Windows Platform app developer when the “Transparent” color comes handy. However, it is good to remember that “Transparent” is still just a color, otherwise you can encounter some unwelcome surprises.
VisualStateManager je velmi užitečný při sestavování XAML designu. Spolu s AdaptiveTriggery v UWP umožňuje snadno přecházet mezi jednotlivými stavy rozložení tak, aby aplikace vypadala skvěle na každém displeji. Měli bychom si však dát pozor na dva nenápadné problémy, na které v souvislosti s touto třídou můžeme narazit.
VisualStateManager is extremely useful when building XAML layouts. With UWP’s AdaptiveTriggers to switch between states it provides a great way to build design that looks great on any screen size. There are however two small gotchas that can cause unnecessarily long periods of head scratching. (more…)
First up – sorry Jack Reacher fans, this post is not about the novel 🙂 . In my latest Windows 10 app Event Countdowns I made a very unlucky mistake. When registering its Background Task that should update the app’s tiles every 30 minutes, I used the following code:
string myTaskName = "TileUpdaterBackgroundTask";
// check if task is already registered
var task =
BackgroundTaskRegistration.AllTasks.Where( cur => cur.Value.Name == myTaskName ).Select( c => c.Value ).SingleOrDefault();
if ( task != null )
//do not register again
var backgroundAccess = await BackgroundExecutionManager.RequestAccessAsync();
if ( backgroundAccess == BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity ||
backgroundAccess == BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity )
// register a new task
BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder
Name = myTaskName,
TaskEntryPoint = "TileUpdateTask.TileUpdateBackgroundTask"
taskBuilder.SetTrigger( new TimeTrigger( 30, true ) );
BackgroundTaskRegistration myFirstTask = taskBuilder.Register();
At first glance, nothing out of the ordinary. Or so I thought. One day after the app was