/// <summary> /// Initializes the control for use with an existing metadata item. /// </summary> /// <param name="configuration">PluginConfigurationData</param> /// <param name="environment">PluginEnvironment</param> public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment) { _activityData = configuration.GetMetadata <JetAdvantageUploadActivityData>(); SetControlsByActivityData(); // Constrain to files tagged as Titan compatible documentSelectionControl.Initialize(configuration.Documents, TitanOnlyFilter()); }
/// <summary> /// Start the activity. /// </summary> /// <param name="metadata">Serialized activity data.</param> public PluginExecutionResult ProcessActivity(PluginExecutionData executionData) { PluginExecutionResult result = new PluginExecutionResult(PluginResult.Passed); UpdateStatus("Begin process activity..."); try { _activityData = executionData.GetMetadata <JetAdvantageUploadActivityData>(); _jetAdvantageProxy = _activityData.StackProxy; _jetAdvantageURL = _activityData.StackURL; UpdateStatus("Fetching document..."); // Throw an error if for some reason there isn't anything to upload. if (executionData.Documents.Count == 0) { throw new ArgumentException("The Document Set is empty, nothing to upload"); } foreach (Document document in executionData.Documents) { UpdateStatus(string.Format("Using base document {0}", document.FileName)); FileInfo fileInfo = ExecutionServices.FileRepository.GetFile(document); UploadUniqueFile(fileInfo, executionData); } UpdateStatus("Activity processing completed"); } catch (ThreadAbortException ex) { // Need to reset the abort. Thread.ResetAbort(); UpdateStatus("Error: " + ex.ToString()); result = new PluginExecutionResult(PluginResult.Failed, ex); } catch (Exception ex) { UpdateStatus("Error: " + ex.ToString()); result = new PluginExecutionResult(PluginResult.Failed, ex); } ExecutionServices.SystemTrace.LogDebug("Exiting..."); return(result); }
/// <summary> /// Initializes a new instance of <see cref="JetAdvantageUploadConfigControl"/> /// </summary> public JetAdvantageUploadConfigControl() { InitializeComponent(); _activityData = new JetAdvantageUploadActivityData(); documentSelectionControl.ShowDocumentBrowseControl = true; documentSelectionControl.ShowDocumentQueryControl = false; documentSelectionControl.ShowDocumentSetControl = false; fieldValidator.RequireValue(titanLoginId_TextBox, loginId_Label); fieldValidator.RequireValue(titanPassword_TextBox, password_label); fieldValidator.RequireDocumentSelection(documentSelectionControl); fieldValidator.RequireValue(textBoxJetAdvantageProxy, label_JetProxy); fieldValidator.RequireValue(textBoxJetAdvantageURL, label_JetURL); titanLoginId_TextBox.TextChanged += (s, e) => ConfigurationChanged(s, e); titanPassword_TextBox.TextChanged += (s, e) => ConfigurationChanged(s, e); checkBoxShuffle.CheckedChanged += (s, e) => ConfigurationChanged(s, e); documentSelectionControl.SelectionChanged += (s, e) => ConfigurationChanged(s, e); textBoxJetAdvantageProxy.TextChanged += (s, e) => ConfigurationChanged(s, e); textBoxJetAdvantageURL.TextChanged += (s, e) => ConfigurationChanged(s, e); }