Пример #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;
		}
Пример #2
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;
        }
Пример #3
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;
        }
Пример #4
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;
 }
Пример #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(5), TimeSpan.FromSeconds(5));

            CheckScale();

            stopping = false;
        }
Пример #6
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;
        }
Пример #7
0
 public FacebookPushService(IPushChannelFactory pushChannelFactory, FacebookPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Пример #8
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BisPushChannelFactory(), channelSettings ?? new BlackberryPushChannelSettings(), serviceSettings)
 {
 }
Пример #9
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Пример #10
0
 public BISPushService(IPushChannelFactory pushChannelFactory, BISPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BISPushChannelFactory(), channelSettings ?? new BISPushChannelSettings(), serviceSettings)
 {
 }
Пример #11
0
		public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings)
			: this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
		{
		}
Пример #12
0
		public GcmPushService(IPushChannelFactory pushChannelFactory, GcmPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: base(pushChannelFactory ?? new GcmPushChannelFactory(), channelSettings, serviceSettings)
		{
		}
Пример #13
0
 public WindowsPhonePushService(IPushChannelFactory pushChannelFactory, WindowsPhonePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new WindowsPhonePushChannelFactory(), channelSettings ?? new WindowsPhonePushChannelSettings(), serviceSettings)
 {
 }
Пример #14
0
 public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, (IPushServiceSettings)null)
 {
 }
Пример #15
0
 public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FirefoxOSPushService"/> class.
 /// </summary>
 ///
 /// <param name="pushChannelFactory">Channel factory.</param>
 public FirefoxOSPushService(IPushChannelFactory pushChannelFactory)
     : base(pushChannelFactory ?? new FirefoxOSPushChannelFactory(), default(IPushChannelSettings), default(IPushServiceSettings))
 {
 }
Пример #17
0
 public FacebookPushService(IPushChannelFactory pushChannelFactory, FacebookPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new FacebookPushChannelFactory(), channelSettings, serviceSettings)
 {
 }
Пример #18
0
 public GcmPushService(IPushChannelFactory pushChannelFactory, GcmPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new GcmPushChannelFactory(), channelSettings, serviceSettings)
 {
 }
Пример #19
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BisPushChannelFactory(), channelSettings ?? new BlackberryPushChannelSettings(), serviceSettings)
 {
 }
Пример #20
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Пример #21
0
 protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, (IPushServiceSettings)null)
 {
 }
Пример #22
0
 protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Пример #23
0
		public WindowsPushService(IPushChannelFactory pushChannelFactory, WindowsPushChannelSettings channelSettings)
			: this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
		{
		}
Пример #24
0
 protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Пример #25
0
		public WindowsPushService(IPushChannelFactory pushChannelFactory, WindowsPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: base(pushChannelFactory ?? new WindowsPushChannelFactory(), channelSettings, serviceSettings)
		{ }
Пример #26
0
 public WindowsPhonePushService(IPushChannelFactory pushChannelFactory, WindowsPhonePushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Пример #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FirefoxOSPushService"/> class.
 /// </summary>
 /// 
 /// <param name="pushChannelFactory">Channel factory.</param>
 public FirefoxOSPushService(IPushChannelFactory pushChannelFactory)
     : base(pushChannelFactory ?? new FirefoxOSPushChannelFactory(), default(IPushChannelSettings), default(IPushServiceSettings)) { }