static void RegisterRemoteControl(NoteManager manager) { try { remote_control = RemoteControlProxy.Register(manager); if (remote_control != null) { Logger.Debug("Tomboy remote control active."); } else { // If Tomboy is already running, open the search window // so the user gets some sort of feedback when they // attempt to run Tomboy again. IRemoteControl remote = null; try { remote = RemoteControlProxy.GetInstance(); remote.DisplaySearch(); } catch {} Logger.Error("Tomboy is already running. Exiting..."); System.Environment.Exit(-1); } } catch (Exception e) { Logger.Warn("Tomboy remote control disabled (DBus exception): {0}", e.Message); } }
public static RemoteControl Register(NoteManager manager) { #if ENABLE_DBUS BusG.Init(); RemoteControl remote_control = new RemoteControl(manager); Bus.Session.Register(Namespace, new ObjectPath(Path), remote_control); if (Bus.Session.RequestName(Namespace) != RequestNameReply.PrimaryOwner) { return(null); } return(remote_control); #else if (FirstInstance) { // Register an IPC channel for .NET remoting // access to our Remote Control IpcChannel = new IpcChannel(ServerName); ChannelServices.RegisterChannel(IpcChannel, false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(RemoteControlWrapper), WrapperName, WellKnownObjectMode.Singleton); // The actual Remote Control has many methods // that need to be called in the GTK+ mainloop, // which will not happen when the method calls // come from a .NET remoting client. So we wrap // the Remote Control in a class that implements // the same interface, but wraps most method // calls in Gtk.Application.Invoke. // // Note that only one RemoteControl is ever // created, and that it is stored statically // in the RemoteControlWrapper. RemoteControl realRemote = new RemoteControl(manager); RemoteControlWrapper.Initialize(realRemote); RemoteControlWrapper remoteWrapper = (RemoteControlWrapper)Activator.GetObject( typeof(RemoteControlWrapper), ServiceUrl); return(realRemote); } else { // If Tomboy is already running, register a // client IPC channel. IpcChannel = new IpcChannel(ClientName); ChannelServices.RegisterChannel(IpcChannel, false); return(null); } #endif }
public static RemoteControl Register (NoteManager manager) { #if ENABLE_DBUS BusG.Init (); RemoteControl remote_control = new RemoteControl (manager); Bus.Session.Register (Namespace, new ObjectPath (Path), remote_control); if (Bus.Session.RequestName (Namespace) != RequestNameReply.PrimaryOwner) return null; return remote_control; #else if (FirstInstance) { // Register an IPC channel for .NET remoting // access to our Remote Control IpcChannel = new IpcChannel (ServerName); ChannelServices.RegisterChannel (IpcChannel, false); RemotingConfiguration.RegisterWellKnownServiceType ( typeof (RemoteControlWrapper), WrapperName, WellKnownObjectMode.Singleton); // The actual Remote Control has many methods // that need to be called in the GTK+ mainloop, // which will not happen when the method calls // come from a .NET remoting client. So we wrap // the Remote Control in a class that implements // the same interface, but wraps most method // calls in Gtk.Application.Invoke. // // Note that only one RemoteControl is ever // created, and that it is stored statically // in the RemoteControlWrapper. RemoteControl realRemote = new RemoteControl (manager); RemoteControlWrapper.Initialize (realRemote); RemoteControlWrapper remoteWrapper = (RemoteControlWrapper) Activator.GetObject ( typeof (RemoteControlWrapper), ServiceUrl); return realRemote; } else { // If Tomboy is already running, register a // client IPC channel. IpcChannel = new IpcChannel (ClientName); ChannelServices.RegisterChannel (IpcChannel, false); return null; } #endif }
static void RegisterRemoteControl (NoteManager manager) { try { remote_control = RemoteControlProxy.Register (manager); if (remote_control != null) { Logger.Debug ("Tomboy remote control active."); } else { // If Tomboy is already running, open the search window // so the user gets some sort of feedback when they // attempt to run Tomboy again. IRemoteControl remote = null; try { remote = RemoteControlProxy.GetInstance (); remote.DisplaySearch (); } catch {} Logger.Error ("Tomboy is already running. Exiting..."); System.Environment.Exit (-1); } } catch (Exception e) { Logger.Warn ("Tomboy remote control disabled (DBus exception): {0}", e.Message); } }
public static void Initialize(RemoteControl remote) { RemoteControlWrapper.remote = remote; }
public static void Initialize (RemoteControl remote) { RemoteControlWrapper.remote = remote; }