本文整理汇总了C#中Bus.GetObject方法的典型用法代码示例。如果您正苦于以下问题:C# Bus.GetObject方法的具体用法?C# Bus.GetObject怎么用?C# Bus.GetObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bus
的用法示例。
在下文中一共展示了Bus.GetObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
BusG.Init ();
Application.Init ();
Button btn = new Button ("Click me");
btn.Clicked += OnClick;
VBox vb = new VBox (false, 2);
vb.PackStart (btn, false, true, 0);
Window win = new Window ("D-Bus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
bus = Bus.Session;
string bus_name = "org.ndesk.gtest";
ObjectPath path = new ObjectPath ("/org/ndesk/test");
if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {
//create a new instance of the object to be exported
demo = new DemoObject ();
bus.Register (path, demo);
} else {
//import a remote to a local proxy
demo = bus.GetObject<DemoObject> (bus_name, path);
}
//run the main loop
Application.Run ();
}
示例2: Main
public static void Main()
{
BusG.Init ();
Application.Init ();
btn = new Button ("Click me");
btn.Clicked += OnClick;
VBox vb = new VBox (false, 2);
vb.PackStart (btn, false, true, 0);
Window win = new Window ("D-Bus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
bus = Bus.Session;
string bus_name = "org.ndesk.gtest";
ObjectPath path = new ObjectPath ("/org/ndesk/btn");
if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {
bus.Register (path, btn);
rbtn = btn;
} else {
rbtn = bus.GetObject<Button> (bus_name, path);
}
//run the main loop
Application.Run ();
}
示例3: Main
public static void Main()
{
BusG.Init ();
Application.Init ();
Window win = new Window ("D-Bus#");
win.SetDefaultSize (640, 480);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
bus = Bus.Session;
sysBus = Bus.System.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));
string bus_name = "org.ndesk.gtest";
ObjectPath path = new ObjectPath ("/org/ndesk/test");
if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {
//create a new instance of the object to be exported
demo = new DemoObject ();
sysBus.NameOwnerChanged += demo.FireChange;
bus.Register (path, demo);
} else {
//import a remote to a local proxy
demo = bus.GetObject<DemoObject> (bus_name, path);
}
//run the main loop
Application.Run ();
}