示例#1
0
        public AppDelegate()
        {
            var storage_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Library", "Application Support", "Tomboy");

            // TODO, set it in a generic way
            noteStorage = new DiskStorage(storage_path);
            noteStorage.SetBackupPath(backupPathUri);

            if (!Directory.Exists(backupPathUri))
            {
                noteStorage.Backup(); //FIXME: Need to better handle status messages.
            }
            Logger.Debug("Backup Path set to {0}", backupPathUri);

            NoteEngine = new Engine(noteStorage);

            // keep track of note for syncing
            // TODO move this into an Add-in one day
            var manifest_path = Path.Combine(storage_path, "manifest.xml");

            manifestTracker = new ManifestTracker(NoteEngine, manifest_path);

            // Create our cache directory
            if (!Directory.Exists(BaseUrlPath))
            {
                Directory.CreateDirectory(BaseUrlPath);
            }

            // Currently lazy load because otherwise the Dock Menu throws an error about there being no notes.
            if (Notes == null)
            {
                Notes = NoteEngine.GetNotes();
            }

            NoteEngine.NoteAdded   += HandleNoteAdded;
            NoteEngine.NoteRemoved += HandleNoteRemoved;
            NoteEngine.NoteUpdated += HandleNoteUpdated;

            settings = SettingsSync.Read();
        }