Пример #1
0
        public ApplePushService(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
            : base(channelSettings, serviceSettings)
        {
            cancelTokenSource = new CancellationTokenSource();
            feedbackService = new FeedbackService();
            feedbackService.OnFeedbackReceived += new FeedbackService.FeedbackReceivedDelegate(feedbackService_OnFeedbackReceived);
            timerFeedback = new Timer(new TimerCallback((state) =>
            {
                feedbackService.Run(channelSettings as ApplePushChannelSettings, this.cancelTokenSource.Token);

                //Timer will run first after 10 seconds, then every 10 minutes to get feedback!
            }),null, TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(10));
        }
Пример #2
0
        public PushChannelBase(PushChannelSettings channelSettings, PushServiceSettings serviceSettings)
        {
            this.stopping = false;
            //this.CancelTokenSource = new CancellationTokenSource();
            //this.CancelToken = CancelTokenSource.Token;

            this.queuedNotifications = new Queue <Notification>();

            this.ChannelSettings = channelSettings;
            this.ServiceSettings = serviceSettings ?? new PushServiceSettings();

            //Start our sending task
            taskSender = new Thread(new ThreadStart(Sender));
            taskSender.Start();
        }
Пример #3
0
        public PushChannelBase(PushChannelSettings settings)
        {
            this.stopping = false;
            this.CancelTokenSource = new CancellationTokenSource();
            this.CancelToken = CancelTokenSource.Token;

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

            this.Settings = settings;

            //Start our sending task
            taskSender = new Task(() => Sender(), TaskCreationOptions.LongRunning);
            taskSender.ContinueWith((t) => { var ex = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted);
            taskSender.Start();
        }
Пример #4
0
        public PushChannelBase(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
        {
            this.stopping          = false;
            this.CancelTokenSource = new CancellationTokenSource();
            this.CancelToken       = CancelTokenSource.Token;

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

            this.ChannelSettings = channelSettings;
            this.ServiceSettings = serviceSettings ?? new PushServiceSettings();

            //Start our sending task
            taskSender = new Task(() => Sender(), TaskCreationOptions.LongRunning);
            taskSender.ContinueWith((t) => { var ex = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted);
            taskSender.Start();
        }
Пример #5
0
        public PushChannelBase(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
        {
            this.stopping = false;
            this.CancelTokenSource = new CancellationTokenSource();
            this.CancelToken = CancelTokenSource.Token;

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

            this.ChannelSettings = channelSettings;
            this.ServiceSettings = serviceSettings ?? new PushServiceSettings();
            this.waitQueuedNotification = new ManualResetEventSlim();

            //Start our sending task
            taskSender = new Task(Sender, TaskCreationOptions.LongRunning);
            taskSender.ContinueWith((t) => { var ex = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted);
            taskSender.Start();
        }
Пример #6
0
        public ApplePushService(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
            : base(channelSettings, serviceSettings)
        {
            var appleChannelSettings = channelSettings as ApplePushChannelSettings;
            cancelTokenSource = new CancellationTokenSource();
            feedbackService = new FeedbackService();
            feedbackService.OnFeedbackReceived += new FeedbackService.FeedbackReceivedDelegate(feedbackService_OnFeedbackReceived);

            //allow control over feedback call interval, if set to zero, don't make feedback calls automatically
            if (appleChannelSettings.FeedbackIntervalMinutes > 0)
            {
                timerFeedback = new Timer(new TimerCallback((state) =>
                {
                    try { feedbackService.Run(channelSettings as ApplePushChannelSettings, this.cancelTokenSource.Token); }
                    catch (Exception ex) { this.Events.RaiseChannelException(ex); }

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

            }
        }
Пример #7
0
        public PushServiceBase(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
        {
            this.ServiceSettings = serviceSettings ?? new PushServiceSettings();
            this.ChannelSettings = channelSettings;

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

            timerCheckScale = new Timer(new TimerCallback((state) =>
            {
                CheckScale();
            }), null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));

            CheckScale();

            distributerTask = new Task(Distributer, TaskCreationOptions.LongRunning);
            distributerTask.ContinueWith((ft) =>
            {
                var ex = ft.Exception;

            }, TaskContinuationOptions.OnlyOnFaulted);
            distributerTask.Start();

            stopping = false;
        }
 protected override PushChannelBase CreateChannel(PushChannelSettings channelSettings)
 {
     return(new WindowsPhonePushChannel(channelSettings as WindowsPhonePushChannelSettings));
 }
Пример #9
0
 protected override PushChannelBase CreateChannel(PushChannelSettings channelSettings)
 {
     return new AndroidPushChannel(channelSettings as AndroidPushChannelSettings);
 }
Пример #10
0
 public PushChannelBase(PushChannelSettings channelSettings) : this(channelSettings, null)
 {
 }
Пример #11
0
 protected override PushChannelBase CreateChannel(PushChannelSettings channelSettings)
 {
     return(new GcmPushChannel(channelSettings as GcmPushChannelSettings));
 }
Пример #12
0
 protected override PushChannelBase CreateChannel(PushChannelSettings channelSettings)
 {
     return new WindowsPhonePushChannel(channelSettings as WindowsPhonePushChannelSettings);
 }
Пример #13
0
 public WindowsPhonePushService(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
     : base(channelSettings, serviceSettings)
 {
 }
Пример #14
0
 protected abstract PushChannelBase CreateChannel(PushChannelSettings channelSettings);
Пример #15
0
 public TestablePushService(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
     : base(channelSettings, serviceSettings)
 {
 }
Пример #16
0
 public AndroidPushService(PushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
     : base(channelSettings, serviceSettings)
 {
 }
Пример #17
0
 protected override PushChannelBase CreateChannel(PushChannelSettings channelSettings)
 {
     return new GcmPushChannel(channelSettings as GcmPushChannelSettings);
 }
Пример #18
0
 protected abstract PushChannelBase CreateChannel(PushChannelSettings channelSettings);