/// <summary> /// Initializes a test application which displays the specified Presentation Foundation view. /// </summary> protected IUltravioletTestApplication GivenAPresentationFoundationTestFor <T>(Func <ContentManager, T> ctor) where T : UIScreen { var globalStyleSheet = default(GlobalStyleSheet); var screen = default(UIScreen); return(GivenAnUltravioletApplication() .WithPresentationFoundationConfigured() .WithInitialization(uv => { var upf = uv.GetUI().GetPresentationFoundation(); upf.CompileExpressions(Path.Combine("Resources", "Content"), CompileExpressionsFlags.GenerateInMemory | CompileExpressionsFlags.WorkInTemporaryDirectory); upf.LoadCompiledExpressions(); }) .WithContent(content => { content.Ultraviolet.GetContent().Manifests.Load(Path.Combine("Resources", "Content", "Manifests", "Global.manifest")); globalStyleSheet = GlobalStyleSheet.Create(); globalStyleSheet.Append(content, "UI/DefaultUIStyles"); content.Ultraviolet.GetUI().GetPresentationFoundation().SetGlobalStyleSheet(globalStyleSheet); screen = ctor(content); content.Ultraviolet.GetUI().GetScreens().Open(screen); }) .WithDispose(() => { screen?.Dispose(); globalStyleSheet?.Dispose(); })); }
private void LoadPresentation() { var upf = Ultraviolet.GetUI().GetPresentationFoundation(); var globalStylesheet = GlobalStyleSheet.Create(); globalStylesheet.Append(content, "UI/DefaultUIStyles"); upf.SetGlobalStyleSheet(globalStylesheet); upf.CompileExpressionsIfSupported("Content"); upf.LoadCompiledExpressions(); }
private void LoadPresentation() { var upf = Ultraviolet.GetUI().GetPresentationFoundation(); upf.RegisterKnownTypes(GetType().Assembly); if (!ShouldRunInServiceMode()) { globalStyleSheet = GlobalStyleSheet.Create(); globalStyleSheet.Append(content, "UI/DefaultUIStyles"); upf.SetGlobalStyleSheet(globalStyleSheet); CompileBindingExpressions(); upf.LoadCompiledExpressions(); } }