/// <summary>
        /// Executes this plugin's workflow using the specified <see cref="T:HP.ScalableTest.Framework.Plugin.PluginExecutionData" />.
        /// </summary>
        /// <param name="executionData">The <see cref="T:HP.ScalableTest.Framework.Plugin.PluginExecutionData" /> to use for execution.</param>
        /// <returns>
        /// A <see cref="T:HP.ScalableTest.Framework.Plugin.PluginExecutionResult" /> indicating the outcome of the execution.
        /// </returns>
        public PluginExecutionResult Execute(PluginExecutionData executionData)
        {
            PaperCutActivityData data = executionData.GetMetadata <PaperCutActivityData>();

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

            PaperCutPullPrintManager manager = new PaperCutPullPrintManager(executionData, data);

            manager.StatusUpdate           += UpdateStatus;
            manager.DeviceSelected         += UpdateDevice;
            manager.DocumentActionSelected += UpdateDocumentAction;
            manager.TimeStatusUpdate       += PullPrintManager_TimeStatusUpdate;
            manager.SessionIdUpdate        += UpdateSessionId;

            if (executionData.PrintQueues.Any() && executionData.Documents.Any())
            {
                try
                {
                    manager.ExecutePrintJob(_documentCollectionIterator, data.UsePrintServerNotification, data.DelayAfterPrint);
                }
                catch (PrintQueueNotAvailableException ex)
                {
                    //This exception has already been logged in the call to manager.ExecutePrintJob
                    return(new PluginExecutionResult(PluginResult.Failed, ex, "Print Failure."));
                }
            }
            return(manager.ExecutePullPrintOperation());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PaperCutPullPrintManager"/> class.
 /// </summary>
 /// <param name="pluginExecutionData">The plugin execution data.</param>
 /// <param name="activityData">The activity data.</param>
 public PaperCutPullPrintManager(PluginExecutionData pluginExecutionData, PaperCutActivityData activityData) : base(pluginExecutionData)
 {
     _activityData     = activityData;
     PullPrintSolution = "PaperCut Print Release";
     this.LockTimeouts = _activityData.LockTimeouts;
     this.AuthProvider = _activityData.AuthProvider;
 }
 /// <summary>
 /// Initializes this instance of <see cref="PaperCutPullPrintingConfigurationControl" /> with default data.
 /// </summary>
 /// <param name="environment">The plugin environment</param>
 public void Initialize(PluginEnvironment environment)
 {
     _activityData = new PaperCutActivityData();
     assetSelectionControl.Initialize(_deviceAttributes);
     printingConfigurationControl.Initialize();
     lockTimeoutControl.Initialize(_activityData.LockTimeouts);
     SetPullPrintAction();
 }
        /// <summary>
        /// Initializes this instance of <see cref="PaperCutPullPrintingConfigurationControl" /> with the specified plugin configuration data.
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="environment">The plugin environment</param>
        public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment)
        {
            _activityData            = configuration.GetMetadata <PaperCutActivityData>();
            _pluginConfigurationData = configuration;

            assetSelectionControl.Initialize(_pluginConfigurationData.Assets, _deviceAttributes);
            printingConfigurationControl.Initialize(_pluginConfigurationData.Documents, _pluginConfigurationData.PrintQueues, _activityData.DelayAfterPrint, _activityData.ShuffleDocuments, _activityData.UsePrintServerNotification);
            lockTimeoutControl.Initialize(_activityData.LockTimeouts);
            SetConfiguration();
        }
示例#5
0
        /// <summary>
        /// Validates the given metadata against the PaperCut Activity data.
        /// </summary>
        /// <param name="configurationData">The configuration data.</param>
        /// <returns>true if valid</returns>
        public bool ValidateMetadata(ref PluginConfigurationData configurationData)
        {
            bool validData = true;
            PaperCutActivityData activityData = null;

            try
            {
                activityData = configurationData.GetMetadata <PaperCutActivityData>();
            }
            catch
            {
                activityData = new PaperCutActivityData();
                validData    = false;
            }

            configurationData = new PluginConfigurationData(activityData, PaperCutConfigurationControl.Version);

            return(validData);
        }