/// <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();
            }));
        }
예제 #2
0
파일: Game.cs 프로젝트: masums/ultraviolet
        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();
        }
예제 #3
0
        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();
            }
        }