代码之家  ›  专栏  ›  技术社区  ›  o'Bass

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

  •  2
  • o'Bass  · 技术社区  · 9 年前

    你好 , 我在网上搜索了一下,但找不到合适的代码或其他东西,无法以全屏模式运行我的应用程序。我想做到这一点,激活全屏模式并自动隐藏标题栏(带按钮)。我是Visual Studio和Windows 10应用程序开发的初学者。我正在尝试创建一个JS应用程序。

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

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

    1 回复  |  直到 9 年前
        1
  •  6
  •   Grace Feng    9 年前

    这是一位官员 Full screen mode sample ,此示例中有一个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();
    
    })();