/// <summary> /// Sets up the CloudConnector scan job. /// </summary> /// <param name="device">The device.</param> protected override void SetupJob(IDevice device) { if (device == null) { throw new ArgumentNullException("device"); } _cloudApp = new CloudConnectorApp(_data.CloudAppType, device); _cloudApp.WorkflowLogger = WorkflowLogger; _cloudApp.ActivityStatusChanged += LinkAppsActivityStatusChanged; ConnectorLog.PageCount = _data.PageCount; ConnectorLog.FilePrefix = FilePrefix.ToString(); ConnectorLog.FilePath = _data.FolderPath + "/" + FilePrefix + "." + EnumUtil.GetDescription((FileType)_data.CloudScanOptions.FileType).ToLowerInvariant(); ConnectorLog.LoginID = _data.ID; UpdateStatus($"Starting App Launch :: {_data.CloudAppType.GetDescription()}"); _cloudApp.Launch(_data.SIO); UpdateStatus($"Starting Log in :: {_data.CloudAppType.GetDescription()}"); if (!_data.SIO.Equals(SIOMethod.SIOWithoutIDPWD)) { _cloudApp.Login(_data.CloudAppType, _data.ID, _data.PWD); } else { UpdateStatus($"Skip Login"); } UpdateStatus($"Starting navigate to destination :: {_data.CloudAppType.GetDescription()}"); if (_data.CloudAppType.Equals(ConnectorName.SharePoint)) { _cloudApp.SelectSharePointSite(_data.SharePointSite); } if (!String.IsNullOrEmpty(_data.FolderPath)) { _cloudApp.NavigateToDestination(_data.FolderPath); } UpdateStatus($"Starting selection options :: {_data.CloudAppType.GetDescription()}"); _cloudApp.SelectJobForSetOptions(EnumUtil.GetByDescription <ConnectorJobType>(LinkJobType)); try { SetOptions(_cloudApp.ScanOptionManager, _data.CloudScanOptions); } catch (DeviceWorkflowException ex) { DeviceWorkflowException e = new DeviceWorkflowException($"Fail to set options: {ex.Message} :: {_data.CloudAppType.GetDescription()}", ex); e.Data.Add(_exceptionCategoryData, ConnectorExceptionCategory.SelectOptions.GetDescription()); throw e; } }
/// <summary> /// Sets up the cloud print job. /// </summary> /// <param name="device">The device.</param> protected override void SetupJob(IDevice device) { if (device == null) { throw new ArgumentNullException("device"); } _cloudApp = new CloudConnectorApp(_data.CloudAppType, device); _cloudApp.WorkflowLogger = WorkflowLogger; _cloudApp.ActivityStatusChanged += LinkAppsActivityStatusChanged; string[] filename = _data.FilePath.Split('/'); ConnectorLog.FilePrefix = filename[filename.Length - 1]; ConnectorLog.FilePath = _data.FilePath.ToLowerInvariant(); ConnectorLog.LoginID = _data.ID; UpdateStatus($"Starting App Launch :: {_data.CloudAppType.GetDescription()}"); _cloudApp.Launch(_data.SIO); UpdateStatus($"Starting Log in :: {_data.CloudAppType.GetDescription()}"); if (!_data.SIO.Equals(SIOMethod.SIOWithoutIDPWD)) { _cloudApp.Login(_data.CloudAppType, _data.ID, _data.PWD); } else { UpdateStatus($"Skip Login"); } UpdateStatus($"Starting navigate to destination :: {_data.CloudAppType.GetDescription()}"); if (_data.CloudAppType.Equals(ConnectorName.SharePoint)) { _cloudApp.SelectSharePointSite(_data.SharePointSite); _cloudApp.NavigateToDestination(_data.FilePath); UpdateStatus($"JobType is :: {_data.CloudJobType}"); if (_data.CloudJobType.Equals(ConnectorJobType.MultiplePrint.GetDescription())) { _cloudApp.MultiplefileSelectionForSharePoint(_data.FileList); } } else { _cloudApp.NavigateToDestination(_data.FilePath); UpdateStatus($"JobType is :: {_data.CloudJobType}"); if (_data.CloudJobType.Equals(ConnectorJobType.MultiplePrint.GetDescription())) { _cloudApp.MultiplefileSelection(_data.FileList); } } UpdateStatus($"Starting selection options :: {_data.CloudAppType.GetDescription()}"); _cloudApp.SelectJobForSetOptions(EnumUtil.GetByDescription <ConnectorJobType>(LinkJobType)); try { SetOptions(_cloudApp.PrintOptionManager, _data.CloudPrintOptions); } catch (DeviceWorkflowException ex) { DeviceWorkflowException e = new DeviceWorkflowException($"Fail to set options: {ex.Message} :: {_data.CloudAppType.GetDescription()}", ex); e.Data.Add(_exceptionCategoryData, ConnectorExceptionCategory.SelectOptions.GetDescription()); throw e; } }