/// <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);
 }
        /// <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);
            Execute.OnUIThread(() =>
                {
                    if (e.Successful)
                    {
                        this.NotifyOfPropertyChange(() => this.ScannedSource);
                        this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);
                        this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle)
                                             ?? this.ScannedSource.Titles.FirstOrDefault();
                    }

                    this.ShowStatusWindow = false;
                    if (e.Successful)
                    {
                        this.SourceLabel = this.SourceName;
                        this.StatusLabel = Resources.Main_ScanCompleted;
                    }
                    else if (e.Cancelled)
                    {
                        this.SourceLabel = Resources.Main_ScanCancelled;
                        this.StatusLabel = Resources.Main_ScanCancelled;
                    }
                    else if (e.Exception == null && e.ErrorInformation != null)
                    {
                        this.SourceLabel = Resources.Main_ScanFailed_NoReason + e.ErrorInformation;
                        this.StatusLabel = Resources.Main_ScanFailed_NoReason + e.ErrorInformation;
                    }
                    else
                    {
                        this.SourceLabel = Resources.Main_ScanFailled_CheckLog;
                        this.StatusLabel = Resources.Main_ScanFailled_CheckLog;
                    }
                });
        }
Ejemplo n.º 3
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)
        {
            if (e.ScannedSource != null)
            {
                e.ScannedSource.CopyTo(this.ScannedSource);
            }
            else
            {
                this.ScannedSource = null;
            }

            Execute.OnUIThread(() =>
                {
                    if (e.Successful)
                    {
                        this.NotifyOfPropertyChange(() => this.ScannedSource);
                        this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);
                        this.HasSource = true;
                        this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle) ?? this.ScannedSource.Titles.FirstOrDefault();
                    }
                    else
                    {
                        this.OpenAlertWindow(Resources.Main_ScanNoTitlesFound, Resources.Main_ScanNoTitlesFoundMessage);
                    }

                    this.ShowStatusWindow = false;
                    if (e.Successful)
                    {
                        this.SourceLabel = this.SourceName;
                        this.StatusLabel = Resources.Main_ScanCompleted;
                    }
                    else if (e.Cancelled)
                    {
                        this.SourceLabel = Resources.Main_ScanCancelled;
                        this.StatusLabel = Resources.Main_ScanCancelled;
                    }
                    else
                    {
                        this.SourceLabel = Resources.Main_ScanFailled_CheckLog;
                        this.StatusLabel = Resources.Main_ScanFailled_CheckLog;
                    }
                });
        }
 /// <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);
 }