private async void SetDrive(object sender, RoutedEventArgs e)
        {
            var info = (DriveInfo) ((Button) (sender)).DataContext;
            _scanner = new DriveScanner();

            Progress.Text = "0";

            Ready.Visibility = Visibility.Hidden;
            Processing.Visibility = Visibility.Visible;
            ItemsControl.IsEnabled = false;
           
            _refresher.Start();

            await Task.Run(() =>
            {
                App.Current.Context.StatisticsRoot = _scanner.Scan(info.Name.Substring(0, 2));
                App.Current.Context.Problematic.Clear();
                App.Current.Context.Problematic.AddRange(_scanner.Inaccessible);
            });

            _refresher.Stop();

            ItemsControl.IsEnabled = true;
            Processing.Visibility = Visibility.Hidden;
            Ready.Visibility = Visibility.Visible;
        }
Exemple #2
0
        static void Main()
        {
            var scanner = new DriveScanner();
            FsItem root;

            var worker = new Thread(() => root = scanner.Scan("C:"));
            worker.Start();

            while (worker.IsAlive)
            {
                Console.WriteLine("{0:F}% done", scanner.Progress);
                Thread.Sleep(100);
            }
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
Exemple #3
0
        private async void LoadDrive(ToolStripItem sender)
        {
            var target = sender.Text.Substring(0, 2);
            _scanner = new DriveScanner();

            toolStrip1.Enabled = false;
            timer1.Start();

            var root = await Task.Run(() => _scanner.Scan(target));

            listBox1.Items.Clear();
            listBox1.Items.AddRange(_scanner.Inaccessible.Cast<object>().ToArray());

            _totals.Clear();

            chart1.BeginInit();
            chart1.ChartAreas.Clear();
            chart1.Series.Clear();

            label2.Text = Humanize.Size(root.Items[1].Size);

            var percent = 0.0025f*toolStripComboBox2.SelectedIndex;
            if (toolStripComboBox1.SelectedIndex == 1)
            {
                root.Items.RemoveRange(0, 2);
                _filterThreshold = _scanner.GetDisplayThreshold(percent, false);
            }
            else
            {
                _filterThreshold = _scanner.GetDisplayThreshold(percent, true);
            }
            LoadChartDataCollection(0, root, 0);
            AlignDoughnuts();
            chart1.EndInit();

            timer1.Stop();
            toolStripProgressBar1.Value = 0;
            toolStrip1.Enabled = true;
        }