Example #1
0
 public Application(INativeApplication nativeApp)
 {
     if (nativeApp == null)
     {
         throw new ArgumentNullException("nativeApp");
     }
     this.nativeApp = nativeApp;
     application    = this;
 }
Example #2
0
        public Application()
        {
            if (Interlocked.CompareExchange(ref _current, this, null) != null)
            {
                throw new InvalidOperationException("Application is already created.");
            }

            _nativeApp = Platform.CreateNativeApplication();
            _onUpdate  = OnUpdate;
            _nativeApp.SetUpdateCallback(_onUpdate);
        }
Example #3
0
        static Services()
        {
#if WIN32
            factory = new WindowsFactory();
#elif MAC
            factory = new MacFactory();
#else
            factory = new GnomeFactory();
#endif

            nativeApp = factory.CreateNativeApplication();
        }
Example #4
0
		static Services ()
		{
#if WIN32
			factory = new WindowsFactory ();
#elif MAC
			factory = new MacFactory ();
#else
			factory = new GnomeFactory ();
#endif
			
			nativeApp = factory.CreateNativeApplication ();
		}
Example #5
0
        public static void Initialize(string locale_dir,
                                      string display_name,
                                      string process_name,
                                      string [] args)
        {
            native_app = Services.NativeApplication;
            native_app.Initialize(locale_dir, display_name, process_name, args);

            action_manager = new ActionManager();
            action_manager.LoadInterface();

            native_app.RegisterSignalHandlers();
        }
Example #6
0
        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);
        }
Example #7
0
 private static extern void CreateNativeApplication([MarshalAs(UnmanagedType.Interface)] out INativeApplication obj);
Example #8
0
 public Application(INativeApplication nativeApp)
 {
     if (nativeApp == null)
         throw new ArgumentNullException ("nativeApp");
     this.nativeApp = nativeApp;
     application = this;
 }
Example #9
0
 public Application()
 {
     _nativeApp = Platform.CreateNativeApplication();
 }
Example #10
0
        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);
        }