Last active
August 29, 2015 14:23
-
-
Save camilomartinez/1bdb9b6a486fce795dab to your computer and use it in GitHub Desktop.
Check design mode before calling MVVM light Distpatcher helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using GalaSoft.MvvmLight; | |
using GalaSoft.MvvmLight.Threading; | |
namespace MvvmLight.Helpers | |
{ | |
public class DesignAwareDispatcherHelper | |
{ | |
// ReSharper disable once InconsistentNaming | |
public static void CheckDesignModeInvokeOnUI(Action action) | |
{ | |
if (action == null) | |
{ | |
return; | |
} | |
if (ViewModelBase.IsInDesignModeStatic) | |
{ | |
action(); | |
} | |
else | |
{ | |
DispatcherHelper.CheckBeginInvokeOnUI(action); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment