Exemple #1
0
        internal static void LaunchApp(IDevice device, string appName, IAuthenticator auth)
        {
            switch (appName)
            {
            case "E-mail":
                var app = EmailAppFactory.Create(device);
                app.Launch(auth, AuthenticationMode.Lazy);
                break;

            case "Fax":
                var appFax = FaxAppFactory.Create(device);
                appFax.Launch(auth, AuthenticationMode.Lazy);
                break;

            case "Workflow":
                var appWorkflow = DssWorkflowAppFactory.Create(device);
                appWorkflow.Launch(auth, AuthenticationMode.Lazy);
                break;

            case "Save to Network Folder":
                var appFolder = NetworkFolderAppFactory.Create(device);
                appFolder.Launch(auth, AuthenticationMode.Lazy);
                break;

            case "Copy":
                var app1 = CopyAppFactory.Create(device);
                app1.Launch(auth, AuthenticationMode.Lazy);
                break;

            default:
                throw new DeviceWorkflowException($"Unknown application: {appName}");
            }
        }
Exemple #2
0
        /// <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("device");
            }

            // Update the destination type
            ScanLog.ScanType = _data.DestinationType;
            ScanLog.Ocr      = _data.UseOcr;

            UpdateStatus(string.Format("Setting up device at address {0} for user {1}", device.Address, ExecutionData.Credential.UserName));

            InitializeAuthenticator(_data.AuthProvider, device, ExecutionData);
            // Load the workflow application
            _workflowApp = DssWorkflowAppFactory.Create(device);

            _workflowApp.WorkflowLogger = Authenticator.WorkflowLogger = WorkflowLogger;
            _workflowApp.Pacekeeper     = Authenticator.Pacekeeper = new Pacekeeper(_data.AutomationPause);

            _workflowApp.Launch(Authenticator, !_data.ApplicationAuthentication ? AuthenticationMode.Eager : AuthenticationMode.Lazy);

            // Select the workflow and enter the parameters
            _workflowApp.SelectWorkflow(_data.WorkflowName);
            foreach (WorkflowPromptValue item in _data.PromptValues)
            {
                EnterPromptValue(_workflowApp, item);
            }

            if (!_data.ExcludeFileNamePrompt)
            {
                // Set the file name (required for validation)
                WorkflowPromptValue fileNamePrompt = new WorkflowPromptValue(FileNamePrompt, FilePrefix.ToString().ToLowerInvariant());
                EnterPromptValue(_workflowApp, fileNamePrompt);
            }

            // Set job build
            _workflowApp.Options.SetJobBuildState(this.UseJobBuild);
        }
        /// <summary>
        /// DSSs the workflow lazy authentication.
        /// </summary>
        /// <param name="authenticator">The authenticator.</param>
        /// <param name="device">The device.</param>
        protected void DssWorkflowLazyAuth(IAuthenticator authenticator, IDevice device)
        {
            IDssWorkflowApp dssWorkflowApp = DssWorkflowAppFactory.Create(device);

            dssWorkflowApp.Launch(authenticator, AuthenticationMode.Lazy);
        }