/// <summary>
        /// Gets the plugin application for the type of device being processed.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <returns></returns>
        private IHpcrApp GetApp(IDevice device)
        {
            // the session ID is used as part of the document name in order to track plug in metrics
            IHpcrApp result = HpcrAppFactory.Create(device, _activityData.HpcrScanButton, _activityData.ScanDestination, _activityData.ScanDistribution, _documentName, _activityData.ImagePreview);

            result.WorkflowLogger       = WorkflowLogger;
            result.StatusMessageUpdate += (s, e) => UpdateStatus(e.StatusMessage);

            return(result);
        }
        /// <summary>
        /// Sets up the scan job.
        /// </summary>
        /// <param name="device">The device.</param>
        protected override void SetupJob(IDevice device)
        {
            ScanLog.JobEndStatus = "Failed";
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }

            ScanLog.ScanType = _activityData.HpcrScanButton;

            UpdateStatus($"Setting up device at address {device.Address} for user {_pluginExecutionData.Credential.UserName}");

            InitializeAuthenticator(_activityData.AuthProvider, device, ExecutionData);

            _hpcrScanApplication = GetApp(device);
            AuthenticationMode am = (_activityData.ApplicationAuthentication == false) ? AuthenticationMode.Eager : AuthenticationMode.Lazy;

            _hpcrScanApplication.Launch(Authenticator, am);
        }