当前位置:  开发笔记 > 编程语言 > 正文

全屏模式 - Windows 10 App(JS)

如何解决《全屏模式-Windows10App(JS)》经验,为你挑选了1个好方法。

您好,我在网上搜索,无法找到正确的代码或其他内容,以将我的应用程序作为全屏运行.我想制作它,激活全屏模式并自动隐藏标题栏(带按钮).我是Visual Studios和Windows 10应用程序开发的初学者.我正在尝试创建一个JS应用程序.

我只能找到C#/ C++应用程序的全屏模式,但找不到JS.

https://github.com/JustinXinLiu/FullScreenTitleBarRepo/tree/master/FullScreenTitleBarRepo



1> Grace Feng..:

这是一个官方的全屏模式示例,此示例中有一个js项目.

如果要以全屏模式启动应用程序,可以使用ApplicationView.PreferredLaunchWindowingMode和ApplicationViewWindowingMode,default.js如下所示:

// For an introduction to the Blank template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232509
(function () {
    "use strict";

var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;

var ViewManagement = Windows.UI.ViewManagement;
var ApplicationViewWindowingMode = ViewManagement.ApplicationViewWindowingMode;
var ApplicationView = ViewManagement.ApplicationView;

app.onactivated = function (args) {
    if (args.detail.kind === activation.ActivationKind.launch) {
        if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
            // TODO: This application has been newly launched. Initialize your application here.
        } else {
            // TODO: This application was suspended and then terminated.
            // To create a smooth user experience, restore application state here so that it looks like the app never stopped running.
        }           
        args.setPromise(WinJS.UI.processAll());
        ApplicationView.preferredLaunchWindowingMode = ApplicationViewWindowingMode.fullScreen;
    }
};

app.oncheckpoint = function (args) {
    // TODO: This application is about to be suspended. Save any state that needs to persist across suspensions here.
    // You might use the WinJS.Application.sessionState object, which is automatically saved and restored across suspension.
    // If you need to complete an asynchronous operation before your application is suspended, call args.setPromise().
};

app.start();

})();

推荐阅读
夏晶阳--艺术
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有