首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >全屏模式- Windows 10应用程序(JS)

全屏模式- Windows 10应用程序(JS)
EN

Stack Overflow用户
提问于 2015-12-31 20:46:54
回答 1查看 1.6K关注 0票数 2

Hello,我在网上搜索,找不到合适的代码或什么的,把我的应用程序作为全屏运行。我想使之,激活全屏模式,并自动隐藏标题栏(按钮)。我是一个初学者的视觉工作室和Windows 10应用程序开发。我正在尝试创建一个JS应用程序。

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

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-01 05:52:01

这里是一个官方的全屏模式样本,在这个示例中有一个js项目。

如果您想以全屏方式启动该应用程序,可以在ApplicationView.PreferredLaunchWindowingModeApplicationViewWindowingMode中使用default.js,如下所示:

代码语言:javascript
复制
// 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();

})();
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34551471

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档