예제 #1
0
 void BackupFolders_ListChanged(object sender, ListChangedEventArgs e)
 {
     if (e.ListChangedType == ListChangedType.ItemAdded)
     {
         foreach (BackupFolder bc in _backupSettings.BackupFolders)
         {
             if (bc.RequireUpdate)
             {
                 DirectoryComputeService.Instance.ComputeBackupFolderData(bc);
             }
         }
     }
     if (e.ListChangedType == ListChangedType.ItemDeleted)
     {
         if (sender is SortableBindingList <BackupFolder> )
         {
             SortableBindingList <BackupFolder> backupFolderList = sender as SortableBindingList <BackupFolder>;
             foreach (BackupFolder bc in backupFolderList)
             {
                 bc.SetAsDeleted();
                 DirectoryComputeService.Instance.CancelWorkItem(bc);
             }
         }
         else
         {
             BackupFolder bc = sender as BackupFolder;
             bc.SetAsDeleted();
             DirectoryComputeService.Instance.CancelWorkItem(bc);
         }
     }
     if (e.ListChangedType == ListChangedType.ItemChanged)
     {
     }
 }
예제 #2
0
 internal void BackupFolderItemUpdated(BackupFolder backupFolder)
 {
     lock (threadLock)
     {
         backUpFolderUpdateQueue.Enqueue(backupFolder);
     }
     if (OnUpdateDataSourceAttribute != null)
     {
         OnUpdateDataSourceAttribute.Invoke(this, new EventArgs());
     }
 }
예제 #3
0
        internal bool TryAddBackupFolder(string path, int i)
        {
            if (!path.EndsWith("\\"))
            {
                path += "\\";
            }

            if (!BackupFolders.Any(b => path.Contains(b.Directory) || b.Directory.Contains(path)))
            {
                BackupFolders.Add(BackupFolder.Create(path));
                return(true);
            }
            return(false);
        }