Exemple #1
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.ScanDrive(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;
            toolStripLabel2.Text        = string.Empty;
            toolStrip1.Enabled          = true;
        }