Exemplo n.º 1
0
 /// <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)
 {
     ConfigureControls(configuration.GetMetadata <PrintingActivityData>(ConverterProvider.GetMetadataConverters()));
     documentSelectionControl.Initialize(configuration.Documents);
     LoadPrintQueues(configuration.PrintQueues.SelectedPrintQueues);
     RefreshQueueDataGrid();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Validates the given metadata against the Printing Activity data.
        /// </summary>
        /// <param name="configurationData">The configuration data.</param>
        /// <returns>true if valid</returns>
        public bool ValidateMetadata(ref PluginConfigurationData configurationData)
        {
            bool validData = true;
            PrintingActivityData activityData = null;

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

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

            return(validData);
        }
Exemplo n.º 3
0
        /// <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)
        {
            try
            {
                // Thread the print task so that any issues don't crash the user main thread.
                Task <PluginExecutionResult> printTask = Task <PluginExecutionResult> .Factory.StartNew(() => _engine.ProcessActivity(executionData, ConverterProvider.GetMetadataConverters()));

                printTask.Wait();

                return(printTask.Result);
            }
            catch (AggregateException ex)
            {
                ExecutionServices.SystemTrace.LogError(ex);
                return(new PluginExecutionResult(PluginResult.Failed, ex, "Print failure."));
            }
        }