Пример #1
0
		public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: base(pushChannelFactory ?? new ApplePushChannelFactory(), channelSettings, serviceSettings)
		{
			var appleChannelSettings = channelSettings;
			cancelTokenSource = new CancellationTokenSource();

			//allow control over feedback call interval, if set to zero, don't make feedback calls automatically
			if (appleChannelSettings.FeedbackIntervalMinutes > 0)
			{
				feedbackService = new FeedbackService();
				feedbackService.OnFeedbackReceived += feedbackService_OnFeedbackReceived;
				feedbackService.OnFeedbackException += (Exception ex) => this.RaiseServiceException (ex);

				if (timerFeedback == null)
				{
					timerFeedback = new Timer(new TimerCallback((state) =>
					{
						try { feedbackService.Run(channelSettings as ApplePushChannelSettings, this.cancelTokenSource.Token); }
						catch (Exception ex) { base.RaiseServiceException(ex); }

						//Timer will run first after 10 seconds, then every 10 minutes to get feedback!
					}), null, TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(appleChannelSettings.FeedbackIntervalMinutes));
				}
			}

			//Apple has documented that they only want us to use 20 connections to them
			base.ServiceSettings.MaxAutoScaleChannels = 20;
		}
		public static void RegisterWindowsService(this IPushBroker broker, WindowsPushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
		{
			var service = new WindowsPushService(new WindowsPushChannelFactory(), channelSettings, serviceSettings);

			broker.RegisterService<WindowsRawNotification>(service, applicationId);
			broker.RegisterService<WindowsTileNotification>(service, applicationId);
			broker.RegisterService<WindowsToastNotification>(service, applicationId);
			broker.RegisterService<WindowsBadgeNumericNotification>(service, applicationId);
			broker.RegisterService<WindowsBadgeGlyphNotification>(service, applicationId);
		}
		public static void RegisterWindowsPhoneService(this PushBroker broker, WindowsPhonePushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
		{
			var service = new WindowsPhonePushService(new WindowsPhonePushChannelFactory(), channelSettings, serviceSettings);

			broker.RegisterService<WindowsPhoneCycleTileNotification>(service, applicationId);
			broker.RegisterService<WindowsPhoneFlipTileNotification>(service, applicationId);
			broker.RegisterService<WindowsPhoneIconicTileNotification>(service, applicationId);
			broker.RegisterService<WindowsPhoneTileNotification>(service, applicationId);
			broker.RegisterService<WindowsPhoneToastNotification>(service, applicationId);
			broker.RegisterService<WindowsPhoneRawNotification>(service, applicationId);
		}
Пример #4
0
        protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings,
                                  IPushServiceSettings serviceSettings)
        {
            this.PushChannelFactory = pushChannelFactory;
            this.ServiceSettings    = serviceSettings ?? new PushServiceSettings();
            this.ChannelSettings    = channelSettings;

            this.queuedNotifications = new ConcurrentQueue <INotification>();

            timerCheckScale = new Timer(CheckScale, null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5));

            CheckScale();

            stopping = false;
        }
Пример #5
0
        protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings,
		                          IPushServiceSettings serviceSettings)
        {
            this.PushChannelFactory = pushChannelFactory;
            this.ServiceSettings = serviceSettings ?? new PushServiceSettings();
            this.ChannelSettings = channelSettings;

            this.queuedNotifications = new ConcurrentQueue<INotification>();

            timerCheckScale = new Timer(CheckScale, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));

            CheckScale();

            stopping = false;
        }
