Ejemplo n.º 1
0
 /// <summary>
 /// Sets up the MyQ scan job.
 /// </summary>
 /// <param name="device">The device.</param>
 protected override void SetupJob(IDevice device)
 {
     if (device == null)
     {
         throw new ArgumentNullException(nameof(device));
     }
     _myQApp = MyQAppFactory.Create(device);
     _myQApp.WorkflowLogger = WorkflowLogger;
     InitializeAuthenticator(_activityData.AuthProvider, device, ExecutionData);
     Launch();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Launches the Pull print solution and pulls the desired number of documents.
        /// </summary>
        /// <returns></returns>
        protected override PluginExecutionResult LaunchAndPull()
        {
            OnDocumentProcessSelected(_activityData.DocumentProcessAction.GetDescription());
            PluginExecutionResult result = new PluginExecutionResult(PluginResult.Passed);

            OnStatusUpdate("Logging into device and launching pull print solution");

            try
            {
                _myQApp = MyQAppFactory.Create(Device);
                _myQApp.WorkflowLogger = WorkflowLogger;

                RecordEvent(DeviceWorkflowMarker.ActivityBegin);

                Launch();
                ExecutePullPrintAction();

                ExecutionServices.SystemTrace.LogDebug($"Available jobs (Initial)={InitialJobCount}");
                ExecutionServices.SystemTrace.LogDebug($"Available jobs (Final)={FinalJobCount}");
            }
            catch (DeviceCommunicationException ex)
            {
                result = new PluginExecutionResult(PluginResult.Failed, ex.Message, "Device communication error.");
                GatherTriageData(ex.ToString());
            }
            catch (DeviceInvalidOperationException ex)
            {
                result = new PluginExecutionResult(PluginResult.Failed, ex.Message, "Device automation error.");
                GatherTriageData(ex.ToString());
            }
            catch (DeviceWorkflowException ex)
            {
                result = new PluginExecutionResult(PluginResult.Failed, ex, "Device workflow error");
                GatherTriageData(ex.ToString());
            }
            catch (NoJobsFoundException ex)
            {
                result = new PluginExecutionResult(PluginResult.Skipped, ex.Message, "Pull print queue empty");
            }
            catch (Exception ex)
            {
                result = new PluginExecutionResult(PluginResult.Failed, ex, "Unknown Exception");
                GatherTriageData(ex.ToString());
            }
            finally
            {
                //Release any connections to the device.  This is critical for Omni operations.
                SubmitLog(result.Result.ToString());
                CollectMemoryData(_activityData.DeviceMemoryProfilerConfig, "MyQPullPrint");
                RecordEvent(DeviceWorkflowMarker.ActivityEnd);
            }
            return(result);
        }