Skip to content

Commit

Permalink
Update WPFPlatformServices.cs (#10652)
Browse files Browse the repository at this point in the history
  • Loading branch information
tessarolli authored May 15, 2020
1 parent b995e20 commit 1a380f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Xamarin.Forms.Platform.WPF/WPFPlatformServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class WPFPlatformServices : IPlatformServices
{
public bool IsInvokeRequired
{
get { return !System.Windows.Application.Current.Dispatcher.CheckAccess(); }
get { return System.Windows.Application.Current == null ? false : !System.Windows.Application.Current.Dispatcher.CheckAccess(); }
}

public string RuntimePlatform => Device.WPF;
Expand All @@ -27,7 +27,7 @@ public void OpenUriAction(Uri uri)
{
System.Diagnostics.Process.Start(uri.AbsoluteUri);
}

public void BeginInvokeOnMainThread(Action action)
{
System.Windows.Application.Current?.Dispatcher.BeginInvoke(action);
Expand Down Expand Up @@ -124,7 +124,7 @@ public IIsolatedStorageFile GetUserStoreForApplication()
{
return new WPFIsolatedStorageFile(IsolatedStorageFile.GetUserStoreForAssembly());
}

public void StartTimer(TimeSpan interval, Func<bool> callback)
{
var timer = new DispatcherTimer(DispatcherPriority.Background, System.Windows.Application.Current.Dispatcher) { Interval = interval };
Expand Down

0 comments on commit 1a380f3

Please sign in to comment.