Exemplo n.º 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;
		}
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
 }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 7
0
 public FacebookPushService(IPushChannelFactory pushChannelFactory, FacebookPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Exemplo n.º 8
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BisPushChannelFactory(), channelSettings ?? new BlackberryPushChannelSettings(), serviceSettings)
 {
 }
Exemplo n.º 9
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Exemplo n.º 10
0
 public BISPushService(IPushChannelFactory pushChannelFactory, BISPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BISPushChannelFactory(), channelSettings ?? new BISPushChannelSettings(), serviceSettings)
 {
 }
Exemplo n.º 11
0
		public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings)
			: this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
		{
		}
Exemplo n.º 12
0
		public GcmPushService(IPushChannelFactory pushChannelFactory, GcmPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: base(pushChannelFactory ?? new GcmPushChannelFactory(), channelSettings, serviceSettings)
		{
		}
Exemplo n.º 13
0
 public WindowsPhonePushService(IPushChannelFactory pushChannelFactory, WindowsPhonePushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new WindowsPhonePushChannelFactory(), channelSettings ?? new WindowsPhonePushChannelSettings(), serviceSettings)
 {
 }
Exemplo n.º 14
0
 public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, (IPushServiceSettings)null)
 {
 }
Exemplo n.º 15
0
 public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Exemplo n.º 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))
 {
 }
Exemplo n.º 17
0
 public FacebookPushService(IPushChannelFactory pushChannelFactory, FacebookPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new FacebookPushChannelFactory(), channelSettings, serviceSettings)
 {
 }
Exemplo n.º 18
0
 public GcmPushService(IPushChannelFactory pushChannelFactory, GcmPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new GcmPushChannelFactory(), channelSettings, serviceSettings)
 {
 }
Exemplo n.º 19
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
     : base(pushChannelFactory ?? new BisPushChannelFactory(), channelSettings ?? new BlackberryPushChannelSettings(), serviceSettings)
 {
 }
Exemplo n.º 20
0
 public BlackberryPushService(IPushChannelFactory pushChannelFactory, BlackberryPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Exemplo n.º 21
0
 protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, (IPushServiceSettings)null)
 {
 }
Exemplo n.º 22
0
 protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Exemplo n.º 23
0
		public WindowsPushService(IPushChannelFactory pushChannelFactory, WindowsPushChannelSettings channelSettings)
			: this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
		{
		}
Exemplo n.º 24
0
 protected PushServiceBase(IPushChannelFactory pushChannelFactory, IPushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Exemplo n.º 25
0
		public WindowsPushService(IPushChannelFactory pushChannelFactory, WindowsPushChannelSettings channelSettings, IPushServiceSettings serviceSettings)
			: base(pushChannelFactory ?? new WindowsPushChannelFactory(), channelSettings, serviceSettings)
		{ }
Exemplo n.º 26
0
 public WindowsPhonePushService(IPushChannelFactory pushChannelFactory, WindowsPhonePushChannelSettings channelSettings)
     : this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
 {
 }
Exemplo n.º 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)) { }