Tasque.Backends.IceCore.IceBackend.Initialize C# (CSharp) Method

Initialize() public method

Initializes the backend
public Initialize ( ) : void
return void
        public void Initialize()
        {
            BusG.Init ();

            // Watch the session bus for when ICEcore Daemon comes or goes.
            // When it comes, attempt to connect to it.
            sessionBus =
                Bus.Session.GetObject<org.freedesktop.DBus.IBus> (
                    "org.freedesktop.DBus",
                    new ObjectPath ("/org/freedesktop/DBus"));
            sessionBus.NameOwnerChanged += OnDBusNameOwnerChanged;

            // Force the daemon to start up if it's not already running
            if (!Bus.Session.NameHasOwner (DaemonNamespace)) {
                Bus.Session.StartServiceByName (DaemonNamespace);
            }

            // Register for ICEcore Daemon's events
            ConnectToICEcoreDaemon ();

            //
            // Add in the AllCategory
            //
            AllCategory allCategory = new AllCategory ();
            Gtk.TreeIter iter = categories.Append ();
            categories.SetValue (iter, 0, allCategory);

            // Populate the models
            Refresh ();

            initialized = true;

            if (BackendInitialized != null) {
                try {
                    BackendInitialized ();
                } catch (Exception e) {
                    Logger.Debug ("Exception in IceBackend.BackendInitialized handler: {0}", e.Message);
                }
            }
        }