private void doneButton_Click(object sender, RoutedEventArgs e) { ncw.ShowDialog(); if(ncw.DialogResult.HasValue && ncw.DialogResult == true) { NC = ncw.NC; NO = new NotificationOptions { Name = ncw.NC.Name, SaveTimer = 1000 * 60 * 5, APICommand = "!pbapi", SeenCommand = "!seen", FilterCommand = "!filter", ClearCommand = "!clear", DBFile = AppDomain.CurrentDomain.BaseDirectory + "/notification.json", }; if (saveTimerBox.Text != "") NO.SaveTimer = Convert.ToInt32(saveTimerBox.Text); if (dbFileBox.Text != "") NO.DBFile = dbFileBox.Text; if (clearCommandBox.Text != "") NO.ClearCommand = clearCommandBox.Text; if (apiCommandBox.Text != "") NO.APICommand = apiCommandBox.Text; if (seenCommandBox.Text != "") NO.SeenCommand = seenCommandBox.Text; if (filterCommandBox.Text != "") NO.FilterCommand = filterCommandBox.Text; } DialogResult = true; Close(); }
protected override async Task AvailableRequest(NotificationOptions model, WebhookSettings settings) { await Run(model, settings, NotificationType.RequestAvailable); }
protected override async Task AddedToRequestQueue(NotificationOptions model, WebhookSettings settings) { await Run(model, settings, NotificationType.ItemAddedToFaultQueue); }
protected override async Task NewRequest(NotificationOptions model, WebhookSettings settings) { await Run(model, settings, NotificationType.NewRequest); }
public NotificationAttributesReader(NotificationOptions options, IConfiguration configuration) { _options = options; _configuration = configuration; }
private static void GenerateIDsForDefinedActions(NotificationOptions notificationOptions) { bool isActionDefined = false; if (notificationOptions.OnShow != null) { notificationOptions.ShowID = Guid.NewGuid().ToString(); isActionDefined = true; BridgeConnector.Socket.Off("NotificationEventShow"); BridgeConnector.Socket.On("NotificationEventShow", (id) => { _notificationOptions.Single(x => x.ShowID == id.ToString()).OnShow(); }); } if (notificationOptions.OnClick != null) { notificationOptions.ClickID = Guid.NewGuid().ToString(); isActionDefined = true; BridgeConnector.Socket.Off("NotificationEventClick"); BridgeConnector.Socket.On("NotificationEventClick", (id) => { _notificationOptions.Single(x => x.ClickID == id.ToString()).OnClick(); }); } if (notificationOptions.OnClose != null) { notificationOptions.CloseID = Guid.NewGuid().ToString(); isActionDefined = true; BridgeConnector.Socket.Off("NotificationEventClose"); BridgeConnector.Socket.On("NotificationEventClose", (id) => { _notificationOptions.Single(x => x.CloseID == id.ToString()).OnClose(); }); } if (notificationOptions.OnReply != null) { notificationOptions.ReplyID = Guid.NewGuid().ToString(); isActionDefined = true; BridgeConnector.Socket.Off("NotificationEventReply"); BridgeConnector.Socket.On("NotificationEventReply", (args) => { var arguments = ((JArray)args).ToObject <string[]>(); _notificationOptions.Single(x => x.ReplyID == arguments[0].ToString()).OnReply(arguments[1].ToString()); }); } if (notificationOptions.OnAction != null) { notificationOptions.ActionID = Guid.NewGuid().ToString(); isActionDefined = true; BridgeConnector.Socket.Off("NotificationEventAction"); BridgeConnector.Socket.On("NotificationEventAction", (args) => { var arguments = ((JArray)args).ToObject <string[]>(); _notificationOptions.Single(x => x.ReplyID == arguments[0].ToString()).OnAction(arguments[1].ToString()); }); } if (isActionDefined) { _notificationOptions.Add(notificationOptions); } }
public async Task NotifyAsync(NotificationOptions model, Settings.Settings.Models.Settings settings) { Settings.ClearCache(); if (settings == null) { await NotifyAsync(model); } var notificationSettings = (T)settings; if (!ValidateConfiguration(notificationSettings)) { return; } // Is this a test? // The request id for tests is -1 // Also issues are 0 since there might not be a request associated if (model.RequestId > 0) { await LoadRequest(model.RequestId, model.RequestType); SubsribedUsers = GetSubscriptions(model.RequestId, model.RequestType); } Customization = await CustomizationSettings.GetSettingsAsync(); try { switch (model.NotificationType) { case NotificationType.NewRequest: await NewRequest(model, notificationSettings); break; case NotificationType.Issue: await NewIssue(model, notificationSettings); break; case NotificationType.RequestAvailable: await AvailableRequest(model, notificationSettings); break; case NotificationType.RequestApproved: await RequestApproved(model, notificationSettings); break; case NotificationType.Test: await Test(model, notificationSettings); break; case NotificationType.RequestDeclined: await RequestDeclined(model, notificationSettings); break; case NotificationType.ItemAddedToFaultQueue: await AddedToRequestQueue(model, notificationSettings); break; case NotificationType.IssueResolved: await IssueResolved(model, notificationSettings); break; case NotificationType.IssueComment: await IssueComment(model, notificationSettings); break; default: throw new ArgumentOutOfRangeException(); } } catch (NotImplementedException) { // Do nothing, it's not implimented meaning it might not be ready or even used } }
protected abstract Task AvailableRequest(NotificationOptions model, T settings);
public static IServiceCollection AddNotificationModule(this IServiceCollection services, MessageBrokerOptions messageBrokerOptions, NotificationOptions notificationOptions, string connectionString, string migrationsAssembly = "") { services .AddDbContext <NotificationDbContext>(options => options.UseSqlServer(connectionString, sql => { if (!string.IsNullOrEmpty(migrationsAssembly)) { sql.MigrationsAssembly(migrationsAssembly); } })) .AddScoped <IRepository <EmailMessage, Guid>, Repository <EmailMessage, Guid> >() .AddScoped <IRepository <SmsMessage, Guid>, Repository <SmsMessage, Guid> >() .AddScoped(typeof(IEmailMessageRepository), typeof(EmailMessageRepository)) .AddScoped(typeof(ISmsMessageRepository), typeof(SmsMessageRepository)) .AddScoped <IEmailMessageService, EmailMessageService>(); services .AddScoped <EmailMessageService>() .AddScoped <SmsMessageService>(); DomainEvents.RegisterHandlers(Assembly.GetExecutingAssembly(), services); services.AddMessageHandlers(Assembly.GetExecutingAssembly()); services .AddMessageBusSender <EmailMessageCreatedEvent>(messageBrokerOptions) .AddMessageBusSender <SmsMessageCreatedEvent>(messageBrokerOptions) .AddMessageBusReceiver <EmailMessageCreatedEvent>(messageBrokerOptions) .AddMessageBusReceiver <SmsMessageCreatedEvent>(messageBrokerOptions); services.AddNotificationServices(notificationOptions); return(services); }
private void plusTriggerButton_Click(object sender, RoutedEventArgs e) { string selected = ""; TriggerType type; try { selected = ((ListBoxItem)triggerListBox.SelectedValue).Name; } catch (Exception err) { return; } ChatCommand cc = new ChatCommand(); ChatCommandApi cca = new ChatCommandApi(); ChatReply cr = new ChatReply(); NoCommand nc = new NoCommand(); TriggerLists tl = new TriggerLists(); TriggerNumbers tn = new TriggerNumbers(); AntiSpamTriggerOptions asto = new AntiSpamTriggerOptions(); DiscordOptions _do = new DiscordOptions(); // "do" is a keyword NoteTriggerOptions nto = new NoteTriggerOptions(); NotificationOptions no = new NotificationOptions(); MessageIntervalOptions mio = new MessageIntervalOptions(); TriggerOptionsBase tob = new TriggerOptionsBase(); if (selected == "isUpTrigger" || selected == "leaveChatTrigger" || selected == "kickTrigger" || selected == "banTrigger" || selected == "unbanTrigger" || selected == "lockTrigger" || selected == "unlockTrigger" || selected == "moderateTrigger" || selected == "unmoderateTrigger" || selected == "playGameTrigger" || selected == "changeNameTrigger" || selected == "googleTrigger") { ChatCommandWindow ccw = new ChatCommandWindow(); ccw.ShowDialog(); if (ccw.DialogResult.HasValue && ccw.DialogResult.Value) { cc = ccw.CC; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cc.Name, type.ToString())); tob.ChatCommand = cc; tob.Name = cc.Name; tob.Type = type; BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, cc.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "chatReplyTrigger") { ChatReplyWindow crw = new ChatReplyWindow(); crw.ShowDialog(); if (crw.DialogResult.HasValue && crw.DialogResult.Value) { cr = crw.CR; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.ChatReply = cr; tob.Name = cr.Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cr.Name, type.ToString())); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, cr.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "linkNameTrigger" || selected == "doormatTrigger") { NoCommandWindow ncw = new NoCommandWindow(); ncw.ShowDialog(); if (ncw.DialogResult.HasValue && ncw.DialogResult.Value) { nc = ncw.NC; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.NoCommand = nc; tob.Name = nc.Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", nc.Name, type.ToString())); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, nc.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "banCheckTrigger" || selected == "weatherTrigger" || selected == "youtubeTrigger") { ChatCommandApiWindow ccaw = new ChatCommandApiWindow(); switch (selected) { case "banCheckTrigger": ccaw.apiBlock.PreviewMouseDown += (sender1, e1) => Ccaw_PreviewMouseDown_Steam(sender1, e1, ccaw); break; case "weatherTrigger": ccaw.apiBlock.PreviewMouseDown += (sender1, e1) => Ccaw_PreviewMouseDown_Wunderground(sender1, e1, ccaw); break; case "youtubeTrigger": ccaw.apiBlock.PreviewMouseDown += (sender1, e1) => Ccaw_PreviewMouseDown1_Google(sender1, e1, ccaw); break; } ccaw.ShowDialog(); if (ccaw.DialogResult.HasValue && ccaw.DialogResult.Value) { cca = ccaw.CCA; cc = ccaw.CC; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.ChatCommandApi = cca; tob.ChatCommandApi.ChatCommand = cc; tob.Name = cca.Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cc.Name, type.ToString())); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, cc.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "acceptFriendRequestTrigger" || selected == "autojoinChatTrigger" || selected == "acceptChatInviteTrigger") { TriggerListWindow tlw = new TriggerListWindow(selected); tlw.ShowDialog(); if (tlw.DialogResult.HasValue && tlw.DialogResult.Value) { tl = tlw.TL; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.TriggerLists = tl; tob.Name = tl.Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", tl.Name, type)); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, tl.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "antispamTrigger") { AntiSpamTriggerOptionsWindow astow = new AntiSpamTriggerOptionsWindow(); astow.ShowDialog(); if (astow.DialogResult.HasValue && astow.DialogResult.Value) { asto = astow.ASTO; nc = astow.NC; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.AntiSpamTriggerOptions = asto; tob.AntiSpamTriggerOptions.NoCommand = nc; tob.Name = asto.Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", asto.Name, type)); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, asto.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "discordTrigger") { DiscordTriggerOptionsWindow dtow = new DiscordTriggerOptionsWindow(); dtow.ShowDialog(); if (dtow.DialogResult.HasValue && dtow.DialogResult.Value) { _do = dtow.DO; nc = dtow.NC; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.DiscordOptions = _do; tob.DiscordOptions.NoCommand = nc; tob.Name = _do.Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", _do.Name, type)); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, _do.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "noteTrigger") { NoteTriggerOptionsWindow ntow = new NoteTriggerOptionsWindow(); ntow.ShowDialog(); if (ntow.DialogResult.HasValue && ntow.DialogResult == true) { nc = ntow.NC; nto = ntow.NTO; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.NoteTriggerOptions = nto; tob.NoteTriggerOptions.NoCommand = nc; tob.Name = nto.Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", nto.Name, type)); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, nto.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "notificationTrigger") { NotificationOptionsWindow now = new NotificationOptionsWindow(); now.ShowDialog(); if (now.DialogResult.HasValue && now.DialogResult == true) { nc = now.NC; no = now.NO; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.NotificationOptions = no; tob.NotificationOptions.NoCommand = nc; tob.Name = Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", no.Name, type)); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, no.Name, tob); Bot.triggers.Add(trigger); } } else if (selected == "messageIntervalTrigger") { MessageIntervalOptionsWindow miow = new MessageIntervalOptionsWindow(); miow.ShowDialog(); if (miow.DialogResult.HasValue && miow.DialogResult == true) { mio = miow.MIO; type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); tob.MessageIntervalOptions = mio; tob.Name = Name; tob.Type = type; addedTriggersListBox.Items.Add(string.Format("{0} - {1}", mio.Name, type)); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, mio.Name, tob); Bot.triggers.Add(trigger); } } else { MessageBox.Show("Unknown Trigger. Please contact the developer.", "Error", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); } }
private void AddOtherInformation(NotificationOptions model, NotificationMessage notification, NotificationMessageContent parsed) { notification.Other.Add("image", parsed.Image); notification.Other.Add("title", model.RequestType == RequestType.Movie ? MovieRequest.Title : TvRequest.Title); }
public async ValueTask CreateAsync(string title, NotificationOptions options) { var module = await moduleTask.Value; await module.InvokeVoidAsync("create", title, options); }
public override void PreConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); var https = new HttpsOptions(); var blog = new BlogOptions(); var notification = new NotificationOptions(); var swagger = new SwaggerOptions(); var storage = new StorageOptions(); var cors = new CorsOptions(); var jwt = new JwtOptions(); var worker = new WorkerOptions(); var tencentCloud = new TencentCloudOptions(); var authorize = new AuthorizeOptions(); PreConfigure <HttpsOptions>(options => { var httpsOption = configuration.GetSection("https"); Configure <HttpsOptions>(httpsOption); options.ListenAddress = httpsOption.GetValue <string>(nameof(options.ListenAddress)); options.ListenPort = httpsOption.GetValue <int>(nameof(options.ListenPort)); options.PublicCertFile = httpsOption.GetValue <string>(nameof(options.PublicCertFile)); options.PrivateCertFile = httpsOption.GetValue <string>(nameof(options.PrivateCertFile)); https = options; }); PreConfigure <BlogOptions>(options => { var blogOption = configuration.GetSection("blog"); Configure <BlogOptions>(blogOption); options.StaticUrl = blogOption.GetValue <string>(nameof(options.StaticUrl)); options.ApiUrl = blogOption.GetValue <string>(nameof(options.ApiUrl)); options.WebUrl = blogOption.GetValue <string>(nameof(options.WebUrl)); options.AdminUrl = blogOption.GetValue <string>(nameof(options.AdminUrl)); blog = options; }); PreConfigure <NotificationOptions>(options => { var notificationOption = configuration.GetSection("notification"); Configure <NotificationOptions>(notificationOption); options.FtqqUrl = notificationOption.GetValue <string>(nameof(options.FtqqUrl)); notification = options; }); PreConfigure <SwaggerOptions>(options => { var swaggerOption = configuration.GetSection("swagger"); Configure <SwaggerOptions>(swaggerOption); options.Version = swaggerOption.GetValue <string>(nameof(options.Version)); options.Name = swaggerOption.GetValue <string>(nameof(options.Name)); options.Title = swaggerOption.GetValue <string>(nameof(options.Title)); options.Description = swaggerOption.GetValue <string>(nameof(options.Description)); options.RoutePrefix = swaggerOption.GetValue <string>(nameof(options.RoutePrefix)); options.DocumentTitle = swaggerOption.GetValue <string>(nameof(options.DocumentTitle)); swagger = options; }); PreConfigure <StorageOptions>(options => { var storageOption = configuration.GetSection("storage"); Configure <StorageOptions>(storageOption); options.Mongodb = storageOption.GetValue <string>(nameof(options.Mongodb)); options.RedisIsEnabled = storageOption.GetValue <bool>(nameof(options.RedisIsEnabled)); options.Redis = storageOption.GetValue <string>(nameof(options.Redis)); storage = options; }); PreConfigure <CorsOptions>(options => { var corsOption = configuration.GetSection("cors"); Configure <CorsOptions>(corsOption); options.PolicyName = corsOption.GetValue <string>(nameof(options.PolicyName)); options.Origins = corsOption.GetValue <string>(nameof(options.Origins)); cors = options; }); PreConfigure <JwtOptions>(options => { var jwtOption = configuration.GetSection("jwt"); Configure <JwtOptions>(jwtOption); options.Issuer = jwtOption.GetValue <string>(nameof(options.Issuer)); options.Audience = jwtOption.GetValue <string>(nameof(options.Audience)); options.SigningKey = jwtOption.GetValue <string>(nameof(options.SigningKey)); jwt = options; }); PreConfigure <WorkerOptions>(options => { var workerOption = configuration.GetSection("worker"); Configure <WorkerOptions>(workerOption); options.IsEnabled = workerOption.GetValue <bool>(nameof(options.IsEnabled)); options.Cron = workerOption.GetValue <string>(nameof(options.Cron)); worker = options; }); PreConfigure <TencentCloudOptions>(options => { var tencentCloudOption = configuration.GetSection("tencentCloud"); Configure <TencentCloudOptions>(tencentCloudOption); options.SecretId = tencentCloudOption.GetValue <string>(nameof(options.SecretId)); options.SecretKey = tencentCloudOption.GetValue <string>(nameof(options.SecretKey)); tencentCloud = options; }); PreConfigure <AuthorizeOptions>(options => { var authorizeOption = configuration.GetSection("authorize"); var githubOption = authorizeOption.GetSection("github"); var giteeOption = authorizeOption.GetSection("gitee"); var alipayOption = authorizeOption.GetSection("alipay"); var dingtalkOption = authorizeOption.GetSection("dingtalk"); var microsoftOption = authorizeOption.GetSection("microsoft"); var weiboOptions = authorizeOption.GetSection("weibo"); var qqOptions = authorizeOption.GetSection("qq"); Configure <AuthorizeOptions>(authorizeOption); Configure <GithubOptions>(githubOption); Configure <GiteeOptions>(giteeOption); Configure <AlipayOptions>(alipayOption); Configure <DingtalkOptions>(dingtalkOption); Configure <MicrosoftOptions>(microsoftOption); Configure <WeiboOptions>(weiboOptions); Configure <QQOptions>(qqOptions); options.Github = new GithubOptions { ClientId = githubOption.GetValue <string>(nameof(options.Github.ClientId)), ClientSecret = githubOption.GetValue <string>(nameof(options.Github.ClientSecret)), RedirectUrl = githubOption.GetValue <string>(nameof(options.Github.RedirectUrl)), Scope = githubOption.GetValue <string>(nameof(options.Github.Scope)) }; options.Gitee = new GiteeOptions { ClientId = giteeOption.GetValue <string>(nameof(options.Gitee.ClientId)), ClientSecret = giteeOption.GetValue <string>(nameof(options.Gitee.ClientSecret)), RedirectUrl = giteeOption.GetValue <string>(nameof(options.Gitee.RedirectUrl)), Scope = giteeOption.GetValue <string>(nameof(options.Gitee.Scope)) }; options.Alipay = new AlipayOptions { AppId = alipayOption.GetValue <string>(nameof(options.Alipay.AppId)), RedirectUrl = alipayOption.GetValue <string>(nameof(options.Alipay.RedirectUrl)), Scope = alipayOption.GetValue <string>(nameof(options.Alipay.Scope)), PrivateKey = alipayOption.GetValue <string>(nameof(options.Alipay.PrivateKey)), PublicKey = alipayOption.GetValue <string>(nameof(options.Alipay.PublicKey)) }; options.Dingtalk = new DingtalkOptions { AppId = dingtalkOption.GetValue <string>(nameof(options.Dingtalk.AppId)), AppSecret = dingtalkOption.GetValue <string>(nameof(options.Dingtalk.AppSecret)), RedirectUrl = dingtalkOption.GetValue <string>(nameof(options.Dingtalk.RedirectUrl)), Scope = dingtalkOption.GetValue <string>(nameof(options.Dingtalk.Scope)) }; options.Microsoft = new MicrosoftOptions { ClientId = microsoftOption.GetValue <string>(nameof(options.Microsoft.ClientId)), ClientSecret = microsoftOption.GetValue <string>(nameof(options.Microsoft.ClientSecret)), RedirectUrl = microsoftOption.GetValue <string>(nameof(options.Microsoft.RedirectUrl)), Scope = microsoftOption.GetValue <string>(nameof(options.Microsoft.Scope)) }; options.Weibo = new WeiboOptions { ClientId = weiboOptions.GetValue <string>(nameof(options.Weibo.ClientId)), ClientSecret = weiboOptions.GetValue <string>(nameof(options.Weibo.ClientSecret)), RedirectUrl = weiboOptions.GetValue <string>(nameof(options.Weibo.RedirectUrl)), Scope = weiboOptions.GetValue <string>(nameof(options.Weibo.Scope)) }; options.QQ = new QQOptions { ClientId = qqOptions.GetValue <string>(nameof(options.QQ.ClientId)), ClientSecret = qqOptions.GetValue <string>(nameof(options.QQ.ClientSecret)), RedirectUrl = qqOptions.GetValue <string>(nameof(options.QQ.RedirectUrl)), Scope = qqOptions.GetValue <string>(nameof(options.QQ.Scope)) }; authorize = options; }); PreConfigure <AppOptions>(options => { options.Https = https; options.Blog = blog; options.Swagger = swagger; options.Storage = storage; options.Cors = cors; options.Jwt = jwt; options.Worker = worker; options.TencentCloud = tencentCloud; options.Authorize = authorize; Configure <AppOptions>(item => { item.Swagger = swagger; item.Storage = storage; item.Cors = cors; item.Jwt = jwt; item.Worker = worker; item.TencentCloud = tencentCloud; item.Authorize = authorize; }); }); }
public ShowErrorNotificationMessage(string message = null, string title = null, NotificationOptions options = null, string notificationId = null) { Message = message; Title = title; Options = options; NotificationId = notificationId; }
protected override async Task RequestDeclined(NotificationOptions model, GotifySettings settings) { await Run(model, settings, NotificationType.RequestDeclined); }
protected abstract Task RequestApproved(NotificationOptions model, T settings);
public string Create(NotificationOptions options) { return(Create(null, options)); }
protected abstract Task Test(NotificationOptions model, T settings);
public IGattCharacteristicBuilder SetNotification(Action <CharacteristicSubscription> onSubscribe = null, NotificationOptions options = NotificationOptions.Notify) { this.onSubscribe = onSubscribe; var enc = options.HasFlag(NotificationOptions.EncryptionRequired); if (options.HasFlag(NotificationOptions.Indicate)) { this.properties |= enc ? CBCharacteristicProperties.IndicateEncryptionRequired : CBCharacteristicProperties.Indicate; } if (options.HasFlag(NotificationOptions.Notify)) { this.properties |= enc ? CBCharacteristicProperties.NotifyEncryptionRequired : CBCharacteristicProperties.Notify; } return(this); }
/// <summary> /// Create OS desktop notifications /// </summary> /// <param name="notificationOptions"></param> public void Show(NotificationOptions notificationOptions) { GenerateIDsForDefinedActions(notificationOptions); BridgeConnector.Socket.Emit("createNotification", JObject.FromObject(notificationOptions, _jsonSerializer)); }
protected async Task Send(List <string> playerIds, NotificationMessage model, MobileNotificationSettings settings, NotificationOptions requestModel, bool isAdminNotification = false) { if (playerIds == null || !playerIds.Any()) { return; } var response = await _api.PushNotification(playerIds, model.Message, isAdminNotification, requestModel.RequestId, (int)requestModel.RequestType); _logger.LogDebug("Sent message to {0} recipients with message id {1}", response.recipients, response.id); }
public static IServiceCollection AddNotificationServices(this IServiceCollection services, NotificationOptions options) { services.AddEmailNotification(options.Email); services.AddSmsNotification(options.Sms); return(services); }
/// <summary> /// Loads the correct template from the DB /// </summary> /// <param name="agent"></param> /// <param name="type"></param> /// <param name="model"></param> /// <returns></returns> protected virtual async Task <NotificationMessageContent> LoadTemplate(NotificationAgent agent, NotificationType type, NotificationOptions model) { var template = await TemplateRepository.GetTemplate(agent, type); if (template == null) { throw new TemplateMissingException($"The template for {agent} and type {type} is missing"); } if (!template.Enabled) { return(new NotificationMessageContent { Disabled = true }); } if (model.UserId.IsNullOrEmpty()) { if (model.RequestType == RequestType.Movie) { model.UserId = MovieRequest.RequestedUserId; } if (model.RequestType == RequestType.Album) { model.UserId = AlbumRequest.RequestedUserId; } if (model.RequestType == RequestType.TvShow) { model.UserId = TvRequest.RequestedUserId; } } var parsed = Parse(model, template, agent); return(parsed); }
public IGattCharacteristicBuilder SetNotification(Action <CharacteristicSubscription> onSubscribe = null, NotificationOptions options = NotificationOptions.Notify) { throw new NotImplementedException(); }
protected abstract Task NewIssue(NotificationOptions model, T settings);
protected override async Task IssueResolved(NotificationOptions model, WebhookSettings settings) { await Run(model, settings, NotificationType.IssueResolved); }
protected abstract Task IssueComment(NotificationOptions model, T settings);
protected override async Task RequestApproved(NotificationOptions model, WebhookSettings settings) { await Run(model, settings, NotificationType.RequestApproved); }
protected abstract Task IssueResolved(NotificationOptions model, T settings);
protected abstract Task AddedToRequestQueue(NotificationOptions model, T settings);
protected override async Task IssueComment(NotificationOptions model, GotifySettings settings) { await Run(model, settings, NotificationType.IssueComment); }