/// <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);
 }
示例#2
0
        /// <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;
        }
 /// <summary>
 /// The scan completed.
 /// </summary>
 /// <param name="eventArgs">
 /// The event args.
 /// </param>
 public virtual void ScanCompletedCallback(ScanCompletedEventArgs eventArgs)
 {
 }
        /// <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);
        }
        /// <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.";
                        }
                    });
        }