public NotificationModule(NotificationFactory notificationFactory) : base(notificationFactory, "notification") { }
public SettingsForm() { // Form itself InitializeComponent(); Icon = Resources.SettingsIcon; Text = AssemblyUtils.GetReleaseState() == AssemblyUtils.ReleaseState.Beta ? $"{SettingsStrings.settings} {AssemblyUtils.GetReleaseState()}" : SettingsStrings.settings; LocalizeForm(); var closeToolTip = new ToolTip(); closeToolTip.SetToolTip(closeButton, SettingsStrings.closeTooltip); hotkeysTextBox.Text = AppConfigs.Configuration.PlaybackHotKeys.Display(); hotkeysTextBox.Tag = new Tuple <AudioDeviceType, HotKeys>(AudioDeviceType.Playback, AppConfigs.Configuration.PlaybackHotKeys); hotkeysTextBox.Enabled = hotkeysCheckBox.Checked = AppConfigs.Configuration.PlaybackHotKeys.Enabled; hotkeysTextBox.KeyDown += (sender, args) => SetHotkey(args); var hotkeysToolTip = new ToolTip(); hotkeysToolTip.SetToolTip(hotkeysCheckBox, SettingsStrings.hotkeysTooltip); // Settings - Basic startWithWindowsCheckBox.Checked = AppModel.Instance.RunAtStartup; keepSystemTrayIconCheckBox.Checked = AppConfigs.Configuration.KeepSystrayIcon; var keepSystemTrayIconToolTip = new ToolTip(); keepSystemTrayIconToolTip.SetToolTip(keepSystemTrayIconCheckBox, SettingsStrings.keepSystemTrayIconTooltip); // Settings - Audio switchCommunicationDeviceCheckBox.Checked = AppModel.Instance.SetCommunications; var switchCommunicationsDeviceToolTip = new ToolTip(); switchCommunicationsDeviceToolTip.SetToolTip(switchCommunicationDeviceCheckBox, SettingsStrings.communicationsDeviceTooltip); var notificationToolTip = new ToolTip(); notificationToolTip.SetToolTip(notificationComboBox, SettingsStrings.notificationTooltip); var notificationFactory = new NotificationFactory(); notificationFactory.ConfigureListControl(notificationComboBox); notificationComboBox.SelectedValue = AppModel.Instance.NotificationSettings; selectSoundFileDialog.Filter = SettingsStrings.audioFiles + @" (*.wav;*.mp3)|*.wav;*.mp3;*.aiff"; selectSoundFileDialog.FileOk += SelectSoundFileDialogOnFileOk; selectSoundFileDialog.CheckFileExists = true; selectSoundFileDialog.CheckPathExists = true; selectSoundButton.Visible = notificationFactory.Get(AppModel.Instance.NotificationSettings).SupportCustomSound() != NotificationCustomSoundEnum.NotSupported; var selectSoundButtonToolTip = new ToolTip(); selectSoundButtonToolTip.SetToolTip(selectSoundButton, SettingsStrings.selectSoundButtonTooltip); new TooltipInfoFactory().ConfigureListControl(tooltipInfoComboBox); tooltipInfoComboBox.SelectedValue = TooltipInfoManager.CurrentTooltipInfo; new DeviceCyclerFactory().ConfigureListControl(cycleThroughComboBox); cycleThroughComboBox.SelectedValue = DeviceCyclerManager.CurrentCycler; var cycleThroughToolTip = new ToolTip(); cycleThroughToolTip.SetToolTip(cycleThroughComboBox, SettingsStrings.cycleThroughTooltip); // Settings - Update includeBetaVersionsCheckBox.Checked = AppModel.Instance.IncludeBetaVersions; switch (AppModel.Instance.UpdateMode) { case UpdateMode.Silent: updateSilentRadioButton.Checked = true; break; case UpdateMode.Notify: updateNotifyRadioButton.Checked = true; break; case UpdateMode.Never: updateNeverRadioButton.Checked = true; break; default: throw new ArgumentOutOfRangeException(); } var updateSilentToolTip = new ToolTip(); updateSilentToolTip.SetToolTip(updateSilentRadioButton, SettingsStrings.updateInstallAutomaticallyTooltip); var updateNotifyToolTip = new ToolTip(); updateNotifyToolTip.SetToolTip(updateNotifyRadioButton, SettingsStrings.updateNotifyTooltip); var updateNeverToolTip = new ToolTip(); updateNeverToolTip.SetToolTip(updateNeverRadioButton, SettingsStrings.updateNeverTooltip); var includeBetaVersionsToolTip = new ToolTip(); includeBetaVersionsToolTip.SetToolTip(includeBetaVersionsCheckBox, SettingsStrings.updateIncludeBetaVersionsTooltip); // Settings - Language languageComboBox.SelectedIndex = (int)AppConfigs.Configuration.Language; // Playback and Recording var audioDeviceLister = new AudioDeviceLister(DeviceState.All); PopulateAudioList(playbackListView, AppModel.Instance.SelectedPlaybackDevicesList, audioDeviceLister.GetPlaybackDevices()); PopulateAudioList(recordingListView, AppModel.Instance.SelectedRecordingDevicesList, audioDeviceLister.GetRecordingDevices()); _loaded = true; }
/// <summary> /// Refreshes as specified by a json payload. /// </summary> /// <param name="json">The json payload.</param> public virtual void Refresh(string json) { OnCacheUpdated(NotificationFactory.Create <TNotification>(json, MessageType.RefreshByJson)); }
/// <summary> /// Constructor for Account controller /// </summary> /// <param name="accountService"></param> /// <param name="permissionService"></param> /// <param name="userService"></param> /// <param name="options"></param> public AccountController(IAccountService accountService, IUserService userService, IPermissionService permissionService, IOptions <TokenProviderOptions> options, IEmailSender emailSender, IService <UserLogin> userLoginService, PDX.Logging.ILogger logger, NotificationFactory notificationFacory) { _service = accountService; _userService = userService; _permissionService = permissionService; _tokenProvider = new TokenProvider(options, accountService, userService); _emailSender = emailSender; _userLoginService = userLoginService; _logger = logger; _notificationFactory = notificationFacory; }
private static void ShowStandardMsg(NotificationType type, SimpleOptions options) { NotificationFactory.ShowMessageNotification(options.header, options.text, options.timeout, options.width, options.height, type, new TimerEndedHandler(TimerEnded)); }
public NotificationController(NotificationFactory notificationFactory) : base(notificationFactory, "notification", ResourceMapper) { }
public void NotificationFactoryEmailTest() { var actualEmailNotificationChannel = NotificationFactory.GetNotificationChannel("email"); Assert.IsType <EmailNotification>(actualEmailNotificationChannel); }
static void Main(string[] args) { //Create our service PushService push = new PushService(); //Wire up the events push.Events.OnDeviceSubscriptionExpired += new Common.ChannelEvents.DeviceSubscriptionExpired(Events_OnDeviceSubscriptionExpired); push.Events.OnDeviceSubscriptionIdChanged += new Common.ChannelEvents.DeviceSubscriptionIdChanged(Events_OnDeviceSubscriptionIdChanged); push.Events.OnChannelException += new Common.ChannelEvents.ChannelExceptionDelegate(Events_OnChannelException); push.Events.OnNotificationSendFailure += new Common.ChannelEvents.NotificationSendFailureDelegate(Events_OnNotificationSendFailure); push.Events.OnNotificationSent += new Common.ChannelEvents.NotificationSentDelegate(Events_OnNotificationSent); push.Events.OnChannelCreated += new Common.ChannelEvents.ChannelCreatedDelegate(Events_OnChannelCreated); push.Events.OnChannelDestroyed += new Common.ChannelEvents.ChannelDestroyedDelegate(Events_OnChannelDestroyed); //Configure and start Apple APNS // IMPORTANT: Make sure you use the right Push certificate. Apple allows you to generate one for connecting to Sandbox, // and one for connecting to Production. You must use the right one, to match the provisioning profile you build your // app with! //var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Resources/PushSharp.Apns.Sandbox.p12")); //IMPORTANT: If you are using a Development provisioning Profile, you must use the Sandbox push notification server // (so you would leave the first arg in the ctor of ApplePushChannelSettings as 'false') // If you are using an AdHoc or AppStore provisioning profile, you must use the Production push notification server // (so you would change the first arg in the ctor of ApplePushChannelSettings to 'true') //push.StartApplePushService(new ApplePushChannelSettings(appleCert, "pushsharp")); //Configure and start Android GCM //IMPORTANT: The SENDER_ID is your Google API Console App Project ID. // Be sure to get the right Project ID from your Google APIs Console. It's not the named project ID that appears in the Overview, // but instead the numeric project id in the url: eg: https://code.google.com/apis/console/?pli=1#project:785671162406:overview // where 785671162406 is the project id, which is the SENDER_ID to use! push.StartGoogleCloudMessagingPushService(new GcmPushChannelSettings("348279368873", "AIzaSyAJclLrg4DWUflL67FS3PI1KqIGnKxSrjY", "com.pushsharp.test")); ////Configure and start Windows Phone Notifications //push.StartWindowsPhonePushService(new WindowsPhonePushChannelSettings()); ////Configure and start Windows Notifications //push.StartWindowsPushService(new WindowsPushChannelSettings("677AltusApps.PushSharpTest", // "ms-app://s-1-15-2-397915024-884168245-3562497613-3307968140-4074292843-797285123-433377759", "ei5Lott1HEbbZBv2wGDTUsrCjU++Pj8Z")); //Fluent construction of a Windows Toast Notification //push.QueueNotification(NotificationFactory.Windows().Toast().AsToastText01("This is a test").ForChannelUri("YOUR_CHANNEL_URI_HERE")); //Fluent construction of a Windows Phone Toast notification ////IMPORTANT: For Windows Phone you MUST use your own Endpoint Uri here that gets generated within your Windows Phone app itself! //push.QueueNotification(NotificationFactory.WindowsPhone().Toast() // .ForEndpointUri(new Uri("http://sn1.notify.live.net/throttledthirdparty/01.00/AAFCoNoCXidwRpn5NOxvwSxPAgAAAAADAgAAAAQUZm52OkJCMjg1QTg1QkZDMkUxREQ")) // .ForOSVersion(WindowsPhone.WindowsPhoneDeviceOSVersion.MangoSevenPointFive) // .WithBatchingInterval(WindowsPhone.BatchingInterval.Immediate) // .WithNavigatePath("/MainPage.xaml") // .WithText1("PushSharp") // .WithText2("This is a Toast")); ////Fluent construction of an iOS notification ////IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets generated within your iOS app itself when the Application Delegate //// for registered for remote notifications is called, and the device token is passed back to you //push.QueueNotification(NotificationFactory.Apple() // .ForDeviceToken("1071737321559691b28fffa1aa4c8259d970fe0fc496794ad0486552fc9ec3db") // .WithAlert("1 Alert Text!") // .WithSound("default") // .WithBadge(7)); //Fluent construction of an Android GCM Notification //IMPORTANT: For Android you MUST use your own RegistrationId here that gets generated within your Android app itself! push.QueueNotification(NotificationFactory.AndroidGcm() .ForDeviceRegistrationId("APA91bHZcJ4siq7RGi59jEggvsjZSnAUcKvb-1spYW04OkLGvkcaLKwS3fFvDYQBiyjdJjiR6DSNbkp1lRp1PKkU8QT8Rr7yreFYqmvx9F32FDYHhc3ljBKI7bDhSVHHCNRXP2G-5bLzSmg9PRE9Es6WCnHZtuSAYDuT1oG29jw1a5Y9KDKh2bs") .WithCollapseKey("NONE") .WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"7\"}")); //push.QueueNotification(NotificationFactory.Windows() // .Toast() // .ForChannelUri("https://bn1.notify.windows.com/?token=AgUAAACC2u7flXAmaevcggrLenaSdExjVfIHvr6KSZrg0KeuGrcz877rPJprPL9bEuQH%2bacmmm%2beUyXNXEM8oRNit%2bzPoigksDOq6bIFyV3XGmhUmXadysLokl5rlmTscvHGAbs%3d") // .WithRequestForStatus(true) // .AsToastText01("This is a test!")); Console.WriteLine("Waiting for Queue to Finish..."); //Stop and wait for the queues to drains push.StopAllServices(true); Console.WriteLine("Queue Finished, press return to exit..."); Console.ReadLine(); }
public SettingsForm(IAudioDeviceLister audioDeviceLister) { _audioDeviceLister = audioDeviceLister; // Form itself InitializeComponent(); Icon = RessourceSettingsIcon; Text = AssemblyUtils.GetReleaseState() == AssemblyUtils.ReleaseState.Beta ? $"{SettingsStrings.settings} {AssemblyUtils.GetReleaseState()}" : SettingsStrings.settings; LocalizeForm(); var closeToolTip = new ToolTip(); closeToolTip.SetToolTip(closeButton, SettingsStrings.closeTooltip); hotKeyControl.HotKey = AppConfigs.Configuration.PlaybackHotKey; hotKeyControl.Tag = new Tuple <DataFlow, HotKey>(DataFlow.Render, AppConfigs.Configuration.PlaybackHotKey); hotKeyControl.Enabled = hotkeysCheckBox.Checked = AppConfigs.Configuration.PlaybackHotKey.Enabled; var hotkeysToolTip = new ToolTip(); hotkeysToolTip.SetToolTip(hotkeysCheckBox, SettingsStrings.hotkeysTooltip); // Settings - Basic startWithWindowsCheckBox.Checked = AppModel.Instance.RunAtStartup; new IconChangerFactory().ConfigureListControl(iconChangeChoicesComboBox); iconChangeChoicesComboBox.SelectedValue = AppConfigs.Configuration.SwitchIcon; var iconChangeToolTip = new ToolTip(); iconChangeToolTip.SetToolTip(iconChangeLabel, SettingsStrings.iconChange_tooltip); // Settings - Audio switchCommunicationDeviceCheckBox.Checked = AppModel.Instance.SetCommunications; var switchCommunicationsDeviceToolTip = new ToolTip(); switchCommunicationsDeviceToolTip.SetToolTip(switchCommunicationDeviceCheckBox, SettingsStrings.communicationsDeviceTooltip); var notificationToolTip = new ToolTip(); notificationToolTip.SetToolTip(notificationComboBox, SettingsStrings.notificationTooltip); var notificationFactory = new NotificationFactory(); notificationFactory.ConfigureListControl(notificationComboBox); notificationComboBox.SelectedValue = AppModel.Instance.NotificationSettings; selectSoundFileDialog.Filter = SettingsStrings.audioFiles + @" (*.wav;*.mp3)|*.wav;*.mp3;*.aiff"; selectSoundFileDialog.FileOk += SelectSoundFileDialogOnFileOk; selectSoundFileDialog.CheckFileExists = true; selectSoundFileDialog.CheckPathExists = true; var soundSupported = notificationFactory.Get(AppModel.Instance.NotificationSettings).SupportCustomSound() != NotificationCustomSoundEnum.NotSupported; selectSoundButton.Visible = soundSupported; var removeCustomSoundToolTip = new ToolTip(); removeCustomSoundToolTip.SetToolTip(deleteSoundButton, SettingsStrings.disableCustomSoundTooltip); try { deleteSoundButton.Visible = soundSupported && AppModel.Instance.CustomNotificationSound != null; } catch (CachedSoundFileNotExistsException) { } var selectSoundButtonToolTip = new ToolTip(); selectSoundButtonToolTip.SetToolTip(selectSoundButton, SettingsStrings.selectSoundButtonTooltip); new TooltipInfoFactory().ConfigureListControl(tooltipInfoComboBox); tooltipInfoComboBox.SelectedValue = TooltipInfoManager.CurrentTooltipInfo; new DeviceCyclerFactory().ConfigureListControl(cycleThroughComboBox); cycleThroughComboBox.SelectedValue = DeviceCyclerManager.CurrentCycler; var cycleThroughToolTip = new ToolTip(); cycleThroughToolTip.SetToolTip(cycleThroughComboBox, SettingsStrings.cycleThroughTooltip); foregroundAppCheckbox.Checked = AppModel.Instance.SwitchForegroundProgram; usePrimaryScreenCheckbox.Checked = AppModel.Instance.NotifyUsingPrimaryScreen; usePrimaryScreenCheckbox.Visible = AppModel.Instance.NotificationSettings == NotificationTypeEnum.BannerNotification; var foregroundAppToolTip = new ToolTip(); foregroundAppToolTip.SetToolTip(foregroundAppCheckbox, SettingsStrings.foregroundAppTooltip); var usePrimaryScreenTooltip = new ToolTip(); usePrimaryScreenTooltip.SetToolTip(usePrimaryScreenCheckbox, SettingsStrings.usePrimaryScreenTooltip); // Settings - Update includeBetaVersionsCheckBox.Checked = AppModel.Instance.IncludeBetaVersions; switch (AppModel.Instance.UpdateMode) { case UpdateMode.Silent: updateSilentRadioButton.Checked = true; break; case UpdateMode.Notify: updateNotifyRadioButton.Checked = true; break; case UpdateMode.Never: updateNeverRadioButton.Checked = true; break; default: throw new ArgumentOutOfRangeException(); } var updateSilentToolTip = new ToolTip(); updateSilentToolTip.SetToolTip(updateSilentRadioButton, SettingsStrings.updateInstallAutomaticallyTooltip); var updateNotifyToolTip = new ToolTip(); updateNotifyToolTip.SetToolTip(updateNotifyRadioButton, SettingsStrings.updateNotifyTooltip); var updateNeverToolTip = new ToolTip(); updateNeverToolTip.SetToolTip(updateNeverRadioButton, SettingsStrings.updateNeverTooltip); var includeBetaVersionsToolTip = new ToolTip(); includeBetaVersionsToolTip.SetToolTip(includeBetaVersionsCheckBox, SettingsStrings.updateIncludeBetaVersionsTooltip); // Settings - Language new LanguageFactory().ConfigureListControl(languageComboBox); languageComboBox.SelectedValue = AppModel.Instance.Language; PopulateSettings(); _loaded = true; }
private void ProcessMailQueue() { foreach (int ModuleId in SettingFactory.GetDistinctModuleIds(AppFactory.Identifiers.admin_notifications_email.ToString())) { SmtpClient client = null; string NotificationEnabled = SettingFactory.GetValue(ModuleId, AppFactory.Identifiers.admin_notifications_email.ToString(), "Notification_Email"); if (!string.IsNullOrEmpty(NotificationEnabled) && Convert.ToBoolean(NotificationEnabled)) { SmtpServer SmtpServer = NotificationFactory.GetSMTP(ModuleId, AppFactory.Identifiers.admin_notifications_email.ToString()); try { if (SmtpServer != null && !string.IsNullOrEmpty(SmtpServer.Server) && SmtpServer.Port > 0) { List <MailQueue> MailQueue = NotificationFactory.GetMailQueue(ModuleId); if (MailQueue.Count > 0) { client = NotificationFactory.Connect(SmtpServer.Server, SmtpServer.Port, SmtpServer.Authentication, SmtpServer.Username, SmtpServer.Password, SmtpServer.SSL); foreach (MailQueue mail in MailQueue) { try { NotificationFactory.SendMail(client, mail); mail.Delete(); } catch (Exception ex) { if (mail.RetryAttempt < 3) { mail.Status = "Retry"; mail.RetryDateTime = DateTime.Now.AddMinutes(2); mail.RetryAttempt = mail.RetryAttempt + 1; mail.Update(); } else { mail.Status = "Error"; mail.Update(); mail.Delete(); } Exceptions.LogException(ex); } } SchedulerLog.Add("Mail queue operation run successfully"); } } } catch (Exception ex) { Exceptions.LogException(ex); SchedulerLog.Add("Mail queue operation Failed. !See event log for details"); } finally { if (client != null) { client.Dispose(); } } } } }
public static void TestSmtp(SmtpServer smtp, string ToEmail, string FriendlyName, string FromEmail, string FromName, string ReplyTo, ref string SuccessfulMessage, ref string ExceptionsMessage) { NotificationFactory.TestSmtp(smtp, ToEmail, FriendlyName, FromEmail, FromName, ReplyTo, ref SuccessfulMessage, ref ExceptionsMessage); }
public static void QueueMail(MailQueue MailQueue) { NotificationFactory.QueueMail(MailQueue); }
public static void QueueMail(int ModuleID, string Subject, string Content, string ToEmail, List <Attachment> Attachments, string FromName, string FromEmail, string ReplyEmail, string FromEmailPrefix = null) { NotificationFactory.QueueMail(ModuleID, Subject, Content, ToEmail, Attachments, FromName, FromEmail, FromEmailPrefix, ReplyEmail); }
public void DescriptionVue([FromBody] RtcViewModel model) { NotificationFactory.SendNotificationFromFirebaseCloud(null, model.Sdp, "sdp"); }
public void NotificationFactoryDefaultTest() { Assert.Throws <NotSupportedException>(() => NotificationFactory.GetNotificationChannel("postcard")); }
public void CandidateVue([FromBody] RtcViewModel model) { NotificationFactory.SendNotificationFromFirebaseCloud(null, model.Candidate, "candidate"); }
public ImportPermitService(IUnitOfWork unitOfWork, IImportPermitRepository importPermitRepository, IUserService userService, IDocumentService documentService, IService <vwImportPermit> vwImportPermitService, IService <vwPIP> vwPIPService, IService <ImportPermitLogStatus> importLog, IService <ImportPermitStatus> importPermitStatus, IService <ImportPermitType> importPermitTypeService, IService <UserRole> userRoleService, IService <UserAgent> userAgentService, IService <Submodule> submoduleService, IService <SupplierProduct> supplierProduct, IService <SystemSetting> systemSettingService, IAgentService agentService, IService <Country> countryService, IWIPService wipService, NotificationFactory notificationFactory, IOptions <SystemUserConfig> options) : base(unitOfWork, importPermitRepository) { _unitOfWork = unitOfWork; _userService = userService; _userRoleService = userRoleService; _documentService = documentService; _vwImportPermitService = vwImportPermitService; _vwPIPService = vwPIPService; _importLog = importLog; _importPermitStatus = importPermitStatus; _importPermitTypeService = importPermitTypeService; _userAgentService = userAgentService; _supplierProduct = supplierProduct; _submoduleService = submoduleService; _systemSettingService = systemSettingService; _countryService = countryService; _agentService = agentService; _wipService = wipService; _notificationFactory = notificationFactory; _systemUser = options.Value; PopulateEmailContentDictionaryMap(); }
static void Main(string[] args) { //Create our service PushService push = new PushService(); //Wire up the events push.Events.OnDeviceSubscriptionExpired += new Common.ChannelEvents.DeviceSubscriptionExpired(Events_OnDeviceSubscriptionExpired); push.Events.OnDeviceSubscriptionIdChanged += new Common.ChannelEvents.DeviceSubscriptionIdChanged(Events_OnDeviceSubscriptionIdChanged); push.Events.OnChannelException += new Common.ChannelEvents.ChannelExceptionDelegate(Events_OnChannelException); push.Events.OnNotificationSendFailure += new Common.ChannelEvents.NotificationSendFailureDelegate(Events_OnNotificationSendFailure); push.Events.OnNotificationSent += new Common.ChannelEvents.NotificationSentDelegate(Events_OnNotificationSent); //Configure and start Apple APNS // IMPORTANT: Make sure you use the right Push certificate. Apple allows you to generate one for connecting to Sandbox, // and one for connecting to Production. You must use the right one, to match the provisioning profile you build your // app with! var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Resources/PushSharp.Apns.Sandbox.p12")); //IMPORTANT: If you are using a Development provisioning Profile, you must use the Sandbox push notification server // (so you would leave the first arg in the ctor of ApplePushChannelSettings as 'false') // If you are using an AdHoc or AppStore provisioning profile, you must use the Production push notification server // (so you would change the first arg in the ctor of ApplePushChannelSettings to 'true') push.StartApplePushService(new ApplePushChannelSettings(false, appleCert, "pushsharp")); //Configure and start Android GCM //IMPORTANT: The SENDER_ID is your Google API Console App Project ID. // Be sure to get the right Project ID from your Google APIs Console. It's not the named project ID that appears in the Overview, // but instead the numeric project id in the url: eg: https://code.google.com/apis/console/?pli=1#project:785671162406:overview // where 785671162406 is the project id, which is the SENDER_ID to use! push.StartGoogleCloudMessagingPushService(new GcmPushChannelSettings("785671162406", "AIzaSyC2PZNXQDVaUpZGmtsF_Vp8tHtIABVjazI", "com.pushsharp.test")); //Configure and start Windows Phone Notifications push.StartWindowsPhonePushService(new WindowsPhonePushChannelSettings()); //Configure and start Windows Notifications push.StartWindowsPushService(new WindowsPushChannelSettings("BUILD.64beb1a1-5444-4660-8b27-bcc740f9c7ca", "ms-app://s-1-15-2-259456210-2622405444-520366611-1750679940-1314087242-2560077863-3994015833", "7-GIUO1ubmrqOwQUBzXpnqiSw30LS2xr")); //Fluent construction of a Windows Toast Notification push.QueueNotification(NotificationFactory.Windows().Toast().AsToastText01("This is a test").ForChannelUri("YOUR_CHANNEL_URI_HERE")); //Fluent construction of a Windows Phone Toast notification //IMPORTANT: For Windows Phone you MUST use your own Endpoint Uri here that gets generated within your Windows Phone app itself! push.QueueNotification(NotificationFactory.WindowsPhone().Toast() .ForEndpointUri(new Uri("http://sn1.notify.live.net/throttledthirdparty/01.00/AAFCoNoCXidwRpn5NOxvwSxPAgAAAAADAgAAAAQUZm52OkJCMjg1QTg1QkZDMkUxREQ")) .ForOSVersion(WindowsPhone.WindowsPhoneDeviceOSVersion.MangoSevenPointFive) .WithBatchingInterval(WindowsPhone.BatchingInterval.Immediate) .WithNavigatePath("/MainPage.xaml") .WithText1("PushSharp") .WithText2("This is a Toast")); //Fluent construction of an iOS notification //IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets generated within your iOS app itself when the Application Delegate // for registered for remote notifications is called, and the device token is passed back to you push.QueueNotification(NotificationFactory.Apple() .ForDeviceToken("1071737321559691b28fffa1aa4c8259d970fe0fc496794ad0486552fc9ec3db") .WithAlert("1 Alert Text!") .WithSound("default") .WithBadge(7)); //Fluent construction of an Android GCM Notification //IMPORTANT: For Android you MUST use your own RegistrationId here that gets generated within your Android app itself! push.QueueNotification(NotificationFactory.AndroidGcm() .ForDeviceRegistrationId("APA91bG7J-cZjkURrqi58cEd5ain6hzi4i06T0zg9eM2kQAprV-fslFiq60hnBUVlnJPlPV-4K7X39aHIe55of8fJugEuYMyAZSUbmDyima5ZTC7hn4euQ0Yflj2wMeTxnyMOZPuwTLuYNiJ6EREeI9qJuJZH9Zu9g") .WithCollapseKey("NONE") .WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"7\"}")); Console.WriteLine("Waiting for Queue to Finish..."); //Stop and wait for the queues to drains push.StopAllServices(true); Console.WriteLine("Queue Finished, press return to exit..."); Console.ReadLine(); }
public ErrorList(NotificationType type) { notificationsError = new List <NotificationError>(); notifications = NotificationFactory.getInstance().getNotificationType(type); }
public static void Main(string[] args) { Application.Init(); SimpleOptions options = new SimpleOptions(); options.ProcessArgs(args); bool collecting = false; StringBuilder textbuilder = new StringBuilder(); StringBuilder headerbuilder = new StringBuilder(); foreach (string s in args) { if (s == "--text") { collecting = true; continue; } else if (s.StartsWith("--") && collecting) { collecting = false; } if (collecting) { textbuilder.Append(s + " "); } } options.text = textbuilder.ToString(); foreach (string s in args) { if (s == "--header") { collecting = true; continue; } else if (s.StartsWith("--") && collecting) { collecting = false; } if (collecting) { headerbuilder.Append(s + " "); } } options.header = headerbuilder.ToString(); if (args.Length == 0) { options.DoHelp(); Environment.Exit(1); } //We are receiving html if (options.html) { NotificationSource sourceType = NotificationSource.Url; string source = null; if (options.content != null) { sourceType = NotificationSource.Text; source = options.content; } else if (options.file != null) { sourceType = NotificationSource.File; source = options.file; } else if (options.url != null) { sourceType = NotificationSource.Url; source = options.url; } else { options.DoHelp(); } NotificationFactory.ShowHtmlNotification(source, sourceType, options.width, options.height, options.timeout, new TimerEndedHandler(TimerEnded)); } // We are receiving svg else if (options.svg) { if (options.file != null) { NotificationFactory.ShowSvgNotification(options.file, options.header, options.text, options.width, options.height, options.timeout, new TimerEndedHandler(TimerEnded)); } else if (options.warning) { ShowStandardMsg(NotificationType.Warning, options); } else if (options.info) { ShowStandardMsg(NotificationType.Info, options); } else if (options.error) { ShowStandardMsg(NotificationType.Error, options); } else { options.DoHelp(); } } else { options.DoHelp(); } Application.Run(); }
public NotificationModule(NotificationFactory notificationFactory) : base(notificationFactory, "notification", ResourceMapper) { }
public void CheckAndSendNotifications() { MoodServer server = this.db.Get <MoodServer>().Where(s => s.Name.Equals(Configuration.WebConfiguration.ServerName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); if (server != null && server.CanPushClientNotifcations) { //todo check if server can send push var now = DateTime.UtcNow; var notifications = this.db.Get <PushNotification>().Where(p => p.Sent == false && p.SendDate <= now).OrderBy(p => p.SendDate); if (notifications.Any()) { //Create our service PushService push = new PushService(); //Wire up the events push.Events.OnNotificationSendFailure += new PushSharp.Common.ChannelEvents.NotificationSendFailureDelegate(Events_OnNotificationSendFailure); push.Events.OnNotificationSent += new PushSharp.Common.ChannelEvents.NotificationSentDelegate(Events_OnNotificationSent); //Configure and start Apple APNS // IMPORTANT: Make sure you use the right Push certificate. Apple allows you to generate one for connecting to Sandbox, // and one for connecting to Production. You must use the right one, to match the provisioning profile you build your // app with! //var appleCert = File.ReadAllBytes(Configuration.WebConfiguration.APNSCertificatePath); var appleCert = new X509Certificate2(File.ReadAllBytes(Configuration.WebConfiguration.APNSCertificatePath), "d1scov3r!", X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet); //IMPORTANT: If you are using a Development provisioning Profile, you must use the Sandbox push notification server // (so you would leave the first arg in the ctor of ApplePushChannelSettings as 'false') // If you are using an AdHoc or AppStore provisioning profile, you must use the Production push notification server // (so you would change the first arg in the ctor of ApplePushChannelSettings to 'true') //push.StartApplePushService(new ApplePushChannelSettings(appleCert, "d1scov3r!")); push.StartApplePushService(new ApplePushChannelSettings(appleCert)); foreach (var notification in notifications) { this.logger.Info(this.GetType(), string.Format("Sending APNS notification - {0}", notification.Message)); //set sent first so doesn't repeat if goes wrong notification.Sent = true; var recipients = this.db.Get <Responder>().Where(r => r.Event.Id == notification.Event.Id); foreach (var recipient in recipients) { //Fluent construction of an iOS notification //IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets generated within your iOS app itself when the Application Delegate // for registered for remote notifications is called, and the device token is passed back to you push.QueueNotification(NotificationFactory.Apple() .ForDeviceToken(recipient.DeviceId) .WithAlert(notification.Message) .WithSound(notification.PlaySound ? "default" : "") ); } } this.db.SaveChanges(); //Stop and wait for the queues to drains push.StopAllServices(true); } } }
/// <summary> /// Refreshes as specified by a payload. /// </summary> /// <param name="payloads">The payload.</param> public virtual void Refresh(TPayload[] payloads) { OnCacheUpdated(NotificationFactory.Create <TNotification>(payloads, MessageType.RefreshByPayload)); }