public static void runInForeground(CoreDispatcher Dispatcher, Action actionToRun)
{
if (Dispatcher != null)
Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => actionToRun());
else
Windows.System.Threading.ThreadPool.RunAsync(handler => actionToRun());
}