} // End Sub TestClipboard public override async Task SetClipboardContentsAsync(string text) { Tmds.DBus.ObjectPath objectPath = new Tmds.DBus.ObjectPath("/klipper"); string service = "org.kde.klipper"; using (Tmds.DBus.Connection connection = new Tmds.DBus.Connection(Tmds.DBus.Address.Session)) { await connection.ConnectAsync(); Klipper.DBus.IKlipper klipper = connection.CreateProxy <Klipper.DBus.IKlipper>(service, objectPath); await klipper.setClipboardContentsAsync(text); } // End using connection } // End Task SetClipboardContentsAsync
public void SetText(string value) { Tmds.DBus.ObjectPath objectPath = new Tmds.DBus.ObjectPath("/klipper"); string service = "org.kde.klipper"; using (Tmds.DBus.Connection connection = new Tmds.DBus.Connection(Tmds.DBus.Address.Session)) { connection.ConnectAsync().Wait(); Klipper.DBus.IKlipper klipper = connection.CreateProxy <Klipper.DBus.IKlipper>(service, objectPath); klipper.setClipboardContentsAsync(value).Wait(); } }
} // End Task SetClipboardContentsAsync public override async Task <string> GetClipboardContentAsync() { string clipboardContents = null; Tmds.DBus.ObjectPath objectPath = new Tmds.DBus.ObjectPath("/klipper"); string service = "org.kde.klipper"; using (Tmds.DBus.Connection connection = new Tmds.DBus.Connection(Tmds.DBus.Address.Session)) { await connection.ConnectAsync(); Klipper.DBus.IKlipper klipper = connection.CreateProxy <Klipper.DBus.IKlipper>(service, objectPath); clipboardContents = await klipper.getClipboardContentsAsync(); } // End Using connection return(clipboardContents); } // End Task GetClipboardContentsAsync
public string GetText() { string clipboardContents = null; Tmds.DBus.ObjectPath objectPath = new Tmds.DBus.ObjectPath("/klipper"); string service = "org.kde.klipper"; using (Tmds.DBus.Connection connection = new Tmds.DBus.Connection(Tmds.DBus.Address.Session)) { connection.ConnectAsync().Wait(); Klipper.DBus.IKlipper klipper = connection.CreateProxy <Klipper.DBus.IKlipper>(service, objectPath); clipboardContents = klipper.getClipboardContentsAsync().Result; } // End Using connection return(clipboardContents); }