protected override void Dispose(bool disposing) { if (disposing && remoteInstance != null) remoteInstance = null; base.Dispose (disposing); }
public static RemoteControl Register() { BusG.Init (); var remoteControl = new RemoteControl (); Bus.Session.Register (new ObjectPath (Path), remoteControl); if (Bus.Session.RequestName (Namespace) != RequestNameReply.PrimaryOwner) return null; return remoteControl; }
public static RemoteControl Register() { BusG.Init(); RemoteControl remote_control = new RemoteControl(); Bus.Session.Register(Namespace, new ObjectPath(Path), remote_control); if (Bus.Session.RequestName(Namespace) != RequestNameReply.PrimaryOwner) { return(null); } return(remote_control); }
protected override bool IsRemoteInstanceRunning() { // Register Tasque RemoteControl try { remoteInstance = RemoteControl.Register (); if (remoteInstance != null) { remoteInstance.RemoteInstanceKnocked = OnRemoteInstanceKnocked; Debug.WriteLine ("Tasque remote control created."); } else { RemoteControl remote = null; try { remote = RemoteControl.GetInstance (); remote.KnockKnock (); } catch {} return true; } } catch (Exception e) { Debug.WriteLine ("Tasque remote control disabled (DBus exception): {0}", e.Message); } return false; }
private void Init(string[] args) { #if OSX nativeApp = new OSXApplication (); #elif WIN32 nativeApp = new GtkApplication (); #else nativeApp = new GnomeApplication (); #endif nativeApp.Initialize ( Defines.LocaleDir, "Tasque", "Tasque", args); RegisterUIManager (); preferences = new Preferences (nativeApp.ConfDir); #if !WIN32 && !OSX // Register Tasque RemoteControl try { remoteControl = RemoteControlProxy.Register (); if (remoteControl != null) { Logger.Debug ("Tasque remote control active."); } else { // If Tasque is already running, open the tasks window // so the user gets some sort of feedback when they // attempt to run Tasque again. RemoteControl remote = null; try { remote = RemoteControlProxy.GetInstance (); remote.ShowTasks (); } catch {} Logger.Debug ("Tasque is already running. Exiting..."); System.Environment.Exit (0); } } catch (Exception e) { Logger.Debug ("Tasque remote control disabled (DBus exception): {0}", e.Message); } #endif string potentialBackendClassName = null; for (int i = 0; i < args.Length; i++) { switch (args [i]) { case "--quiet": quietStart = true; Logger.Debug ("Starting quietly"); break; case "--backend": if ( (i + 1 < args.Length) && !string.IsNullOrEmpty (args [i + 1]) && args [i + 1] [0] != '-') { potentialBackendClassName = args [++i]; } // TODO: Else, print usage break; default: // Support old argument behavior if (!string.IsNullOrEmpty (args [i])) potentialBackendClassName = args [i]; break; } } // See if a specific backend is specified if (potentialBackendClassName != null) { Logger.Debug ("Backend specified: " + potentialBackendClassName); customBackend = null; Assembly asm = Assembly.GetCallingAssembly (); try { customBackend = (IBackend) asm.CreateInstance (potentialBackendClassName); } catch (Exception e) { Logger.Warn ("Backend specified on args not found: {0}\n\t{1}", potentialBackendClassName, e.Message); } } // Discover all available backends LoadAvailableBackends (); GLib.Idle.Add(InitializeIdle); GLib.Timeout.Add (60000, CheckForDaySwitch); }
public void Init(string[] args) { lock (locker) { if (initialized) { return; } initialized = true; } nativeApp.Initialize( Defines.LocaleDir, "Tasque", "Tasque", args); preferences = new Preferences(nativeApp.ConfDir); #if !WIN && !OSX // Register Tasque RemoteControl try { remoteControl = RemoteControlProxy.Register(); if (remoteControl != null) { Logger.Debug("Tasque remote control active."); } else { // If Tasque is already running, open the tasks window // so the user gets some sort of feedback when they // attempt to run Tasque again. RemoteControl remote = null; try { remote = RemoteControlProxy.GetInstance(); remote.ShowTasks(); } catch {} Logger.Debug("Tasque is already running. Exiting..."); System.Environment.Exit(0); } } catch (Exception e) { Logger.Debug("Tasque remote control disabled (DBus exception): {0}", e.Message); } #endif string potentialBackendClassName = null; for (int i = 0; i < args.Length; i++) { switch (args [i]) { case "--quiet": quietStart = true; Logger.Debug("Starting quietly"); break; case "--backend": if ((i + 1 < args.Length) && !string.IsNullOrEmpty(args [i + 1]) && args [i + 1] [0] != '-') { potentialBackendClassName = args [++i]; } // TODO: Else, print usage break; default: // Support old argument behavior if (!string.IsNullOrEmpty(args [i])) { potentialBackendClassName = args [i]; } break; } } // See if a specific backend is specified if (potentialBackendClassName != null) { Logger.Debug("Backend specified: " + potentialBackendClassName); customBackend = null; Assembly asm = Assembly.GetCallingAssembly(); try { customBackend = (IBackend) asm.CreateInstance(potentialBackendClassName); } catch (Exception e) { Logger.Warn("Backend specified on args not found: {0}\n\t{1}", potentialBackendClassName, e.Message); } } // Discover all available backends LoadAvailableBackends(); GLib.Idle.Add(InitializeIdle); GLib.Timeout.Add(60000, CheckForDaySwitch); }