Пример #1
0
        private void SendMessage()
        {
            NotifierFactory notifierFactory = new NotifierFactory();
            NotifierBase    notifier        = notifierFactory.GetNotifier(NotificationServerOption.LegacyHTTP, GetNotificationProps());

            if (devicetokenRadioBtn.Checked)
            {
                notifier.SendPushNotificationForSpecificDevice();
            }
            else
            {
                notifier.SendPushNotificationForTopic();
            }
        }
Пример #2
0
        private void ShowJsonData()
        {
            NotifierFactory notifierFactory = new NotifierFactory();
            NotifierBase    notifier        = notifierFactory.GetNotifier(NotificationServerOption.LegacyHTTP, GetNotificationProps());
            string          jsonData;

            if (devicetokenRadioBtn.Checked)
            {
                jsonData = notifier.CreateNotificationMessageForSpecificDevice();
            }
            else
            {
                jsonData = notifier.CreateNotificationMessageForTopic();
            }
            jsonDataTextBox.Text = BeautifyJsonData(jsonData);
        }
        public void SendNotification(Notification notification, GeneralOptions options)
        {
            var notifierFactory = new NotifierFactory(this, options);
            var notifierType    = options.Common.NotifierType;

            var notifier = notifierFactory.GetNotifier(notifierType);

            try
            {
                _logger.Info($"Sending notification using {notifierType.ToString()} notifier");
                notifier.Send(notification);
                _logger.Info("Notification sent");
            }
            catch (Exception exception)
            {
                _exceptionHandler.Handle(exception);
            }
        }