Esempio n. 1
0
 /// <summary>
 /// Scan Completed Event Handler.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void scanService_ScanCompleted(object sender, ScanCompletedEventArgs e)
 {
     if (this.SelectedMode == 1)
     {
         this.Log = this.scanService.ActivityLog;
     }
 }
Esempio n. 2
0
        void scan_ScanCompleted(object sender, ScanCompletedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                Completed completed = new Completed(scan_ScanCompleted);
                this.Invoke(completed, new object[] { sender, e });
            }
            else
            {
                if (!Canceled)
                {
                    ProgressBar.Value = 0;
                    int TotalFound = (int)(e.TotalFoundSize / (Int64)DataTypeSize.Int64);
                    if (TotalFound > 0)
                    {
                        CurrentScanAddresses   = MemoryMappedFile.CreateFromFile(@ExecutablePath + @"/Scan Data/CurrentScanAddresses", FileMode.Open, "CurrentScanAddresses", e.TotalFoundSize);
                        CurrentAddressAccessor = CurrentScanAddresses.CreateViewAccessor(0, e.TotalFoundSize);
                    }
                    ListView_Address.VirtualListSize = TotalFound;

                    Button_Scan_New.Enabled   = true;
                    Button_Scan_Abort.Enabled = false;
                    UpdateFoundTimer.Enabled  = true;
                    Button_Scan_Next.Enabled  = true;
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 ///     Called from a ScannerWrapper when a scan is completed (Called from a seperate thread!)
 /// </summary>
 /// <param name="args">
 ///     The <see cref="ScanCompletedEventArgs" /> that were generated
 /// </param>
 protected virtual void OnScanCompleted(ScanCompletedEventArgs args)
 {
     if (ScanCompleted != null)
     {
         ScanCompleted(this, args);
     }
 }
        void m_scanEngine_ScanCompleted(object sender, ScanCompletedEventArgs e)
        {
            string tFile        = null;
            string tempFileName = null;
            string tempPath     = null;

            using (MemoryStream inStream = new MemoryStream(e.Image))
            {
                tempFileName = Path.GetTempFileName();
                tempPath     = Path.GetTempPath();
                tFile        = Path.Combine(tempPath, tempFileName);
                Image.FromStream(inStream).Save(tFile);
            }

            Console.WriteLine("m_scanEngine_ScanCompleted =  " + tFile);

            lock (this.m_syncObject)
            {
                this.m_processQueue.Enqueue(tFile);
            }
            if (!this.bw.IsBusy)
            {
                this.bw.RunWorkerAsync();
            }
        }
Esempio n. 5
0
 private void HandleScanCompleted(object sender, ScanCompletedEventArgs args)
 {
     //if (!args.Auto || args.Cancelled || args.Error || !args.UpdateNeeded)
     //  return;
     //if (config.MonitorDrives && config.UpdateMode == UpdateMode.ScanAndUpdate)
     //  updateTimer.Start();
 }
Esempio n. 6
0
 /// <summary>
 /// Scan engine has completed
 /// </summary>
 void m_scanEngine_ScanCompleted(object sender, ScanCompletedEventArgs e)
 {
     // Enqueue the data
     this.m_threadPool.QueueUserWorkItem(ProcessImageWorker, e.Image);
     if (!this.bwUpdate.IsBusy)
     {
         this.bwUpdate.RunWorkerAsync();
     }
 }
Esempio n. 7
0
        private async void ScannerScanDone(AudioScan sender, ScanCompletedEventArgs e)
        {
            _lib = _scanner.MediaLibrary;
            await MediaRepository.Instance.Save(_lib);

            if (ScanCompleted != null)
            {
                ScanCompleted(e);
            }
        }
Esempio n. 8
0
        private void HandleScanCompleted(object sender, ScanCompletedEventArgs args)
        {
            ((DataDrive)sender).ScanCompleted -= HandleScanCompleted;
            foreach (DataDriveViewModel vm in viewModel.Drives)
            {
                if (vm.DataDrive == sender)
                {
                    vm.PropertyChanged -= HandleDataDrivePropertyChanged;
                }
            }

            if (args.UpdateNeeded)
            {
                anyDriveNeedsUpdate = true;
            }

            if (args.Error)
            {
                scanError = true;
            }

            Interlocked.Decrement(ref runningScans);
            if (runningScans > 0)
            {
                return;
            }

            scanning = false;
            viewModel.StopProgress();

            if (cancelled)
            {
                viewModel.Status = Name + " cancelled";
                End();
                return;
            }

            if (scanError && AbortIfScanErrors)
            {
                // FIXME: Need to report what the errors were!
                viewModel.Status = "Error(s) encountered during scan";
                End();
                return;
            }

            // I don't like calling Run() on the ScanCompleted callback from DataDrive's scan thread,
            // so run it on the main UI thread instead.
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                Run();
            }));
        }
