Пример #1
0
        private async Task ScanProfilesSilentAsync(bool scanPredefined, bool showProfileDialog)
        {
            if (_skipScan)
            {
                if (scanPredefined && !_alreadyScannedForPredefinedSettings)
                {
                    _alreadyScannedForPredefinedSettings = true;
                    _meta.ResetMetaCache();
                    tsbModifiedProfiles.Enabled = true;
                    exportUserdefinedProfilesToolStripMenuItem.Enabled = false;
                    RefreshCurrentProfile();
                }

                return;
            }

            tsbModifiedProfiles.Enabled = false;
            tsbRefreshProfile.Enabled   = false;
            pbMain.Minimum = 0;
            pbMain.Maximum = 100;

            _scannerCancelationTokenSource = new CancellationTokenSource();

            var progressHandler = new Progress <int>(value =>
            {
                pbMain.Value = value;
                SetTaskbarProgress(value);
            });

            if (scanPredefined && !_alreadyScannedForPredefinedSettings)
            {
                _alreadyScannedForPredefinedSettings = true;
                await _scanner.ScanProfileSettingsAsync(false, progressHandler, _scannerCancelationTokenSource.Token);

                _meta.ResetMetaCache();
                tscbShowScannedUnknownSettings.Enabled = true;
            }
            else
            {
                await _scanner.ScanProfileSettingsAsync(true, progressHandler, _scannerCancelationTokenSource.Token);
            }

            RefreshModifiesProfilesDropDown();
            tsbModifiedProfiles.Enabled = true;

            pbMain.Value   = 0;
            pbMain.Enabled = false;
            SetTaskbarProgress(0);

            if (showProfileDialog)
            {
                ShowExportProfiles();
            }

            RefreshCurrentProfile();
            tsbRefreshProfile.Enabled = true;
        }
Пример #2
0
        private void frmDrvSettings_OnScanDoneDoNothing()
        {
            _meta.ResetMetaCache();

            InvokeUi(this, () =>
            {
                pbMain.Value   = 0;
                pbMain.Enabled = false;
                SetTaskbarProgress(0);
                RefreshCurrentProfile();
                RefreshModifiesProfilesDropDown();

                tsbRefreshProfile.Enabled = true;
            });
        }