Ejemplo n.º 1
0
        public object Convert(object[] values, Type targetType,
                              object parameter, CultureInfo culture)
        {
            Visibility result = Visibility.Hidden;

            ScanStatus s1 = (ScanStatus)parameter;

            foreach (object val in values)
            {
                if (val != null && (ScanStatus)val == s1)
                {
                    result = Visibility.Visible;
                }
            }

            if (values != null && values[0] != null && values[1] != null)
            {
                ScanStatus s2 = (ScanStatus)values[0];
                ScanStatus s3 = (ScanStatus)values[1];

                if (s2 == s3)
                {
                    result = Visibility.Visible;
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public void StartCustomScan()
        {
            if (Status == ScanStatus.Idle)
            {
                using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())
                {
                    folderDialog.ShowNewFolderButton = false;
                    DialogResult dr = folderDialog.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        log.Info("Custom Scan: " + folderDialog.SelectedPath);
                        //MainForm.Instance.scanPanelControl.StartCustomScan(folderDialog.SelectedPath);

                        Status = ScanStatus.CustomScan;
                        SetTitle(Properties.Resources.ProductionName + "-自定义扫描");
                        InitForNewScan();
                        MainForm.Instance.mainPanelControl.EnterScanStatus("正在进行自定义扫描...");
                        MainForm.Instance.SlideWindow(this);
                        MainForm.Instance.mainPanelControl.Refresh();
                        _localScan.StartCustomScan(folderDialog.SelectedPath);
                    }
                }
            }
            else if (Status == ScanStatus.CustomScan)
            {
                MainForm.Instance.SlideWindow(this);
            }
            else
            {
                MessageBox.Show("有扫描任务正在进行,请等待扫描结束再启动新的扫描任务!");
            }
        }
Ejemplo n.º 3
0
        private void uiToolStrip_ProcessManager_cmbBoxActiveProcess_SelectedIndexChanged(Object sender, EventArgs e)
        {
            try {
                var comboBox = sender as ToolStripComboBox;
                if (comboBox.SelectedIndex < 1)
                {
                    comboBox.SelectedIndex = 1;
                    return;
                }
                String selectedProcessName = (String)uiToolStrip_ProcessManager_cmbBoxActiveProcess.SelectedItem;
                curScanStatus = ScanStatus.FirstScan;
                chkListViewSearchSections.Items.Clear();

                processInfo = Memory.getProcessInfoFromName(selectedProcessName);

                contextMenuChkListBox_btnSelectAll.Checked = false; listProcessMemorySections.Clear();
                foreach (var memorySection in Memory.Sections.getMemorySections(processInfo))
                {
                    listProcessMemorySections.Add(memorySection);

                    ListViewItem listViewItem = new ListViewItem();
                    listViewItem.Tag  = memorySection;
                    listViewItem.Text = memorySection.name;
                    listViewItem.SubItems.Add(memorySection.offset.ToString("X"));
                    listViewItem.SubItems.Add((memorySection.length / 1024).ToString() + "KB");
                    listViewItem.SubItems.Add(memorySection.protection.ToString());
                    chkListViewSearchSections.Items.Add(listViewItem);
                }
                uiToolStrip_lblActiveProcess.Text = String.Format("Process: {0}", selectedProcessName);
                //uiToolStrip_btnOpenPointerScanner.Enabled = true;
            } catch (Exception exception) {
                MessageBox.Show(exception.ToString());
            }
        }
Ejemplo n.º 4
0
 void _confirmBtnOnClick(object sender, EventArgs e)
 {
     Status = ScanStatus.Idle;
     MainForm.Instance.mainPanelControl.ExitScanStatus();
     MainForm.Instance.SlideWindow(this);
     MainForm.Instance.mainPanelControl.Refresh();
 }
Ejemplo n.º 5
0
 public void StartAllScan()
 {
     if (Status == ScanStatus.Idle)
     {
         bool ignore = false;
         if (Properties.Settings.Default.lastAllLocalScanDateTime != DateTime.MinValue)
         {
             DialogResult dr = MessageBox.Show(
                 "上一次成功全盘扫描时间: " + Properties.Settings.Default.lastAllLocalScanDateTime.ToString() + "\n已扫描过的文件本次是否忽略?",
                 "全盘扫描模式选择",
                 MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
             ignore = dr == DialogResult.Yes;
         }
         Status = ScanStatus.AllScan;
         SetTitle(Properties.Resources.ProductionName + "-全盘扫描");
         InitForNewScan();
         MainForm.Instance.mainPanelControl.EnterScanStatus("正在进行全盘扫描...");
         MainForm.Instance.SlideWindow(this);
         _localScan.StartAllScan(ignore);
     }
     else if (Status == ScanStatus.AllScan)
     {
         MainForm.Instance.SlideWindow(this);
     }
     else
     {
         MessageBox.Show("有扫描任务正在进行,请等待扫描结束再启动新的扫描任务!");
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Bu fonksiyon  tarama durumunu getirir.
        ///  This function gets the Scan Status
        /// </summary>
        /// <param name="manager">W3afManager Object</param>
        public static void GetScanStatus(W3afManager manager)
        {
            try
            {
                string     scanId     = GetScanID(manager);
                ScanStatus scanStatus = ScanController.GetScanStatus(manager, scanId);
                if (scanStatus != null && scanStatus.IsRunning.ToString().ToLower() == "true")
                {
                    Console.WriteLine("Tarama Devam Ediyor. \n"
                                      + scanStatus.IsRunning.ToString() + "\n" +
                                      "Status: " + scanStatus.Rpm.ToString() + "\n" +
                                      "Audit: " + scanStatus.CurrentRequest.Audit + "\n" +
                                      "Crawl: " + scanStatus.CurrentRequest.Crawl + "\n\n");
                }

                else if (scanStatus != null && scanStatus.IsRunning.ToString().ToLower() == "false")
                {
                    Console.WriteLine("Tarama Sona Erdi.");
                }
                else if (scanStatus == null)
                {
                    Console.WriteLine("***Gösterilecek Tarama Yok.***");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("\nScanView::GetScanStatus\n Exception: " + ex.Message);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Bu fonksiyon Taramayı durdurur.
        /// This function stops the Scan.
        /// </summary>
        /// <param name="manager">W3afManager Object</param>
        public static string StopScan(W3afManager manager)
        {
            try
            {
                string id = GetScanID(manager);
                if (id == null)
                {
                    return("Tarama Yok");
                }
                ScanStatus scanStatus = ScanController.GetScanStatus(manager, id);


                string jsonResponse = ScanController.StopScan(manager, GetScanID(manager));
                if (scanStatus.IsRunning == false || jsonResponse != null)
                {
                    return("Tarama Durduruldu");
                }

                return("Tarama Durdurulamadı");
            }
            catch (Exception ex)
            {
                Console.WriteLine("ScanView::StopScan Exception: " + ex.Message);
                return("Tarama Durdurulamadı");
            }
        }
Ejemplo n.º 8
0
        public void UpdateScan(Scan currentScan, ScanStatus status, int?NodeId, string processErrors)
        {
            currentScan.Status = status;
            switch (status)
            {
            case ScanStatus.Running:
                currentScan.InvokeDate     = DateTime.Now;
                currentScan.NodeInstanceId = NodeId;
                break;

            case ScanStatus.Error:
                currentScan.Error = processErrors;
                break;

            case ScanStatus.Complete:
                currentScan.EndDate = DateTime.Now;
                break;

            default:
                break;
            }

            using (var db = GetNSContext())
            {
                db.Entry(currentScan).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
Ejemplo n.º 9
0
        private void uiToolStrip_ProcessManager_cmbBoxActiveProcess_SelectedIndexChanged(Object sender, EventArgs e)
        {
            try {
                var comboBox = sender as ToolStripComboBox;
                if (comboBox.SelectedIndex < 1)
                {
                    comboBox.SelectedIndex = 1;
                    return;
                }
                String selectedProcessName = (String)uiToolStrip_ProcessManager_cmbBoxActiveProcess.SelectedItem;
                curScanStatus = ScanStatus.FirstScan;
                chkListViewSearchSections.Items.Clear();

                processInfo = ProcessManager.mInstance.GetProcessInfo(selectedProcessName);
                ProcessManager.mInstance.MappedSectionList.InitMemorySectionList(processInfo);

                for (int i = 0; i < ProcessManager.mInstance.MappedSectionList.Count; i++)
                {
                    chkListViewSearchSections.Items.Add(ProcessManager.mInstance.MappedSectionList.GetSectionName(i));
                }
                uiToolStrip_lblActiveProcess.Text = String.Format("Process: {0}", selectedProcessName);
                //uiToolStrip_btnOpenPointerScanner.Enabled = true;
            } catch (Exception exception) {
                MessageBox.Show(exception.ToString());
            }
        }
Ejemplo n.º 10
0
        private void btnScan_OnClick()
        {
            try {
                switch (curScanStatus)
                {
                case ScanStatus.FirstScan:
                    if (MessageBox.Show(String.Format("Search size: {0}KB. Continue?", ProcessManager.mInstance.MappedSectionList.TotalMemorySize / 1024), "Scan", MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return;
                    }

                    bgWorkerScanner.RunWorkerAsync(new Object[3] {
                        txtBoxScanValue.Text, txtBoxScanValueSecond.Text, chkBoxIsHexValue.Checked
                    });
                    break;

                case ScanStatus.DidScan:
                    listViewResults.Items.Clear();
                    ProcessManager.mInstance.MappedSectionList.ClearResultList();
                    curScanStatus = ScanStatus.FirstScan;
                    break;

                case ScanStatus.Scanning:
                    bgWorkerScanner.CancelAsync();
                    break;
                }
            } catch (Exception ex) {
                MessageBox.Show(ex.ToString(), "btnScan");
            }
        }
Ejemplo n.º 11
0
        public object Convert(object value, Type targetType,
                              object parameter, CultureInfo culture)
        {
            ScanStatus s1 = (ScanStatus)value;
            ScanStatus s2 = (ScanStatus)parameter;

            return(s1 == s2 ? "True" : "False");
        }
Ejemplo n.º 12
0
 public ScanTask(string name)
 {
     this.Name          = name;
     this.Creator       = Utils.GetCurrentUserName();
     this.CreationTime  = DateTime.Now;
     this.LastWriteTime = DateTime.Now;
     this.privateStatus = ScanStatus.UNINITIALZED;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Add Test status
 /// </summary>
 /// <param name="status"></param>
 /// <param name="message"></param>
 public void SetStatus(ScanStatus status, string message)
 {
     if (this.Status < status)
     {
         this.Status = status;
     }
     AddMessage(message);
 }
Ejemplo n.º 14
0
        public object Convert(object value, Type targetType,
                              object parameter, CultureInfo culture)
        {
            ScanStatus s1 = (ScanStatus)value;
            ScanStatus s2 = (ScanStatus)parameter;

            return(s1 == s2 ? Visibility.Visible : Visibility.Collapsed);
        }
Ejemplo n.º 15
0
        public string SetUnread(string id)
        {
            ScanStatus NewStatus = ScanStatus.Ended;

            _dbHelper.UpdateStudyScanStatus(id, NewStatus);

            return(_commonTool.GetJsonStringFromObject(true));
        }
 private static string GetHyperlinkTarget(ScanStatus status, RuleResult rr)
 {
     if (status != ScanStatus.Pass && rr.MetaInfo.PropertyId != 0 && StandardLinksHelper.GetDefaultInstance().HasStoredLink(rr.MetaInfo))
     {
         return(StandardLinksHelper.GetDefaultInstance().GetSnippetQueryUrl(rr.MetaInfo));
     }
     return(rr.FrameworkIssueLink);
 }
Ejemplo n.º 17
0
        private void btnScanNext_OnClick()
        {
            UInt64 address = UInt64.Parse(txtBoxScanAddress.Text, System.Globalization.NumberStyles.HexNumber);

            pointerList.Stop = false;
            curScanStatus    = ScanStatus.Scanning;
            next_pointer_finder_worker.RunWorkerAsync(new ScannerThreadArgs(address, null));
        }
Ejemplo n.º 18
0
 private void bgWorkerScanner_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e)
 {
     uiStatusStrip_lblStatus.Text = String.Format("{0} results", listViewResults.Items.Count);
     curScanStatus = ScanStatus.DidScan;
     if (e.Error != null)
     {
         uiStatusStrip_lblStatus.Text = e.Error.Message;
     }
 }
        /// <summary>
        ///  Maps ScanStatus (Axe.Windows) result levels to ResultLevel (Sarif) standard result levels in the string format. Throws an exception if a mapping does not exist.
        /// </summary>
        /// <param name="status"> Axe.Windows scan status </param>
        /// <returns> Returns corresponding ResultLevel </returns>
        public static string ToResultLevelString(this ScanStatus status)
        {
            if (!ScanStatusToResultLevelMappings.TryGetValue(status, out Tuple <ResultLevel, string> result))
            {
                throw new ArgumentException(Invariant($"The ScanStatus {status} does not have a corresponding mapping"), nameof(status));
            }

            return(result.Item2);
        }
Ejemplo n.º 20
0
 public List <UrlScan> GetAll(ScanStatus status)
 {
     lock (locker)
     {
         return(db
                .UrlScanEntities
                .Where(x => x.ScanStatus == status)
                .ToList());
     }
 }
Ejemplo n.º 21
0
        public async Task GetScanStatus()
        {
            var expected = new ScanStatus();
            var actual   = await NetverifyClient.GetScanStatusAsync(_scanReference);

            expected.Status        = ScanStatusStatus.DONE;
            expected.ScanReference = _scanReference;
            DeepAssert.Equal(expected, actual, "Timestamp"); // Сравни все поля кроме Timestamp
            Assert.IsType <ScanStatus>(actual);
        }
Ejemplo n.º 22
0
 void OnLocalizationScanStatusChanged(ScanStatus scanStatus)
 {
     if (scanStatus == ScanStatus.Scanning || scanStatus == ScanStatus.Loading)
     {
         MiniMap.GetComponent <MiniMap>().FullMapButton.interactable = false;
     }
     else if (scanStatus == ScanStatus.PreScan || scanStatus == ScanStatus.PostScan)
     {
         MiniMap.GetComponent <MiniMap>().FullMapButton.interactable = true;
     }
 }
Ejemplo n.º 23
0
 public ScanObject(IPAddress ip, string address, string hostname, string mac, string ping, PKScanObject ports, string online, ScanStatus status = ScanStatus.Unknown)
 {
     IP       = ip;
     Address  = address;
     Hostname = hostname;
     MAC      = mac;
     Ping     = ping;
     Ports    = ports;
     Online   = online;
     Status   = status;
 }
Ejemplo n.º 24
0
 private void OnLocalizationScanStatusChanged(ScanStatus scanStatus)
 {
     if (scanStatus == ScanStatus.Scanning || scanStatus == ScanStatus.Loading)
     {
         MapManager.Instance.MiniMapButton.interactable = false;
     }
     else if (scanStatus == ScanStatus.PreScan || scanStatus == ScanStatus.PostScan)
     {
         MapManager.Instance.MiniMapButton.interactable = true;
     }
 }
        private static void WechatyScanEventListener(string qrcode, ScanStatus status, string?data)
        {
            Console.WriteLine(qrcode);
            const string QrcodeServerUrl = "https://wechaty.github.io/qrcode/";

            if (status == ScanStatus.Waiting || status == ScanStatus.Timeout)
            {
                var qrcodeImageUrl = QrcodeServerUrl + qrcode;
                Console.WriteLine(qrcodeImageUrl);
            }
        }
Ejemplo n.º 26
0
        public object Convert(object value, Type targetType,
                              object parameter, CultureInfo culture)
        {
            string     result = "False";
            ScanStatus s1     = (ScanStatus)value;

            if (s1 != ScanStatus.ScanStarted && s1 != ScanStatus.UpdateStarted)
            {
                result = "True";
            }
            return(result);
        }
Ejemplo n.º 27
0
        public object Convert(object value, Type targetType,
                              object parameter, CultureInfo culture)
        {
            ScanStatus s1 = (ScanStatus)value;

            if (s1 != ScanStatus.ScanStarted && s1 != ScanStatus.UpdateStarted)
            {
                return(Visibility.Collapsed);
            }
            else
            {
                return(Visibility.Visible);
            }
        }
Ejemplo n.º 28
0
        public object Convert(object value, Type targetType,
                              object parameter, CultureInfo culture)
        {
            ScanStatus s1 = (ScanStatus)value;

            if (s1 != ScanStatus.PaymentNeeded && s1 != ScanStatus.LicenseKeyEnter)
            {
                return(Visibility.Collapsed);
            }
            else
            {
                return(Visibility.Visible);
            }
        }
Ejemplo n.º 29
0
        public static IEnumerable <Scan> GetScans(CxRestContext ctx, CancellationToken token,
                                                  ScanStatus specificStatus)
        {
            try
            {
                String url = null;

                if (specificStatus != ScanStatus.All)
                {
                    url = CxRestContext.MakeUrl(ctx.Url, URL_SUFFIX, new Dictionary <string, string>()
                    {
                        { "scanStatus", specificStatus.ToString() }
                    }
                                                );
                }
                else
                {
                    url = CxRestContext.MakeUrl(ctx.Url, URL_SUFFIX);
                }
                using (var client = ctx.Json.CreateSastClient())
                {
                    using (var scans = client.GetAsync(url, token).Result)
                    {
                        if (token.IsCancellationRequested)
                        {
                            return(null);
                        }

                        if (!scans.IsSuccessStatusCode)
                        {
                            throw new InvalidOperationException(scans.ReasonPhrase);
                        }

                        using (var sr = new StreamReader
                                            (scans.Content.ReadAsStreamAsync().Result))
                            using (var jtr = new JsonTextReader(sr))
                            {
                                JToken jt = JToken.Load(jtr);
                                return(new ScansReader(jt));
                            }
                    }
                }
            }
            catch (HttpRequestException hex)
            {
                _log.Error("Communication error.", hex);
                throw hex;
            }
        }
Ejemplo n.º 30
0
        private static void UpdateScanStatus(String folderPath, ScanStatus status)
        {
            String           filePath = Path.Combine(folderPath, Constants.ScanStatusFile);
            ScanStatusResult obj      = ReadScanStatusFile("", "", Constants.ScanStatusFile, folderPath);

            //Create new Scan Id if file is empty
            //else get existing scan Id
            if (obj == null || obj.Id == null)
            {
                obj    = new ScanStatusResult();
                obj.Id = DateTime.UtcNow.ToString(DATE_TIME_FORMAT);
            }

            //Update status of the scan
            obj.Status = status;
            File.WriteAllText(filePath, JsonConvert.SerializeObject(obj));
        }
        void RunCompose()
        {
            Progress = 0;
            ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("NowComposing");
            ScanStatusText = string.Empty;
            PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("ComposingDrivers");
            Status = ScanStatus.ComposeStarted;

            ComposingBackgroundWorker.RunWorkerAsync();
        }
        void Scan()
        {
            try
            {
                if (Status == ScanStatus.NotStarted)
                {
                    // Update device collections in the UI thread
                    if (CurrentDispatcher.Thread != null)
                    {
                        CurrentDispatcher.BeginInvoke((Action)(() =>
                        {
                            AllDevices = new ObservableCollection<MigrationDeviceInfo>();
                            PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("DriverScan");
                            ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("NowScanning");
                            Progress = 0;
                            Status = ScanStatus.ScanStarted;
                            ScanStatusText = string.Empty;
                        }));
                    }

                    bgScan = new BackgroundWorker();
                    bgScan.DoWork += StartScan;
                    bgScan.WorkerSupportsCancellation = true;
                    bgScan.RunWorkerCompleted += ScanCompleted;
                    bgScan.RunWorkerAsync();
                }
                else
                {
                    ABORT = true;
                    PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("ScanDrivers");
                    Status = ScanStatus.NotStarted;
                }
            }
            catch { }
        }
Ejemplo n.º 33
0
        private ScanStatus ScanRange(ITextPointer start, ITextPointer end, long timeLimit) 
        {
            ITextPointer contextStart;
            ITextPointer contextEnd;
            ITextPointer contentStart; 
            ITextPointer contentEnd;
            TextMap textMap; 
            ScanStatus status; 

            // 
            // IMPORTANT: the scan logic here (word break expansion, TextMap creation, etc.)
            // must match GetSuggestionForError exactly.  Keep the methods in [....]!
            //
 
            //
            // Expand the content to include whole words. 
            // Also get pointers to sufficient surrounding text to analyze 
            // multi-word errors correctly.
            // 

            status = new ScanStatus(timeLimit);

            XmlLanguage language; 
            CultureInfo culture = GetCurrentCultureAndLanguage(start, out language);
 
            if (culture == null) 
            {
                // Someone set a bogus language on the run -- ignore it. 
                _statusTable.MarkCleanRange(start, end);
            }
            else
            { 
                SetCulture(culture);
 
                ExpandToWordBreakAndContext(start, LogicalDirection.Backward, language, out contentStart, out contextStart); 
                ExpandToWordBreakAndContext(end, LogicalDirection.Forward, language, out contentEnd, out contextEnd);
 
                Invariant.Assert(contentStart.CompareTo(contentEnd) < 0);
                Invariant.Assert(contextStart.CompareTo(contextEnd) < 0);
                Invariant.Assert(contentStart.CompareTo(contextStart) >= 0);
                Invariant.Assert(contentEnd.CompareTo(contextEnd) <= 0); 

                // 
                // Mark the range clean, before we scan for errors. 
                //
                _statusTable.MarkCleanRange(contentStart, contentEnd); 

                //
                // Read the text.
                // 

                // Check for a compatible language. 
                if (CanSpellCheck(culture)) 
                {
                    _spellerInterop.SetContextOption("IsSpellChecking", true); 
                    _spellerInterop.SetContextOption("IsSpellVerifyOnly", true);

                    textMap = new TextMap(contextStart, contextEnd, contentStart, contentEnd);
 
                    //
                    // Iterate over sentences and segments. 
                    // 

                    _spellerInterop.EnumTextSegments(textMap.Text, textMap.TextLength, new SpellerInterop.EnumSentencesCallback(ScanRangeCheckTimeLimitCallback), 
                        new SpellerInterop.EnumTextSegmentsCallback(ScanTextSegment), new TextMapCallbackData(textMap, status));

                    if (status.TimeoutPosition != null)
                    { 
                        if (status.TimeoutPosition.CompareTo(end) < 0)
                        { 
                            // We ran out of time before analyzing the whole block. 
                            // Reset the dirty status of the remainder.
                            _statusTable.MarkDirtyRange(status.TimeoutPosition, end); 
                            // We should always make some forward progress, even just one word,
                            // otherwise we'll never finish checking the document.
                            if (status.TimeoutPosition.CompareTo(start) <= 0)
                            { 
                                // Diagnostic info for bug 1577085.
                                string debugMessage = "Speller is not advancing! \n" + 
                                                      "Culture = " + culture + "\n" + 
                                                      "Start offset = " + start.Offset + " parent = " + start.ParentType.Name + "\n" +
                                                      "ContextStart offset = " + contextStart.Offset + " parent = " + contextStart.ParentType.Name + "\n" + 
                                                      "ContentStart offset = " + contentStart.Offset + " parent = " + contentStart.ParentType.Name + "\n" +
                                                      "ContentEnd offset = " + contentEnd.Offset + " parent = " + contentEnd.ParentType.Name + "\n" +
                                                      "ContextEnd offset = " + contextEnd.Offset + " parent = " + contextEnd.ParentType.Name + "\n" +
                                                      "Timeout offset = " + status.TimeoutPosition.Offset + " parent = " + status.TimeoutPosition.ParentType.Name + "\n" + 
                                                      "textMap TextLength = " + textMap.TextLength + " text = " + new string(textMap.Text) + "\n" +
                                                      "Document = " + start.TextContainer.Parent.GetType().Name + "\n"; 
 
                                if (start is TextPointer)
                                { 
                                    debugMessage += "Xml = " + new TextRange((TextPointer)start.TextContainer.Start, (TextPointer)start.TextContainer.End).Xml;
                                }

                                Invariant.Assert(false, debugMessage); 
                            }
                        } 
                        else 
                        {
                            // We ran of time but finished the whole block. 
                            // TimeoutPosition should never be past contentEnd.
                            // It might be less than contentEnd if the dirty run ends
                            // with an element edge, in which case TimeoutPosition
                            // will preceed the final element edge(s). 
                            Invariant.Assert(status.TimeoutPosition.CompareTo(contentEnd) <= 0);
                        } 
                    } 
                }
            } 

            return status;
        }
        void Scan()
        {
            try
            {
                if (Status == ScanStatus.NotStarted)
                {
                    if (GetOsIdFromComboBox() == -1)
                    {
                        WPFMessageBox.Show(Application.Current.MainWindow, LocalizeDictionary.Instance.Culture, WPFLocalizeExtensionHelpers.GetUIString("SelectOSToScan"), WPFLocalizeExtensionHelpers.GetUIString("SelectOS"), WPFMessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                    // Update device collections in the UI thread
                    if (CurrentDispatcher.Thread != null)
                    {
                        CurrentDispatcher.BeginInvoke((Action)(() =>
                        {
                            AllDevices = new ObservableCollection<MigrationDeviceInfo>();
                            PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("DriverScan");
                            ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("NowScanning");
                            Progress = 0;
                            Status = ScanStatus.ScanStarted;
                            ScanStatusText = string.Empty;
                        }));
                    }

                    bgScan = new BackgroundWorker();
                    bgScan.DoWork += StartScan;
                    bgScan.WorkerSupportsCancellation = true;
                    bgScan.RunWorkerCompleted += ScanCompleted;
                    bgScan.RunWorkerAsync();
                }
                else
                {
                    ABORT = true;
                    PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("ScanDrivers");
                    Status = ScanStatus.NotStarted;
                }
            }
            catch { }
        }
Ejemplo n.º 35
0
 public Report(DateTime timeStamp, ScanStatus status, string name)
 {
     TimeStamp = timeStamp;
     Status = status;
     Name = name;
 }
        /// <summary>-
        /// receives the progress of driver scan
        /// </summary>
        /// <param name="progressType"></param>
        /// <param name="data"></param>
        /// <param name="currentItemPos"></param>
        /// <param name="nTotalDriversToScan"></param>
        /// <param name="progress"></param>
        /// <returns></returns>
        public bool progressCallback(DUSDKHandler.PROGRESS_TYPE progressType, IntPtr data, int currentItemPos, int nTotalDriversToScan, int progress)
        {
            // here we will get the progress of driver scan.
            DriverData? dd = null;
            string category = string.Empty;
            string VersionInstalled = string.Empty;
            string VersionUpdated = string.Empty;
            DateTime dtInstalled;

            if (data != IntPtr.Zero)
            {
                dd = (DriverData)Marshal.PtrToStructure(
                            (IntPtr)(data.ToInt64() + currentItemPos * Marshal.SizeOf(typeof(DriverData))),
                            typeof(DriverData)
                            );

            }

            switch (progressType)
            {
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_SIZE_SCAN_DATA:
                    nTotalDrivers = nTotalDriversToScan;
                    driverData = new DriverData[nTotalDriversToScan];
                    UserUpdates = new Dictionary<int, DriverData>();
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_SCANNING:
                    if (data != IntPtr.Zero && !bIsStopped)
                    {
                        driverData[currentItemPos] = (DriverData)dd;
                        string infName = string.Empty;
                        try
                        {
                            infName = new FileInfo(driverData[currentItemPos].location).Name;
                        }
                        catch
                        {
                        }
                        MigrationDeviceInfo item = new MigrationDeviceInfo(
                        null,
                        driverData[currentItemPos].category,
                        driverData[currentItemPos].driverName,
                        infName,
                        string.IsNullOrEmpty(driverData[currentItemPos].version) || driverData[currentItemPos].version == "null" ? string.Empty : driverData[currentItemPos].version,
                        currentItemPos.ToString(),
                        driverData[currentItemPos].hardwareId,
                        driverData[currentItemPos].CompatibleIdIndex.ToString()
                        );

                        dtInstalled = DateTime.FromFileTime(driverData[currentItemPos].ulDateTimeQuadPart);

                        string driverName = driverData[currentItemPos].driverName;
                        if (driverName.Length > 46)
                            driverName = driverName.Substring(0, 43) + "...";

                        if (CurrentDispatcher.Thread != null)
                        {
                            CurrentDispatcher.Invoke((MethodInvoker)delegate
                            {
                                ScanStatusText = driverName;
                                AllDevices.Add(item);
                            }
                            , null);
                        }
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_RETRIEVING_UPDATES_DATA:
                    if (CurrentDispatcher.Thread != null)
                    {
                        CurrentDispatcher.Invoke((MethodInvoker)delegate
                        {
                            ScanStatusText = string.Empty;
                            ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("ContactingServer");
                        }, null);
                    }
                    break;
                //case DUSDKHandler.PROGRESS_TYPE.PROGRESS_RETRIEVING_UPDATES_FAILED_INET:
                //    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_FILTERING_UPDATES:
                    if (data != IntPtr.Zero && !bIsStopped)
                    {
                        // get driver update information
                        DriverData DriverUpdate = (DriverData)Marshal.PtrToStructure(
                              (IntPtr)(data.ToInt64() + currentItemPos * Marshal.SizeOf(typeof(DriverData))),
                              typeof(DriverData)
                              );

                        if (CurrentDispatcher.Thread != null)
                        {
                            CurrentDispatcher.Invoke((MethodInvoker)delegate
                            {
                                MigrationDeviceInfo migrationDeviceInfo = AllDevices.Where(wh => wh.Id == currentItemPos.ToString()).FirstOrDefault();
                                if (migrationDeviceInfo != null)
                                {
                                    migrationDeviceInfo.IsDestOSDriverAvailable = true;
                                    migrationDeviceInfo.SelectedForDestOSDriverDownload = true;
                                    migrationDeviceInfo.DownloadLink = DriverUpdate.libURL;
                                }

                                UserUpdates.Add(currentItemPos, DriverUpdate);
                            }
                            , null);
                        }
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_SCANNED:
                    //if (CurrentDispatcher.Thread != null)
                    //{
                    //    CurrentDispatcher.BeginInvoke((Action)(() =>
                    //    {
                    //        ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("ScanCompleted");
                    //        ScanStatusText = "";
                    //    }));
                    //}
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_UPDATE_STARTED_FOR_SINGLE:
                    {
                        if (data != IntPtr.Zero && dd.HasValue)
                        {
                            if (CurrentDispatcher.Thread != null)
                            {
                                CurrentDispatcher.BeginInvoke((Action)(() =>
                                {
                                    // DownloadedDrivers.Add(new DownloadingDriverModel(WPFLocalizeExtensionHelpers.GetUIString("InstallingDriver"), devicesForUpdate[currentItemPos]));
                                    ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("InstallingDriver");
                                    // ScanStatusText = devicesForUpdate[currentItemPos].DeviceName;
                                }));
                            }
                        }
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_UPDATE_END_FOR_SINGLE:
                    {
                        if (data != IntPtr.Zero && dd.HasValue)
                        {
                            if (CurrentDispatcher.Thread != null)
                            {
                                CurrentDispatcher.BeginInvoke((Action)(() =>
                                {
                                    //ScanStatusTitle =
                                    ScanStatusText = WPFLocalizeExtensionHelpers.GetUIString("UpdateCompleted") + " " + ((DriverData)dd).driverName;
                                }));
                            }
                        }
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_UPDATE_SUCCESSFUL:
                    {
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_UPDATE_FAILED:
                    {
                        if (data != IntPtr.Zero && dd.HasValue)
                        {
                            string driverName = ((DriverData)dd).driverName;
                            if (driverName.Length > 37)
                                driverName = driverName.Substring(0, 34) + "...";
                            if (CurrentDispatcher.Thread != null)
                            {
                                CurrentDispatcher.BeginInvoke((Action)(() =>
                                {
                                    ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("UpdateFailed") + " " + driverName;
                                    ScanStatusText = string.Empty;
                                }));
                            }
                        }
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_UPDATE_END_FOR_ALL:
                    if (CurrentDispatcher.Thread != null)
                    {
                        CurrentDispatcher.BeginInvoke((Action)(() =>
                        {
                            CurrentDispatcher.BeginInvoke((Action)(() =>
                                {
                                    ScanFinishTitle = String.Format("{0} " + WPFLocalizeExtensionHelpers.GetUIString("DriversDownloaded"), DevicesForDestinationOS.Count());
                                    Status = ScanStatus.DownloadFinished;
                                    driverDownloading = false;
                                    ScanStatusTitle = ScanFinishTitle;
                                    ScanStatusText = string.Empty;
                                    driverIndex = 0;
                                    Progress = 0;
                                }));
                        }));
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_DOWNLOAD_STARTED_FOR_SINGLE:
                    {
                        if (data != IntPtr.Zero && dd.HasValue)
                        {
                            string driverName = ((DriverData)dd).driverName;
                            if (driverName.Length > 23)
                                driverName = driverName.Substring(0, 20) + "...";

                            if (CurrentDispatcher.Thread != null)
                            {
                                CurrentDispatcher.BeginInvoke((Action)(() =>
                                {
                                    ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("DownloadingDriver");
                                    //string driverDownloadingDirectory = "";
                                    //string clearedDeviceName = DevicesForDestinationOS[driverIndex].DeviceName.Replace(" ", "").Replace(@"/", "");

                                    //try
                                    //{
                                    //    driverDownloadingDirectory = String.Format(@"{0}\{1}", DownloadsDirectory, clearedDeviceName);
                                    //    Directory.CreateDirectory(driverDownloadingDirectory);
                                    //}
                                    //catch { }
                                    //DriverUtils.SaveDir = driverDownloadingDirectory;
                                }));
                            }
                        }
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_DOWNLOAD_END_FOR_SINGLE:
                    {
                        if (data != IntPtr.Zero && dd.HasValue)
                        {
                            if (CurrentDispatcher.Thread != null)
                            {
                                CurrentDispatcher.BeginInvoke((Action)(() =>
                                {
                                    ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("DownloadComplete") + " " + ((DriverData)dd).driverName;
                                    ScanStatusText = string.Empty;
                                    DestinationOSDevices.DownloadedDestinationOSDrivers.Add(
                                        new DestinationOSDeviceInfo(
                                            DevicesForDestinationOS[driverIndex].DeviceClass,
                                            DevicesForDestinationOS[driverIndex].DeviceClassName,
                                            DevicesForDestinationOS[driverIndex].DeviceName,
                                            DevicesForDestinationOS[driverIndex].InfName,
                                            DevicesForDestinationOS[driverIndex].Version,
                                            DevicesForDestinationOS[driverIndex].Id,
                                            DevicesForDestinationOS[driverIndex].HardwareID,
                                            DevicesForDestinationOS[driverIndex].CompatID
                                        )
                                    );
                                    driverIndex++;
                                }));
                            }
                        }
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_DOWNLOAD_END_FOR_SINGLE_UNREG:
                    {
                        // download failed as user is unregistered
                    }
                    break;
                case DUSDKHandler.PROGRESS_TYPE.PROGRESS_DOWNLOAD_END_FOR_SINGLE_INET_ERROR:
                    {
                        // download failed because of Internet Error
                    }
                    break;
                default:
                    break;
            }

            if (progress > 0)
            {
                if (CurrentDispatcher.Thread != null)
                {
                    CurrentDispatcher.BeginInvoke((Action)(() =>
                    {
                        Progress = progress;
                    }));
                }
            }

            return true;
        }
        void RunCancelScan()
        {
            bIsStopped = true;
            if (bgScan.IsBusy)
                bgScan.CancelAsync();

            cancelEvtArgs.Set();

            PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("ScanDrivers");
            Status = ScanStatus.NotStarted;
            ScanStatusTitle = string.Empty;
            ScanStatusText = string.Empty;
            Progress = 0;
        }
Ejemplo n.º 38
0
		/// <summary>
		/// Collects the data about devices at the machine.
		/// </summary>
		void CollectInfo()
		{
			try
			{
				if (status == ScanStatus.NotStarted)
				{
					progress = 0;
					status = ScanStatus.ScanStarted;

					var devices = driverUtils.ScanDevices();
					int allDevicesProcessed = 1;

					foreach (ManagementObject device in devices)
					{
						progress = Convert.ToInt32((decimal)allDevicesProcessed++ / devices.Count * 100);
						worker.ReportProgress(progress);

						var flag = false;
						if (device.GetPropertyValue("DeviceClass") == null)
							continue;
						var deviceClass = device.GetPropertyValue("DeviceClass").ToString();
						foreach (var restricted in DriverUtils.RestrictedClasses)
						{
							if (restricted != deviceClass) continue;
							flag = true;
							break;
						}

						if (flag)
						{
							continue;
						}

						//Uses device friendly name instead of device name when it's possible
						string deviceName;
						if (device.GetPropertyValue("FriendlyName") != null)
						{
							deviceName = (string)device.GetPropertyValue("FriendlyName");
						}
						else
						{
							deviceName = (string)(device.GetPropertyValue("DeviceName"));
						}

						//Use device friendly name instead of class name when it's possible
						string deviceClassName = string.Empty;

						if (device.GetPropertyValue("ClassGuid") != null)
						{
							var openSubKey = deviceClasses.OpenSubKey((string)device.GetPropertyValue("ClassGuid"));
							if (openSubKey != null)
							{
								object classGuid = openSubKey.GetValue("Class");
								if (classGuid != null)
								{
									deviceClassName = classGuid.ToString();
								}
							}
						}
						else
						{
							deviceClassName = (string)(device.GetPropertyValue("DeviceClass"));
						}

						string date = null;
						var installedDriverDateStr = (string)(device.GetPropertyValue("DriverDate"));
						if (!string.IsNullOrEmpty(installedDriverDateStr))
						{
							int year = int.Parse(installedDriverDateStr.Substring(0, 4));
							int month = int.Parse(installedDriverDateStr.Substring(4, 2));
							int day = int.Parse(installedDriverDateStr.Substring(6, 2));
							DateTime installedDriverDate = new DateTime(year, month, day);
							date = installedDriverDate.ToShortDateString();
						}

						allDevices.Add(
							new DeviceInfo(
								(string)(device.GetPropertyValue("DeviceClass")),
								deviceClassName,
								deviceName,
								(string)(device.GetPropertyValue("InfName")),
								(string)(device.GetPropertyValue("DriverVersion")),
								(string)(device.GetPropertyValue("DeviceId")),
								(string)(device.GetPropertyValue("HardwareID")),
								(string)(device.GetPropertyValue("CompatID")),
								date
							)
						);

						SaveAllDevicesToXML();
					}
				}
			}
			catch { }
		}
        void RunCancelCompose()
        {
            if (ComposingBackgroundWorker.IsBusy)
                ComposingBackgroundWorker.CancelAsync();

            CancelOperation();

            ScanFinishTitle = String.Format("{0} " + WPFLocalizeExtensionHelpers.GetUIString("DriversDownloaded"), DevicesForDestinationOS.Count());
            Status = ScanStatus.DownloadFinished;
            ScanStatusTitle = ScanFinishTitle;
            ScanStatusText = string.Empty;
            Progress = 0;
        }
Ejemplo n.º 40
0
        private void btnCancelToMain_Click(object sender, EventArgs e)
        {
            if (breakoutPin == txtCancelScanPin.Text)
            {

                pnlConfirmCancel.Visible = false;

                cancelMatchScan = true;
                bckScanFinger.CancelAsync();
                Application.DoEvents();
                const string Components = "Biometrics.FingerExtraction,Devices.FingerScanners";
                NLicense.ReleaseComponents(Components);
                pnlIdentifyAction.Visible = false;
                LoadPanelMain();
            }
            else
            {
                pnlConfirmCancel.Visible = false;

                cancelMatchScan = true;
                bckScanFinger.CancelAsync();
                Application.DoEvents();
                const string Components = "Biometrics.FingerExtraction,Devices.FingerScanners";
                NLicense.ReleaseComponents(Components);

                nfView1.Template = null;
                nfView1.Image = null;
                nfView1.ResultImage = null;
                txtMatchStudentNumber.Text = "";

                IdentifyActionScreen();
                pnlIdentifyAction.Refresh();
                ScannedTemplated = false;

                //See if a license can be obtained

                if (!NLicense.ObtainComponents(licServer, 5000, Components))
                {
                    //Set the scanstatus to cancelled
                    GlobalScanStatus = ScanStatus.NoLicenseObtained;
                }

                if (!bckScanFinger.IsBusy)
                {
                    bckScanFinger.RunWorkerAsync();
                }
            }
        }
Ejemplo n.º 41
0
        private void bckScanFinger_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker bck = (BackgroundWorker)sender;
            try
            {
                int i;
                NDeviceManager devMan = new NDeviceManager(NDeviceType.FingerScanner, true, false);
                int count = devMan.Devices.Count;

                //See if a fingerprint scanner is connected
                if (count > 0)
                {
                    //What if there is more than one scanner
                }
                else
                {
                    GlobalScanStatus = ScanStatus.NoScanner;
                }

                if (count > 1)
                    //What if there is more than one scanner.  We will use the first detected scanner.
                    for (i = 0; i < count; i++)
                    {
                        NDevice device = devMan.Devices[i];
                    }
                i = 0;
                NFScanner fingerScanner = (NFScanner)devMan.Devices[i];
                NFExtractor extractor = new NFExtractor();
                NFRecord record;
                extractor.ReturnedImage = NfeReturnedImage.Binarized;

                NImage image = null;
                while (image == null && !bckScanFinger.CancellationPending)
                {
                    if (bck.CancellationPending)
                    {
                        e.Cancel = true;
                    }
                    else
                    {
                        using ( image = fingerScanner.Capture(5000))
                        {
                            if (image == null)
                            {
                                GlobalScanStatus = ScanStatus.NoTemplateCreated;
                            }
                            else
                            {
                                NfeExtractionStatus extractionStatus;
                                using (NGrayscaleImage grayscaleImage = image.ToGrayscale())
                                {
                                    if (grayscaleImage.ResolutionIsAspectRatio
                                        || grayscaleImage.HorzResolution < 250
                                        || grayscaleImage.VertResolution < 250)
                                    {
                                        grayscaleImage.HorzResolution = 500;
                                        grayscaleImage.VertResolution = 500;
                                        grayscaleImage.ResolutionIsAspectRatio = false;
                                    }

                                    record = extractor.Extract(grayscaleImage, NFPosition.Unknown, NFImpressionType.LiveScanPlain, out extractionStatus);
                                    fingerprintImage = (NImage)image.Clone();
                                    fingerprintImage = NImages.GetGrayscaleColorWrapper(fingerprintImage, resultImageMinColor, resultImageMaxColor);

                                }

                                if (extractionStatus == NfeExtractionStatus.TemplateCreated)
                                {
                                    GlobalScanStatus = ScanStatus.TemplateCreated;
                                    fingerprintTemplate = record;
                                    ScannedTemplated = true;
                                    bck.ReportProgress(1);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScanError = ex.Message;
            }

            GlobalScanStatus = ScanStatus.Cancelled;
        }
Ejemplo n.º 42
0
        private void LoadIdentificationAction()
        {
            pnlMain.Visible = false;
            pnlIdentification.Visible = false;

            btnMatchConfirm.Visible = false;
            btnMatchRetry.Visible = false;
            txtMatchStudentNumber.Visible = false;

            lblMatchResult.Visible = false;

            pnlIdentifyAction.Dock = DockStyle.Fill;
            pnlIdentifyAction.Visible = true;

            lblStatus.Location = new Point(0, 0);
            lblStatus.Text = "Before getting students for courses";

            txtMatchStudentNumber.Text = "";
            nfView1.Image = null;
            nfView1.ResultImage = null;
            nfView1.Template = null;

            int Width;
            lblIdentifyActionMessage.Font = new Font("Arial", 25);
            Width = lblIdentifyActionMessage.Width;
            lblIdentifyActionMessage.Width = Width;
            lblIdentifyActionMessage.Height = 75;
            lblIdentifyActionMessage.Location = new Point((pnlIdentifyAction.Width - Width) / 2, 0);
            lblIdentifyActionMessage.Text = "Loading fingerprint templates";
            Application.DoEvents();

            bckLoadTemplates.WorkerReportsProgress = true;
            bckLoadTemplates.WorkerSupportsCancellation = true;

            bckScanFinger.WorkerReportsProgress = true;
            bckScanFinger.WorkerSupportsCancellation = true;

            pgbLoadTemplates.Visible = true;
            pgbLoadTemplates.Width = (pnlIdentifyAction.Width / 2) / 5 * 4;
            pgbLoadTemplates.Height = 75;
            pgbLoadTemplates.Location = new Point(pnlIdentifyAction.Width / 10 * 3, 100);
            pgbLoadTemplates.Maximum = 100;
            pgbLoadTemplates.Visible = true;
            pnlIdentifyAction.Refresh();
            Application.DoEvents();

            //_selectedCourse = (course)cmbCourseList.SelectedItem;
            //_selectedCourse = lstCoursesList.Find(c => c.CourseCode == cmbCourseList.Text);

            bckLoadTemplates.RunWorkerAsync();
            while (bckLoadTemplates.IsBusy)
            {
                Application.DoEvents();
            }

            pgbLoadTemplates.Visible = false;
            Application.DoEvents();
            IdentifyActionScreen();
            pnlIdentifyAction.Refresh();
            ScannedTemplated = false;

            //See if a license can be obtained
            const string Components = "Biometrics.FingerExtraction,Devices.FingerScanners";
            if (!NLicense.ObtainComponents(licServer, 5000, Components))
            {
                //Set the scanstatus to cancelled
                GlobalScanStatus = ScanStatus.NoLicenseObtained;
            }

            if (!bckScanFinger.IsBusy)
            {
                bckScanFinger.RunWorkerAsync();
            }
        }
        void RunCancelDownloadDrivers()
        {
            bIsStopped = true;
            if (DownloadingBackgroundWorker.IsBusy)
                DownloadingBackgroundWorker.CancelAsync();
            CancelOperation();

            PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("ChooseDriversToDownload");
            Status = ScanStatus.ScanFinishedDriversFound;
            ScanFinishTitle = String.Format("{0} " + WPFLocalizeExtensionHelpers.GetUIString("DriversReadyToDownload"), AllDevices.Where(d => d.IsDestOSDriverAvailable).Count());
            ScanStatusTitle = ScanFinishTitle;
            ScanStatusText = string.Empty;
            driverDownloading = false;
            driverIndex = 0;
            Progress = 0;
        }
        void RunDownloadDrivers()
        {
            DevicesForDestinationOS = AllDevices.Where(d => d.SelectedForDestOSDriverDownload).ToList();
            if (DevicesForDestinationOS.Count == 0)
            {
                WPFMessageBox.Show(WPFLocalizeExtensionHelpers.GetUIString("SelectAtLeastOneDriver"), WPFLocalizeExtensionHelpers.GetUIString("CheckPreferences"), WPFMessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            if (DownloadingBackgroundWorker.IsBusy != true)
            {
                if (!String.IsNullOrEmpty(DownloadsDirectory) && Directory.Exists(DownloadsDirectory))
                {
                    Progress = 0;
                    ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("StartingDriversDownload");
                    ScanStatusText = string.Empty;
                    PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("DownloadingDrivers");
                    Status = ScanStatus.DownloadStarted;

                    // Start the asynchronous operation.
                    DownloadingBackgroundWorker.RunWorkerAsync();
                }
                else
                {
                    WPFMessageBox.Show(WPFLocalizeExtensionHelpers.GetUIString("CheckDownloadFolder"), WPFLocalizeExtensionHelpers.GetUIString("CheckPreferences"), WPFMessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
        void ComposingBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (CurrentDispatcher.Thread != null)
            {
                CurrentDispatcher.BeginInvoke((Action)(() =>
                {
                    Progress = 100;

                    PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("AllDriversComposed");
                    ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("AllDriversComposed");
                    ScanStatusText = string.Empty;
                    ScanFinishTitle = WPFLocalizeExtensionHelpers.GetUIString("AllDriversComposed");
                    Status = ScanStatus.ComposeFinished;
                    Progress = 0;
                }));
            }
        }
        void ScanCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            bool isCancelled = bIsStopped;

            bScanningIsGoingOn = false;
            bIsStopped = false;

            if (CurrentDispatcher.Thread != null)
            {
                CurrentDispatcher.Invoke((MethodInvoker)delegate
                {
                    if (isCancelled || scanCancelled)
                    {
                        scanCancelled = false;

                        return;
                    }
                    scanCancelled = false;

                    PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("ScanDrivers");
                    Status = ScanStatus.NotStarted;
                    ScanStatusTitle = string.Empty;
                    ScanStatusText = string.Empty;
                    Progress = 0;

                    UpdateGroupedDevices();
                    int devicesForUpdate = AllDevices.Where(wh => wh.SelectedForDestOSDriverDownload == true).Count();
                    if (devicesForUpdate == 0)
                    {
                        PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("NoDriversToDownload");
                        ScanStatusTitle = WPFLocalizeExtensionHelpers.GetUIString("NoDriversToDownload");
                        ScanStatusText = string.Empty;
                        ScanFinishTitle = WPFLocalizeExtensionHelpers.GetUIString("NoDriversToDownload");
                        Status = ScanStatus.ScanFinishedNoDrivers;
                    }
                    else
                    {
                        PanelScanHeader = WPFLocalizeExtensionHelpers.GetUIString("ChooseDriversToDownload");
                        Status = ScanStatus.ScanFinishedDriversFound;
                        ScanFinishTitle = String.Format("{0} " + WPFLocalizeExtensionHelpers.GetUIString("DriversReadyToDownload"), AllDevices.Where(d => d.IsDestOSDriverAvailable).Count());
                    }
                }
                , null);
            }
        }