private void WorkerDoWork(object sender, DoWorkEventArgs e)
        {
            Logger.Debug("Backup: do work");

            var sync = new MemoDataFolderSync(null);

            if (_needDailyBackup)
            {
                _inDailyBackup   = true;
                _needDailyBackup = false;
                OnDailyBackupStarted();
                lock (MemopadConsts.DataLock) {
                    sync.SyncMemoDataFoldersTo(_dailyBackupPath);
                }
            }

            if (_needWeeklyBackup)
            {
                _inWeeklyBackup   = true;
                _needWeeklyBackup = false;
                OnWeeklyBackupStarted();
                lock (MemopadConsts.DataLock) {
                    sync.SyncMemoDataFoldersTo(_weeklyBackupPath);
                }
            }

            if (_needMonthlyBackup)
            {
                _inMonthlyBackup   = true;
                _needMonthlyBackup = false;
                OnMonthlyBackupStarted();
                lock (MemopadConsts.DataLock) {
                    sync.SyncMemoDataFoldersTo(_monthlyBackupPath);
                }
            }
        }
Exemple #2
0
        private void DoExportAsync(object sender, DoWorkEventArgs dwe)
        {
            lock (_app._Lock) {
                var worker = (BackgroundWorker)sender;

                try {
                    var dirPath = dwe.Argument as string;

                    var sync = new MemoDataFolderSync(
                        (progress) => {
                        worker.ReportProgress(progress);
                    }
                        );
                    sync.SyncMemoDataFoldersTo(dirPath);
                    MemoDataFolderSync.MakeMemoDataFolderIcon(dirPath);
                } catch (Exception e) {
                    Logger.Warn("Export failed", e);
                    throw;
                }
            }
        }