Esempio n. 9
0
        /// <summary>
        /// The scan completed callback.
        /// </summary>
        /// <param name="eventArgs">
        /// The event args.
        /// </param>
        public override void ScanCompletedCallback(ScanCompletedEventArgs eventArgs)
        {
            if (this.postScanAction != null)
            {
                this.postScanAction(true);
            }

            if (this.ScanCompleted != null)
            {
                ThreadPool.QueueUserWorkItem(delegate { this.ScanCompleted(this, eventArgs); });
            }

            base.ScanCompletedCallback(eventArgs);
        }
Esempio n. 10
0
        void scan_ScanCompleted(object sender, ScanCompletedEventArgs e)
        {
            scanDialog.ScanButton.Enabled = true;

            if (e.MemoryAddresses == null || e.MemoryAddresses.Length == 0)
            {
                scanDialog.StatusLabel.Text = "Failed!";
                return;
            }

            memoryAddress = e.MemoryAddresses[0] - ((4 * 4 * 4) + 4); //offset backwards from found address to start of matrix
            scanDialog.StatusLabel.Text = "Success!";

            t = new Thread(Run);
            t.Start();
        }
Esempio n. 11
0
        void scan_ScanCompleted(object sender, ScanCompletedEventArgs e)
        {
            EnableButtonThreadSafe(initializeButton, true);

            if (e.MemoryAddresses == null || e.MemoryAddresses.Length == 0)
            {
                SetTextBoxThreadSafe(statusLabel, "Failed!");
                return;
            }

            memoryAddress = e.MemoryAddresses[0] + 541; //offset from found address to start of matrix

            SetTextBoxThreadSafe(statusLabel, "Success");

            t = new Thread(Run);
            t.Start();
        }
Esempio n. 12
0
        /// <summary>
        /// Scan is completed
        /// </summary>
        void m_scanEngine_ScanCompleted(object sender, ScanCompletedEventArgs e)
        {
            String tFile = null;

            using (var ms = new MemoryStream(e.Image))
            {
                tFile = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
                using (var fs = File.Create(tFile))
                    ms.WriteTo(fs);
            }
            lock (this.m_syncObject)
                this.m_processQueue.Enqueue(tFile);
            if (!this.bwImageProcess.IsBusy)
            {
                this.bwImageProcess.RunWorkerAsync();
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Handle the Scan Completed Event
        /// </summary>
        /// <param name="sender">
        /// The Sender
        /// </param>
        /// <param name="e">
        /// The EventArgs
        /// </param>
        private void ScanCompleted(object sender, ScanCompletedEventArgs e)
        {
            this.scanService.SouceData.CopyTo(this.ScannedSource);
            this.NotifyOfPropertyChange(() => this.ScannedSource);

            Execute.OnUIThread(
                () =>
            {
                if (this.scannedSource != null)
                {
                    this.Setup(this.scannedSource);
                }

                if (e.Successful)
                {
                    this.NotifyOfPropertyChange(() => this.ScannedSource);
                    this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);
                }

                this.ShowStatusWindow = false;
                if (e.Successful)
                {
                    this.SourceLabel = this.SourceName;
                    this.StatusLabel = "Scan Completed";
                }
                else if (e.Cancelled)
                {
                    this.SourceLabel = "Scan Cancelled.";
                    this.StatusLabel = "Scan Cancelled.";
                }
                else if (e.Exception == null && e.ErrorInformation != null)
                {
                    this.SourceLabel = "Scan failed: " + e.ErrorInformation;
                    this.StatusLabel = "Scan failed: " + e.ErrorInformation;
                }
                else
                {
                    this.SourceLabel = "Scan Failed... See Activity Log for details.";
                    this.StatusLabel = "Scan Failed... See Activity Log for details.";
                }
            });
        }
        /// <summary>
        /// The scan service scan completed event handler
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void ScanCompletedHandler(object sender, ScanCompletedEventArgs e)
        {
            Subscribers.ForEach(
                delegate(IHbServiceCallback callback)
            {
                if (((ICommunicationObject)callback).State == CommunicationState.Opened)
                {
                    Console.WriteLine("Scan Completed Callback");
                    callback.ScanCompletedCallback(e);
                }
                else
                {
                    Subscribers.Remove(callback);
                }
            });

            scanService.ScanStared        -= this.ScanStaredHandler;
            scanService.ScanStatusChanged -= this.ScanStatusChangedHandler;
            scanService.ScanCompleted     -= this.ScanCompletedHandler;
        }
Esempio n. 15
0
        } // CancelScan

        #region Worker events

        void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            timerEllapsed.Enabled = false;
            Worker.Dispose();
            Worker = null;
            buttonRequestCancel.Enabled = false;

            if (e.Cancelled)
            {
                labelCaption.Text = MulticastScanner.ScanningCancelled;
            }
            else if (e.Error == null)
            {
                labelCaption.Text = MulticastScanner.ScanningCompleted;
            }
            else if (e.Error != null)
            {
                labelCaption.Text = MulticastScanner.ScanningError;
                HandleException(new ExceptionEventData(e.Error));
            } // if-else

            AllowFormToClose = true;
            ScanInProgress   = false;

            // replace cancel button with close button
            buttonRequestCancel.Visible = false;
            buttonClose.Location        = buttonRequestCancel.Location;
            buttonClose.Size            = buttonRequestCancel.Size;
            buttonClose.Visible         = true;

            if (ScanCompleted != null)
            {
                var eventArgs = new ScanCompletedEventArgs()
                {
                    Cancelled           = e.Cancelled,
                    Error               = e.Error,
                    IsListRefreshNeeded = RefreshNeeded
                };
                ScanCompleted(this, eventArgs);
            } // if
        }     // Worker_RunWorkerCompleted
