/// <summary>Initializes a new instance of the <see cref="RoamOxpdPullPrintManager"/> class.</summary>
 /// <param name="pluginExecutionData">The plugin execution data.</param>
 /// <param name="activityData">The activity data.</param>
 public RoamOxpdPullPrintManager(PluginExecutionData pluginExecutionData, HpRoamActivityData activityData)
     : base(pluginExecutionData)
 {
     _activityData     = activityData;
     PullPrintSolution = "HP Roam Oxpd Pullprint Activity";
     this.LockTimeouts = _activityData.LockTimeouts;
     this.AuthProvider = _activityData.AuthProvider;
 }
        /// <summary>
        /// Executes this plugin's workflow using the specified <see cref="PluginExecutionData" />.
        /// </summary>
        /// <param name="executionData">The execution data.</param>
        /// <returns>A <see cref="PluginExecutionResult" /> indicating the outcome of the execution.</returns>
        public PluginExecutionResult Execute(PluginExecutionData executionData)
        {
            _activityData  = executionData.GetMetadata <HpRoamActivityData>();
            _executionData = executionData;

            PluginExecutionResult finalResult = null;

            if (_documentIterator == null)
            {
                CollectionSelectorMode mode = _activityData.ShuffleDocuments ? CollectionSelectorMode.ShuffledRoundRobin : CollectionSelectorMode.RoundRobin;
                _documentIterator = new DocumentCollectionIterator(mode);
            }

            try
            {
                activeSession_Label.InvokeIfRequired(n => n.Text = _executionData.SessionId);

                // Execute Print Operation (Push job to Roam)
                switch (_activityData.RoamDocumentSendAction)
                {
                case DocumentSendAction.Android:
                    PrintToRoamCloudViaPhone();
                    break;

                case DocumentSendAction.Windows:
                    if (executionData.PrintQueues.Any() && executionData.Documents.Any())
                    {
                        PrintToRoamCloudViaDriver(0);
                    }
                    break;

                default:     //DocumentSend.WebClient not implemented at this time
                    break;
                }

                // Execute Pull Print Operation (Pull job from Roam to device)
                if (_activityData.PhoneDocumentPush)
                {
                    finalResult = PrintFromRoamToDeviceViaPhone();
                }
                else
                {
                    finalResult = PrintFromRoamToDevice();
                }
            }
            catch (Exception ex)
            {
                //If there were errors during the printing operation, we could end up here.
                finalResult = new PluginExecutionResult(PluginResult.Error, ex);
            }

            return(finalResult);
        }
        /// <summary>
        /// Initializes this configuration control to default values.
        /// </summary>
        /// <param name="environment">Information about the plugin environment.</param>
        public void Initialize(PluginEnvironment environment)
        {
            _activityData = new HpRoamActivityData();
            _printQueues.Clear();
            assetSelectionControl.Initialize(AssetAttributes.None);
            var allExtensions = ConfigurationServices.DocumentLibrary.GetExtensions();
            var pdfs          = allExtensions.Where(n => n.FileType.Equals("pdf", StringComparison.OrdinalIgnoreCase));

            documentSelectionControl.Initialize(pdfs);
            lockTimeoutControl.Initialize(_activityData.LockTimeouts);

            SetPhoneUse();
            SetAuthenticationOptions();
        }
        /// <summary>
        /// Initializes this configuration control with the specified <see cref="PluginConfigurationData" />.
        /// </summary>
        /// <param name="configuration">The configuration data.</param>
        /// <param name="environment">Information about the plugin environment.</param>
        public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment)
        {
            _activityData            = configuration.GetMetadata <HpRoamActivityData>();
            _pluginConfigurationData = configuration;

            _mobileAsset = ConfigurationServices.AssetInventory.GetAssets(_pluginConfigurationData.Assets.SelectedAssets).FirstOrDefault(n => n.Attributes.HasFlag(AssetAttributes.Mobile)) as MobileDeviceInfo;

            if (_mobileAsset != null)
            {
                _pluginConfigurationData.Assets.SelectedAssets.Remove(_mobileAsset.AssetId);
            }

            assetSelectionControl.Initialize(_pluginConfigurationData.Assets, AssetAttributes.None);
            documentSelectionControl.Initialize(configuration.Documents);
            lockTimeoutControl.Initialize(_activityData.LockTimeouts);
            SetConfiguration();
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RoamAndroidAuthenticator"/> class.
        /// </summary>
        /// <param name="pluginExecutionData">The plugin execution data.</param>
        /// <param name="activityData">The plugin activity data.</param>
        /// <param name="controller">The SES controller.</param>
        /// <param name="androidHelper">The android helper.</param>
        public RoamAndroidAuthenticator(PluginExecutionData pluginExecutionData, HpRoamActivityData activityData, SESLib controller, AndroidHelper androidHelper)
        {
            Provider       = activityData.AuthProvider;
            _controller    = controller;
            _androidHelper = androidHelper;

            switch (activityData.AuthProvider)
            {
            case AuthenticationProvider.HpId:
                ExternalCredentialInfo externalCredential = pluginExecutionData.ExternalCredentials.Where(x => x.Provider == ExternalCredentialType.HpId).FirstOrDefault();
                Credential = new AuthenticationCredential(externalCredential.UserName, externalCredential.Password, pluginExecutionData.Credential.Domain);
                break;

            default:
                Credential = new AuthenticationCredential(pluginExecutionData.Credential);
                break;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AndroidAppManagerBase"/> class.
        /// </summary>
        /// <param name="pluginExecutionData"></param>
        /// <param name="activityData"></param>
        public AndroidAppManagerBase(PluginExecutionData pluginExecutionData, HpRoamActivityData activityData)
        {
            try
            {
                _executionData = pluginExecutionData;
                _activityData  = activityData;
                _controller    = SESLib.Create(_activityData.MobileEquipmentId);
                _controller.Connect(false, true);

                _androidHelper = new AndroidHelper(_controller);

                _controller.PressKey(KeyCode.KEYCODE_WAKEUP); //Power Button
                _controller.PressKey(KeyCode.KEYCODE_HOME);

                if (_androidHelper.ExistResourceId("com.android.systemui:id/keyguard_indication_area"))
                {
                    _controller.Swipe(SESLib.To.Up);
                }
            }
            catch (NullReferenceException ex)
            {
                throw new DeviceWorkflowException($"Unable to connect to the android phone using the connection ID {_activityData.MobileEquipmentId}.", ex);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RoamAndroidPrintManager"/> class.
 /// </summary>
 /// <param name="pluginExecutionData"></param>
 /// <param name="activityData"></param>
 public RoamAndroidPrintManager(PluginExecutionData pluginExecutionData, HpRoamActivityData activityData)
     : base(pluginExecutionData, activityData)
 {
 }
 /// <summary>Initializes a new instance of the <see cref="RoamAndroidAppManager"/> class.</summary>
 /// <param name="pluginExecutionData">The plugin execution data.</param>
 /// <param name="activityData">The activity data.</param>
 public RoamAndroidAppManager(PluginExecutionData pluginExecutionData, HpRoamActivityData activityData)
     : base(pluginExecutionData, activityData)
 {
     WorkflowLogger = new DeviceWorkflowLogger(pluginExecutionData);
 }