Ejemplo n.º 1
0
        private void Scan_Click(object sender, RoutedEventArgs e)
        {
            var currentPaths = CompletePath.Select(_ => _.Path);
            var search       = new SearchOperation("C:\\", 4, new ScanningWindow());

            Task <IEnumerable <string> > .Factory.StartNew(search.Run).ContinueWith(task => {
                if (task.IsFaulted)
                {
                    return;                 // Too bad
                }
                var binDirectories = task.Result;

                binDirectories
                .Select(PathEntry.FromFilePath)
                .Where(path => !currentPaths.Contains(path))
                .Each(path => UserPath.Add(new AnnotatedPathEntry(path)));
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Ejemplo n.º 2
0
        private void Scan_Click(object sender, RoutedEventArgs e)
        {
            var currentPaths = CompletePath.Select(_ => _.Path);

            var window = new ScanningWindow();
            var search = new SearchOperation("C:\\", 4, window);

            Task <IEnumerable <string> > .Factory.StartNew(search.Run);

            if (window.ShowDialog() == true)
            {
                UserPath.SupressNotification = true;
                search.Result
                .Select(PathEntry.FromFilePath)
                .Where(path => !currentPaths.Contains(path))
                .Each(path => UserPath.Add(new AnnotatedPathEntry(path)));
                UserPath.SupressNotification = false;
            }
        }
Ejemplo n.º 3
0
        private void Scan_Click(object sender, RoutedEventArgs e)
        {
            var currentPaths = CompletePath.Select(_ => _.Path);

            var window = new ScanningWindow();
            var search = new SearchOperation("C:\\", 4, window);

            Task<IEnumerable<string>>.Factory.StartNew(search.Run);
            if (window.ShowDialog() == true)
            {
                UserPath.SupressNotification = true;
                search.Result
                    .Select(PathEntry.FromFilePath)
                    .Where(path => !currentPaths.Contains(path))
                    .Each(path => UserPath.Add(new AnnotatedPathEntry(path)));
                UserPath.SupressNotification = false;
            }
        }
        private void Scan_Click(object sender, RoutedEventArgs e)
        {
            var currentPaths = CompletePath.Select(_ => _.Path);
            var search = new SearchOperation("C:\\", 4, new ScanningWindow());

            Task<IEnumerable<string>>.Factory.StartNew(search.Run).ContinueWith(task => {
                if (task.IsFaulted) return; // Too bad

                var binDirectories = task.Result;
    
                binDirectories
                    .Select(PathEntry.FromFilePath)
                    .Where(path => !currentPaths.Contains(path))
                    .Each(path => UserPath.Add(new AnnotatedPathEntry(path)));
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }