 So, welcome to this talk about connecting.NET Core to Divas. My name is Tom DeSain. I work at Red Hat in the.NET Core team. In our team, we package.NET Core for Fedora, OpenShift Container Platform, and we support our customers with.NET Core issues they have. I'm also a member of Fedora's.NET special interest group, which is an open group for people who are running on Fedora using.NET. So, we package.NET Core for Fedora, and we talk about.NET stuff. That group is open to anyone that wants to join it. I'm a contributor to.NET Core, and my contributions are mainly focusing on fixing Linux issues. I maintain a number of.NET Core Linux focus libraries, or.NET libraries like the one I'm giving this talk about, which is for working with Divas. I think most of you know Divas, but in case you don't, this is a one slide overview. So, Divas is an IPC mechanism. So, in the process communication mechanism that you find on most Linux systems, and system demons use it, and also desktop services use it. Some of these services are on a system bus, like your system D init process is on the system bus, and all the services like for example, your clipboard will be on a per user login session bus. So, these services expose their functionality as objects, and each object is identified by a path, and those objects implement interfaces and interfaces provide methods, properties, and signals. So, it's a pretty object oriented model. This library I'm using, so I'm maintaining this fork of Divas sharp, which has been around for a lot of time, and I updated the library to use the.NET asynchronous programming models, so task, await, sync type of things, and I built a tool for generating C sharp interfaces to access Divas services. So, the code for this is on GitHub, and packages are published on Nougat.org, so you can easily consume those. It's demo time. So, I'm creating a directory here and launching visual studio code, and let me open up the terminal here, and create a new console project. So, I get two files. One is my hello world main file, and the other one is a project file. I'm going to make one change here, which is specifying I want the latest C sharp version available in my program. So, to interact with Divas, the first thing we're going to do is add this TMDS Divas package. I can do that. Let me close these up. Also on the command line, and this will fetch the package from Nougat.org, and it adds the latest version, which is 070 to my project file. Another thing I'm going to add is the tool package. Unlike the previous package, the first package I added is a library. So, this is what the application will be using when we're running it to interact with Divas. The second package is actually an extension for the .NET command line interface, which we can use like for example, to generate C sharp code to work with those Divas services. So, I'm going to change this to .NET CLI tool reference because this is actually what the package is meant for. I'm going to call the .NET restore command once more, so it picks up this tool, and now I get this new command, which is .NET Divas, which is provided by that second package, and it allows me to do two things, generate code and list of stuff, which is on Divas. So, for example, I can do .NET Divas list services, and that will provide me a list with all the services which are now on my user bus. As our demo application, we're going to build a small application that takes the screenshot of the desktop and that opens that up. To take that screenshot, we're going to use the OrcNomeShell service, which was in this list. So, I'm now going to use the CodeGen command. I do .NET Divas CodeGen service Orc.Nome.Shell, and what this does is it goes and talks to this service and looks at introspection data, and from that introspection data, you get this file with a lot of interfaces, which describe all the functionalities that are available via this service. So, one of the things provided is the ability to take screenshots and we'll be using this IScreenshot interface and call the screenshot async methods to make that screenshot using that service. So, in our program file, we're going to create a local object, which is a proxy for the object in the service that allows us to create a screenshot. Now, I'm going to use the connection object, which is provided by the library. I'm going to the session bus, and I'm calling the create proxy method, and I'm using this interface, which was just generated for us. I need to provide two arguments here. The first argument is the name of our service, which is OrcNomeShell. The second argument is the part that identifies the object within the service, and to find that object, I can again use this CLI tool. So, I do .NET DebussListObjects, service OrcNomeShell, and I'll grab for screenshot here, and we see there is an object at this part which provides that interface. So, I'm going to write the part in here, which is OrcNomeShellScreenshot, and there we have our proxy object, and now we can just invoke that. This is an asynchronous method, so I'm going to update my main here, so it becomes async-compatible, and we'll call screenshot async. As a first parameter, we specify if you want to include the cursor, that's that too true. A second parameter is do we want to flash the screen? Let's flash the screen, and as a third parameter, we specify the file name. Now, we're going to look at the result, which contains two things, the file name used and whether it was successful or not, and if the result was successful, we're going to pop up this screenshot we just made on the desktop, and we'll use .NET's process class for that, and we'll pick the file name from the result, and we'll ask the shell, which is OrcNomeShell to open up that screenshot, and we'll also add an else statement here to get a message. In case we weren't able to make a screenshot, we'll write the message. Let's try to build this. This builds fine, and now we can run it, and voila, we saw the flash, and there's our screenshot that pops up. So, I think that was pretty nice. Like in five minutes, we were able to generate some code and access that DBA service. So my takeaway for you is, like if you want to access DBA services from .NET, whether it's Mono or .NET Core, but therefore you can use this library and it becomes really easy. So, we're at the end of the time slot. If you have questions, you can find me after the presentation. Thank you.