Giter VIP home page Giter VIP logo

windows-app-rs's Introduction

Build and Test

Rust for the Windows App SDK

The windows-app crate lets you call any Windows App SDK (formerly known as Project Reunion) API using code generated from the metadata describing the API. It is powered by the windows crate.

Note: This is an experimental 🧪 crate and is not ready for production use.

Release channel coverage

The Windows App SDK is delivered via three release channels—experimental, preview, and stable. The windows-app crate currently targets APIs available in the preview and stable channels.

Getting started

It's very early days for the windows-app crate. To try it out, add the following to your Cargo.toml file:

[build-dependencies.windows-app]
git = "https://github.com/microsoft/windows-app-rs"
features = [
    "WindowsAppSdk_Foundation"
]

[dependencies.windows]
version = "0.29"
features = [
    "std"
]

[dependencies.windows-app]
git = "https://github.com/microsoft/windows-app-rs"
features = [
    "WindowsAppSdk_Foundation",
    "Windows_System_Power"
]

Add a build script (build.rs) to your crate to deploy the Windows App SDK Bootstrapper with your app:

fn main() {
    ::windows_app::bootstrap::deploy::to_output_dir();
}

Now make use of any Windows App SDK APIs as needed:

use ::windows_app::Microsoft::Windows::System::Power::*;
use ::windows_app::*;

fn main() -> ::windows::core::Result<()> {
    bootstrap::initialize()
        .and_then(|_| {
            println!(
                "Remaining charge: {}%",
                PowerManager::RemainingChargePercent()?
            );
            Ok(())
        })
        .and_then(|_| bootstrap::uninitialize())
}

Finally, install the Windows App Runtime on all target machines:

  1. Download the Windows App Runtime Redistributable package.
  2. Execute WindowsAppSDK-Installer-{arch}\WindowsAppRuntimeInstall.exe.

After you install the Windows App Runtime, it will be kept up-to-date by Microsoft via Windows Update.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.