private static SynchronizationContext GetWinRTContext() { if (!AppDomain.IsAppXModel()) { return((SynchronizationContext)null); } object forCurrentThread = SynchronizationContext.GetWinRTDispatcherForCurrentThread(); if (forCurrentThread != null) { return(SynchronizationContext.GetWinRTSynchronizationContextFactory().Create(forCurrentThread)); } return((SynchronizationContext)null); }