Skip to content

Commit

Permalink
Try to fix the DesignMode trainwreck
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Aug 25, 2011
1 parent 58043c2 commit 795c554
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ReactiveUI/RxApp.cs
Expand Up @@ -197,18 +197,28 @@ public static bool InUnitTestRunner()

string[] designEnvironments = new[] {
"BLEND.EXE",
"DEVENV.EXE",
"MONODEVELOP",
"SHARPDEVELOP.EXE",
};

#if SILVERLIGHT
if (Application.Current.RootVisual != null && System.ComponentModel.DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual)) {
var ret = Deployment.Current.Parts.Any(x =>
testAssemblies.Any(name => x.Source.ToUpperInvariant().Contains(name)));

if (ret) {
return ret;
};

try {
if (Application.Current.RootVisual != null && System.ComponentModel.DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual)) {
return false;
}
} catch {
// If we're in some weird state, assume we're not
return false;
}

return Deployment.Current.Parts.Any(x =>
testAssemblies.Any(name => x.Source.ToUpperInvariant().Contains(name)));
return ret;
#else
// Try to detect whether we're in design mode - bonus points,
// without access to any WPF references :-/
Expand Down

0 comments on commit 795c554

Please sign in to comment.