Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

C# on Linux - demo4

This repository contains .NET Core demo that I use during some of my talks. Please note that this code contains hacks and should not be taken seriously - it serves only as demonstration of interacting with the Linux system.
This demo is built on top of Tom's DBus library.

Resources:

Steps:

  1. For this demo we need dotnet sdk installed, and an IDE of your choice. You can find out more at fedoraloves.net
  2. Add NuGet repository for tmds.DBus
    1. Edit the NuGet configuration:
      $ vim ~/.nuget/NuGet/NuGet.Config
    2. Add a new packageSource:
      <add key="tmds" value="https://www.myget.org/F/tmds/api/v3/index.json" protocolVersion="3" />
  3. Create a new console application:
    $ mkdir demo4 && cd demo4
    $ dotnet new console
  4. Edit the project file to include tmds.DBus
    $ vim demo4.csproj
  5. Run $ dotnet restore to get the NuGet packages we need.
  6. List DBus services and find objects for org.freedesktop.UPower:
    $ dotnet dbus list --bus system services | grep -i power
    -org.freedesktop.UPower
    $ dotnet dbus list --bus system --service org.freedesktop.UPower objects | head -1
    -/org/freedesktop/UPower : org.freedesktop.UPower
  7. Generate C# interfaces for the UPower service:
    $ dotnet dbus codegen --bus system --service org.freedesktop.UPower
    -Generated: /home/rjanek/dev/dotnettalks/demo4/UPower.DBus.cs
  8. Play with it =)

About

My .NET Core talks - demo4

Resources

License

Releases

No releases published

Languages

You can’t perform that action at this time.