/// <inheritdoc/> public async Task <object> ProcessAsync(string handlerName, string identifier, dynamic payload) { // AzureDevOps, 1, <json> var context = new DefaultWebHookExecutionContext( handlerName, identifier, payload ); var match = ReceiverSelector.Select(context); if (match == null) { throw new Exception("Invalid handler-name or identifier."); } var configuration = GetHandlerConfigurationInputs(handlerName, identifier); context.EnrichConfiguration(configuration); using (var scope = ServiceScopeFactory.CreateScope()) { var implementation = (IWebhookReceiver)scope.ServiceProvider.GetRequiredService(match.Handler); var response = await implementation.ReceiveAsync(context); return(response); } }
protected void SetMessageType() { if (receiverId.HasValue) { Control control = this.LoadControl("/UserControls/Templates/SmallOutputUser2.ascx"); ((SmallOutputUser2)control).DataObjectUser = DataObject.Load <DataObjectUser>(receiverId); receiverPlaceHolder.Controls.Add(new LiteralControl("<div class=\"inputBlock\"><div class=\"inputBlockLabel\">" + (new LabelControl() { LanguageFile = "Pages.Popups.WebUI.Base", LabelKey = "LableRequestReceiver", TooltipKey = "TooltipRequestReceiver" }).Text + "</div><div class=\"inputBlockContent\">" + ((SmallOutputUser2)control).GetHtml() + "</div></div>")); } else { if (receiverType == "friend") { ReceiverSelector receiverSelector = (ReceiverSelector)LoadControl("/UserControls/ReceiverSelector.ascx"); receiverPlaceHolder.Controls.Add(new LiteralControl("<div class=\"inputBlock\"><div class=\"inputBlockLabel\">" + (new LabelControl() { LanguageFile = "Pages.Popups.WebUI.Base", LabelKey = "LableRequestReceiver", TooltipKey = "TooltipRequestReceiver" }).Text + "</div><div class=\"inputBlockContent\">")); receiverPlaceHolder.Controls.Add(receiverSelector); receiverPlaceHolder.Controls.Add(new LiteralControl("</div></div>")); } else if (!UserProfile.Current.IsAnonymous && receiverType == "member") { receiverPlaceHolder.Controls.Add(new LiteralControl("<div class=\"inputBlock\">" + (new LabelControl() { LanguageFile = "Pages.Popups.WebUI.Base", LabelKey = "MessageToAllMember", TooltipKey = "TooltipMessageToAllMember" }).Text + "</div>")); } else if (receiverType == "report") { receiverPlaceHolder.Controls.Add(new LiteralControl("<div class=\"inputBlock\">" + (new TextControl() { LanguageFile = "Pages.Popups.WebUI.Base", TextKey = "MessageToAdmin" }).Text + "</div>")); var reports = CustomizationSection.CachedInstance.ContentReports; if (reports.Count > 0) { reportPanel.Visible = true; GuiLanguage languageReport = GuiLanguage.GetGuiLanguage(CustomizationSection.CachedInstance.ContentReports.LocalizationBaseFileName); foreach (ContentReport report in CustomizationSection.CachedInstance.ContentReports) { rcbReport.Items.Add(new RadComboBoxItem(languageReport.GetString(report.ReasonKey), report.ReasonKey)); } int reportIndex = 0; if (!string.IsNullOrEmpty(Request.Form[rcbReport.UniqueID])) { reportIndex = rcbReport.FindItemIndexByText(Request.Form[rcbReport.UniqueID]); } rcbReport.SelectedIndex = reportIndex; } } } }