문제

How will I be able to get the version number of my application in metro javascript?

For example, this is the 1.2 version of our application, how can I get the version number in my javascript metro code?

도움이 되었습니까?

해결책

You can use the Windows.ApplicationModel.Package.current.id.version object to reference the version specified in your application manifest.

The version object contains "build, major, minor & revision" properties.

For further details, see http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.package.aspx

다른 팁

Use this helper method to get the version as a complete string:

function getAppVersion() {
    var p = Windows.ApplicationModel.Package.current.id.version;
    return p.major + "." + p.minor + "." + p.build + "." + p.revision;
}

To display it to the user:

document.getElementById("version").innerHTML = "version " + getAppVersion();

This assumes you add this tag:

<span id="version"></span>

How about this;


function getCurrentApplicationVersion() {
    var currentVersion = Windows.ApplicationModel.Package.current.id.version;
    var values = [];
    for (var key in currentVersion) {
        values.push(currentVersion[key]);
    }
    return values.join('.');
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top