Esempio n. 1
0
        public NoteRepository(string path, ISynchronizationFeedback fb, AppSettings cfg, RemoteStorageAccount acc, IAlephDispatcher disp)
        {
            _pathLocalBase   = path;
            _pathLocalFolder = Path.Combine(path, acc.ID.ToString("B"));
            _pathLocalData   = Path.Combine(path, acc.ID.ToString("B") + ".xml");
            _conn            = acc.Plugin.CreateRemoteStorageConnection(cfg.CreateProxy(), acc.Config, cfg.GetHierachicalConfig());
            _account         = acc;
            _appconfig       = cfg;
            _listener        = fb;
            _dispatcher      = disp;
            _thread          = new SynchronizationThread(this, new[] { this, fb }, cfg, _dispatcher);

            _invSaveNotesLocal     = DelayedCombiningInvoker.Create(() => _dispatcher.BeginInvoke(SaveAllDirtyNotes), 10 * 1000, 1 * 60 * 1000);
            _invSaveNotesRemote    = DelayedCombiningInvoker.Create(() => _dispatcher.BeginInvoke(SyncNow), 45 * 1000, 15 * 60 * 1000);
            _invSaveNotesGitBackup = DelayedCombiningInvoker.Create(() => _dispatcher.BeginInvoke(CommitToLocalGitBackup), 10 * 1000, 15 * 60 * 1000);

            _rawFilesystemRepo = new RawFolderRepository(this, disp, cfg);

            _notes.CollectionChanged += NoteCollectionChanged;
        }