Пример #6
0
		public static void RegisterC2dmService(this IPushBroker broker, C2dmPushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
		{
			broker.RegisterService<C2dmNotification>(new C2dmPushService(channelSettings, serviceSettings), applicationId);
		}
Пример #7
0
 public ApplePushService(ApplePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : this((IPushChannelFactory)null, channelSettings, serviceSettings)
 {
 }
		public static void RegisterChromeGcmService(this PushBroker broker, ChromePushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
		{
			RegisterChromeGcmService (broker, channelSettings, null, serviceSettings);
		}
Пример #9
0
		public GcmPushService(IPushChannelFactory pushChannelFactory, GcmPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: base(pushChannelFactory ?? new GcmPushChannelFactory(), channelSettings, serviceSettings)
		{
		}
Пример #10
0
        public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
            : base(pushChannelFactory ?? (IPushChannelFactory) new ApplePushChannelFactory(), (IPushChannelSettings)channelSettings, serviceSettings)
        {
            ApplePushService         applePushService    = this;
            ApplePushChannelSettings pushChannelSettings = channelSettings;

            this.cancelTokenSource = new CancellationTokenSource();
            if (pushChannelSettings.FeedbackIntervalMinutes > 0)
            {
                this.feedbackService = new FeedbackService();
                this.feedbackService.OnFeedbackReceived  += new FeedbackService.FeedbackReceivedDelegate(this.feedbackService_OnFeedbackReceived);
                this.feedbackService.OnFeedbackException += (FeedbackService.FeedbackExceptionDelegate)(ex => applePushService.RaiseServiceException(ex));
                if (this.timerFeedback == null)
                {
                    this.timerFeedback = new Timer((TimerCallback)(state =>
                    {
                        try
                        {
                            applePushService.feedbackService.Run(channelSettings, applePushService.cancelTokenSource.Token);
                        }
                        catch (Exception ex)
                        {
                            applePushService.RaiseServiceException(ex);
                        }
                    }), (object)null, TimeSpan.FromSeconds(10.0), TimeSpan.FromMinutes((double)pushChannelSettings.FeedbackIntervalMinutes));
                }
            }
            this.ServiceSettings.MaxAutoScaleChannels = 20;
        }
		public static void RegisterWindowsPhoneService(this PushBroker broker, WindowsPhonePushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
		{
			RegisterWindowsPhoneService (broker, channelSettings, null, serviceSettings);
		}
Пример #12
0
 public static void RegisterAppleService(this PushBroker broker, ApplePushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService <AppleNotification>(new ApplePushService(channelSettings, serviceSettings), applicationId);
 }
Пример #13
0
 public static void RegisterGcmService(this PushBroker broker, GcmPushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService <GcmNotification>(new GcmPushService(new GcmPushChannelFactory(), channelSettings, serviceSettings), applicationId);
 }
Пример #14
0
 protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
 {
     this.PushChannelFactory  = pushChannelFactory;
     this.ServiceSettings     = serviceSettings ?? (IPushServiceSettings) new PushServiceSettings();
     this.ChannelSettings     = channelSettings;
     this.queuedNotifications = new NotificationQueue();
     this.scaleSync           = 0;
     this.timerCheckScale     = new Timer(new TimerCallback(this.CheckScale), (object)null, TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0));
     this.CheckScale((object)null);
     this.stopping = false;
 }
Пример #15
0
 public BISPushService(IPushChannelFactory pushChannelFactory, BISPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BISPushChannelFactory(), channelSettings ?? new BISPushChannelSettings(), serviceSettings)
 {
 }
Пример #16
0
 public static void RegisterC2dmService(this IPushBroker broker, C2dmPushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService <C2dmNotification>(new C2dmPushService(channelSettings, serviceSettings), applicationId);
 }
Пример #17
0
 public static void RegisterAdmService(this IPushBroker broker, AdmPushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService <AdmNotification>(new AdmPushService(new AdmPushChannelFactory(), channelSettings, serviceSettings));
 }
Пример #18
0
 public static void RegisterBlackberryService(this PushBroker broker, BlackberryPushChannelSettings channelSettings, string applicationId = null, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService <BlackberryNotification>(new BlackberryPushService(channelSettings, serviceSettings), applicationId);
 }
Пример #19
0
        public static void RegisterWindowsService(this IPushBroker broker, WindowsPushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
        {
            var service = new WindowsPushService(new WindowsPushChannelFactory(), channelSettings, serviceSettings);

            broker.RegisterService <WindowsRawNotification>(service, applicationId);
            broker.RegisterService <WindowsTileNotification>(service, applicationId);
            broker.RegisterService <WindowsToastNotification>(service, applicationId);
            broker.RegisterService <WindowsBadgeNumericNotification>(service, applicationId);
            broker.RegisterService <WindowsBadgeGlyphNotification>(service, applicationId);
        }
Пример #20
0
 public static void RegisterChromeGcmService(this IPushBroker broker, ChromePushChannelSettings channelSettings, string applicationId = null, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService <ChromeNotification>(new ChromePushService(channelSettings, serviceSettings), applicationId);
 }
Пример #21
0
 public BlackberryPushService(BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : this(default(IPushChannelFactory), channelSettings, serviceSettings)
 {
 }
		public static void RegisterWindowsPhoneService(this PushBroker broker, string applicationId, IPushServiceSettings serviceSettings = null)
		{
			RegisterWindowsPhoneService (broker, null, applicationId, serviceSettings);
		}
Пример #23
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BisPushChannelFactory(), channelSettings ?? new BlackberryPushChannelSettings(), serviceSettings)
 {
 }
Пример #24
0
 public ApplePushService(ApplePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : this(default(IPushChannelFactory), channelSettings, serviceSettings)
 {
 }
Пример #25
0
 public GcmPushService(IPushChannelFactory pushChannelFactory, GcmPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new GcmPushChannelFactory(), channelSettings, serviceSettings)
 {
 }
		public static void RegisterBlackberryService(this PushBroker broker, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
		{
			RegisterBlackberryService (broker, channelSettings, null, serviceSettings);
		}
Пример #27
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BisPushChannelFactory(), channelSettings ?? new BlackberryPushChannelSettings(), serviceSettings)
 {
 }
 public static void RegisterChromeGcmService(this PushBroker broker, ChromePushChannelSettings channelSettings, string applicationId = null, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService<ChromeNotification>(new ChromePushService(channelSettings, serviceSettings), applicationId);
 }
Пример #29
0
		public static void RegisterAdmService(this IPushBroker broker, AdmPushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
		{
			RegisterAdmService (broker, channelSettings, null, serviceSettings);
		}
Пример #30
0
		public ApplePushService(ApplePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: this(default(IPushChannelFactory), channelSettings, serviceSettings)
		{
		}
Пример #31
0
 public FacebookPushService(FacebookPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : this(default(IPushChannelFactory), channelSettings, serviceSettings)
 {
 }
Пример #32
0
 public BlackberryPushService(BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : this(default(IPushChannelFactory), channelSettings, serviceSettings)
 {
 }
Пример #33
0
 public static void RegisterBISService(this PushBroker broker, BISPushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService <BISNotification>(new BISPushService(channelSettings, serviceSettings));
 }
Пример #34
0
		public static void RegisterAppleService(this PushBroker broker, ApplePushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
		{
			broker.RegisterService<AppleNotification>(new ApplePushService(channelSettings, serviceSettings), applicationId);
		}
Пример #35
0
		public WindowsPushService(WindowsPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: this(default(IPushChannelFactory), channelSettings, serviceSettings)
		{
		}
Пример #36
0
 public static void RegisterAdmService(this IPushBroker broker, AdmPushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
 {
     broker.RegisterService<AdmNotification>(new AdmPushService(new AdmPushChannelFactory(), channelSettings, serviceSettings));
 }
Пример #37
0
		public WindowsPushService(IPushChannelFactory pushChannelFactory, WindowsPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: base(pushChannelFactory ?? new WindowsPushChannelFactory(), channelSettings, serviceSettings)
		{ }
Пример #38
0
 public FacebookPushService(IPushChannelFactory pushChannelFactory, FacebookPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new FacebookPushChannelFactory(), channelSettings, serviceSettings)
 {
 }
Пример #39
0
 public WindowsPhonePushService(WindowsPhonePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : this(default(IPushChannelFactory), channelSettings, serviceSettings)
 {
 }
Пример #40
0
 public static void RegisterBlackberryService(this PushBroker broker, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
 {
     RegisterBlackberryService(broker, channelSettings, null, serviceSettings);
 }
Пример #41
0
 public WindowsPhonePushService(IPushChannelFactory pushChannelFactory, WindowsPhonePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new WindowsPhonePushChannelFactory(), channelSettings ?? new WindowsPhonePushChannelSettings(), serviceSettings)
 {
 }
Пример #42
0
 public static void RegisterChromeGcmService(this IPushBroker broker, ChromePushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
 {
     RegisterChromeGcmService(broker, channelSettings, null, serviceSettings);
 }
 public static void RegisterWindowsPhoneService(this PushBroker broker, string applicationId, IPushServiceSettings serviceSettings = null)
 {
     RegisterWindowsPhoneService(broker, null, applicationId, serviceSettings);
 }
Пример #44
0
 public static void RegisterAppleService(this PushBroker broker, ApplePushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
 {
     RegisterAppleService(broker, channelSettings, null, serviceSettings);
 }
 public static void RegisterWindowsPhoneService(this PushBroker broker, IPushServiceSettings serviceSettings = null)
 {
     RegisterWindowsPhoneService(broker, null, null, serviceSettings);
 }
		public static void RegisterWindowsPhoneService(this PushBroker broker, IPushServiceSettings serviceSettings = null)
		{
			RegisterWindowsPhoneService (broker, null, null, serviceSettings);
		}
 public static void RegisterWindowsPhoneService(this PushBroker broker, WindowsPhonePushChannelSettings channelSettings, IPushServiceSettings serviceSettings = null)
 {
     RegisterWindowsPhoneService(broker, channelSettings, null, serviceSettings);
 }
        public static void RegisterWindowsPhoneService(this PushBroker broker, WindowsPhonePushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
        {
            var service = new WindowsPhonePushService(new WindowsPhonePushChannelFactory(), channelSettings, serviceSettings);

            broker.RegisterService <WindowsPhoneCycleTileNotification>(service, applicationId);
            broker.RegisterService <WindowsPhoneFlipTileNotification>(service, applicationId);
            broker.RegisterService <WindowsPhoneIconicTileNotification>(service, applicationId);
            broker.RegisterService <WindowsPhoneTileNotification>(service, applicationId);
            broker.RegisterService <WindowsPhoneToastNotification>(service, applicationId);
            broker.RegisterService <WindowsPhoneRawNotification>(service, applicationId);
        }
		public static void RegisterBlackberryService(this PushBroker broker, BlackberryPushChannelSettings channelSettings, string applicationId = null, IPushServiceSettings serviceSettings = null)
		{
			broker.RegisterService<BlackberryNotification>(new BlackberryPushService(channelSettings, serviceSettings), applicationId);
		}
Пример #50
0
        public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
            : base(pushChannelFactory ?? new ApplePushChannelFactory(), channelSettings, serviceSettings)
        {
            var appleChannelSettings = channelSettings;

            cancelTokenSource = new CancellationTokenSource();

            //allow control over feedback call interval, if set to zero, don't make feedback calls automatically
            if (appleChannelSettings.FeedbackIntervalMinutes > 0)
            {
                feedbackService = new FeedbackService();
                feedbackService.OnFeedbackReceived  += feedbackService_OnFeedbackReceived;
                feedbackService.OnFeedbackException += (Exception ex) => this.RaiseServiceException(ex);

                if (timerFeedback == null)
                {
                    timerFeedback = new Timer(new TimerCallback((state) =>
                    {
                        try { feedbackService.Run(channelSettings as ApplePushChannelSettings, this.cancelTokenSource.Token); }
                        catch (Exception ex) { base.RaiseServiceException(ex); }

                        //Timer will run first after 10 seconds, then every 10 minutes to get feedback!
                    }), null, TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(appleChannelSettings.FeedbackIntervalMinutes));
                }
            }

            //Apple has documented that they only want us to use 20 connections to them
            base.ServiceSettings.MaxAutoScaleChannels = 20;
        }
Пример #51
0
		public static void RegisterGcmService(this PushBroker broker, GcmPushChannelSettings channelSettings, string applicationId, IPushServiceSettings serviceSettings = null)
		{
			broker.RegisterService<GcmNotification>(new GcmPushService(new GcmPushChannelFactory(), channelSettings, serviceSettings), applicationId);
		}