public void Initialize(PluginEnvironment environment)
        {
            // Initialize the activity data with a default value for the Label
            _data = new SdkGeneralExampleActivityData("Default");
            activityLabel_TextBox.Text = _data.Label;

            // Initialize both the asset selection control and document selection control.
            // The document selection control will populate its tree control with all
            // documents available in the database.
            documentSelectionControl.Initialize();
            assetSelectionControl.Initialize(AssetAttributes.Printer);
        }
        public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment)
        {
            // Initialize the activity data by deserializing it from an existing copy of configuration information.
            _data = configuration.GetMetadata <SdkGeneralExampleActivityData>();
            activityLabel_TextBox.Text = _data.Label;

            // Initialize both the asset selection control and document selection control.
            // In this case an existing configuration is being provided, so initialize the
            // controls with any documents or assets that were chosen previously.  They
            // will show up in the lists as previously selected when the user makes a selection.
            documentSelectionControl.Initialize(configuration.Documents);
            assetSelectionControl.Initialize(configuration.Assets, AssetAttributes.Printer);
        }
        /// <summary>
        /// Executes the activity workflow.
        /// </summary>
        /// <param name="executionData">Information used in the execution of this workflow.</param>
        /// <returns>The result of executing the workflow.</returns>
        public PluginExecutionResult Execute(PluginExecutionData executionData)
        {
            PluginExecutionResult result = new PluginExecutionResult(PluginResult.Failed, "Unknown");

            UpdateStatus("Starting execution");

            // Get the activity data specific to this plugin
            _data = executionData.GetMetadata <SdkGeneralExampleActivityData>();
            UpdateLabel(_data.Label);

            // Get virtual worker account information
            var userCredential = executionData.Credential;

            UpdateStatus($"Executing as user [{userCredential.UserName}] within the domain [{userCredential.Domain}]");

            // Get the plugin settings if applicable
            var settings = executionData.Environment.PluginSettings;

            if (settings != null)
            {
                UpdateStatus($"Found {settings.Count} plugin settings values");
                foreach (var key in settings.Keys)
                {
                    UpdateStatus($"... Setting key={key}, value={settings[key]}");
                }
            }

            // Demonstrate getting, locking and using an asset
            result = DemonstrateAssetLockAndUsage(executionData);
            if (result != null)
            {
                return(result);
            }

            // Demonstrate getting and using a document
            result = DemonstrateDocumentUsage(executionData);
            if (result != null)
            {
                return(result);
            }

            // return "passed" if we made it this far
            result = new PluginExecutionResult(PluginResult.Passed);

            return(result);
        }