Esempio n. 16
0
        private void scanner_ScanCompleted(object sender, ScanCompletedEventArgs e)
        {
            Application.Invoke(delegate {
                if (e.Error != null)
                {
                    UpdateLog(LogIcon.Error, string.Format(S._("Scanning failed. Reason: an unhandled exception occured ({0})."), e.Error.Message));
                }
                else if (e.Cancelled)
                {
                    UpdateLog(LogIcon.Error, S._("Scanning aborted."));
                }
                else
                {
                    UpdateLog(LogIcon.Info, S._("Scanning completed successfully."));
                    newVolume = e.Volume;

                    // the volume editor may have been disabled in the ctor
                    // for some volume types (e.g. AudioCD volumes)
                    if (!volEditor.Sensitive)
                    {
                        volEditor.Load(newVolume);
                        volEditor.Sensitive = true;
                    }
                }

                if (!btnAbort.Sensitive)                 /* possibly disabled in AbortScan() */
                {
                    btnAbort.Sensitive = true;
                }

                btnAbort.Label = Stock.Close;
                scanCompleted  = true;
            });

            /* remove timeout handler (installed in ctor) */
            timer.Remove();
        }
Esempio n. 17
0
 /// <summary>
 /// The scan service Scan Completed Event Handler.
 /// Fires CanExecuteChanged
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The ScanCompletedEventArgs.
 /// </param>
 private void ScanServiceWrapperScanCompleted(object sender, ScanCompletedEventArgs e)
 {
     Caliburn.Micro.Execute.OnUIThread(this.OnCanExecuteChanged);
 }
Esempio n. 18
0
 /// <summary>
 /// Handles the _agent.VirusFound event to increment a counter.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _agent_VirusFound(object sender, ScanCompletedEventArgs e)
 {
     _vircount++;
 }
Esempio n. 19
0
 /// <summary>
 /// Scan Completed Event Handler.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void ScanServiceScanCompleted(object sender, ScanCompletedEventArgs e)
 {
     this.NotifyOfPropertyChange(() => this.ScanLog);
 }
Esempio n. 20
0
		/// <summary>
		/// Handles the _agent.VirusFound event to increment a counter.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void _agent_VirusFound(object sender, ScanCompletedEventArgs e)
		{
			_vircount++;
		}
Esempio n. 21
0
		/// <summary>
		/// Handles the _agent.ItemScanCompleted event to increment a counter.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void _agent_ItemScanCompleted(object sender, ScanCompletedEventArgs e)
		{
			_scancount++;
		}
Esempio n. 22
0
 public void Handle(ScanCompletedEventArgs message)
 {
     _current.Refresh();
 }
 /// <summary>
 /// The scan completed.
 /// </summary>
 /// <param name="eventArgs">
 /// The event args.
 /// </param>
 public virtual void ScanCompletedCallback(ScanCompletedEventArgs eventArgs)
 {
 }
Esempio n. 24
0
 /// <summary>
 /// Handles the _agent.ItemScanCompleted event to increment a counter.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _agent_ItemScanCompleted(object sender, ScanCompletedEventArgs e)
 {
     _scancount++;
 }