Exemple #1
0
        private async void ScanCmd_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            BtnAnalyze.Focus(); // NEED TO FOCUS BECAUSE OF DATE PICKER
            if (_indicatorBind.ScanIndicator)
            {
                return;
            }
            MainSnackbar.IsActive        = false;
            _indicatorBind.ScanIndicator = true;
            _scanElapsed = 1;
            Stopwatch stopwatchScan = Stopwatch.StartNew();

            _dispatcherTimer.Start();
            bool          isSteam      = false;
            List <string> selectedDirs = new List <string>();

            foreach (CheckBoxModel item in _dirList)
            {
                if (!item.Checked)
                {
                    continue;
                }
                if (item.Path.Equals(SteamLibraryDir))
                {
                    isSteam = true;
                    continue;
                }

                if (Directory.Exists(item.Path))
                {
                    selectedDirs.Add(item.Path);
                }
            }

            float  maxSize  = 0;
            string multiExt = TBoxTypes.Text.Trim();
            int    depth    = Convert.ToInt32(CbBoxLevel.SelectionBoxItem);

            _date    = DateFilter.Text;
            _befDate = TglDate.IsChecked != null && (bool)!TglDate.IsChecked;
            ICollection <CleanModel> tList = new List <CleanModel>();
            await Task.Run(() =>
                           DirectorySearch(selectedDirs, multiExt, tList, depth, isSteam, ref maxSize));

            _dispatcherTimer.Stop();
            stopwatchScan.Stop();
            _cleanList            = new ObservableCollection <CleanModel>(tList);
            LvCleaner.ItemsSource = _cleanList;

            if (CheckBoxGroup.IsChecked != null && (bool)CheckBoxGroup.IsChecked)
            {
                CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(LvCleaner.ItemsSource);
                view.GroupDescriptions.Add(new PropertyGroupDescription("Group"));
            }

            _indicatorBind.ScanTime      = FormatScanTime(stopwatchScan.ElapsedMilliseconds);
            _indicatorBind.MaxSize       = Convert.ToInt32(maxSize);
            _indicatorBind.ScanIndicator = false;
        }
Exemple #2
0
        private async void ScanCmd_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            BtnAnalyze.Focus(); // NEED TO FOCUS BECAUSE OF DATE PICKER
            if (_operationBind.ScanIndicator)
            {
                return;
            }
            _operationBind.ScanIndicator = true;
            Stopwatch     sw           = Stopwatch.StartNew();
            bool          isSteam      = false;
            List <string> selectedDirs = new List <string>();

            foreach (CheckBoxModel item in _dirList)
            {
                if (!item.Checked)
                {
                    continue;
                }
                if (item.Path.Equals(SteamLibraryDir))
                {
                    isSteam = true;
                    continue;
                }

                if (Directory.Exists(item.Path))
                {
                    selectedDirs.Add(item.Path);
                }
            }

            float  maxSize  = 0;
            string multiExt = TBoxTypes.Text.Trim();
            int    depth    = Convert.ToInt32(CbBoxLevel.SelectionBoxItem);

            _date    = DateFilter.Text;
            _befDate = TglDate.IsChecked != null && (bool)!TglDate.IsChecked;
            List <CleanModel> tList = new List <CleanModel>();
            await Task.Factory.StartNew(() =>
                                        DirectorySearch(selectedDirs, multiExt, tList, depth, isSteam, ref maxSize));

            _cleanList            = new ObservableCollection <CleanModel>(tList);
            LvCleaner.ItemsSource = _cleanList;
            if (CheckBoxGroup.IsChecked != null && (bool)CheckBoxGroup.IsChecked)
            {
                CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(LvCleaner.ItemsSource);
                view.GroupDescriptions.Add(new PropertyGroupDescription("Group"));
            }

            sw.Stop();

            float mSec = sw.ElapsedMilliseconds;

            _operationBind.ScanTime = mSec < 1000
                ? mSec + " ms"
                : (mSec / 1000).ToString("0.00") + " sec";
            _operationBind.MaxSize = Convert.ToInt32(maxSize);

            if (!_tipShown)
            {
                Shared.SnackBarTip(MainSnackbar);
                _tipShown = true;
            }

            _operationBind.ScanIndicator = false;
        }
Exemple #3
0
 private void MnuAnalyze_Click(object sender, EventArgs e)
 {
     BtnAnalyze.PerformClick();
 }