コード例 #1
0
        private static PushBroker CreateBroker()
        {
            var broker = new PushBroker();

            broker.OnNotificationSent          += NotificationSent;
            broker.OnChannelException          += ChannelException;
            broker.OnServiceException          += ServiceException;
            broker.OnNotificationFailed        += NotificationFailed;
            broker.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
            broker.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
            broker.OnChannelCreated            += ChannelCreated;
            broker.OnChannelDestroyed          += ChannelDestroyed;

            foreach (var channel in PushBo.Instance.ActiveChannels)
            {
                if (channel.PlatformType == PlatformType.Apple)
                {
                    broker.RegisterAppleService(new ApplePushChannelSettings(ConfigHelp.Production, channel.Cert, channel.CertPassword), channel.ApplicationId);
                }
                else if (channel.PlatformType == PlatformType.Beyondbit)
                {
                    broker.RegisterPushClientService(new BeyondBitPushChannelSettings(channel.ApplicationId));
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            return(broker);
        }
コード例 #2
0
        private static PushBroker CreateBroker()
        {
            var broker = new PushBroker();

            broker.OnNotificationSent += NotificationSent;
            broker.OnChannelException += ChannelException;
            broker.OnServiceException += ServiceException;
            broker.OnNotificationFailed += NotificationFailed;
            broker.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
            broker.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
            broker.OnChannelCreated += ChannelCreated;
            broker.OnChannelDestroyed += ChannelDestroyed;

            foreach (var channel in PushBo.Instance.ActiveChannels)
            {
                if (channel.PlatformType == PlatformType.Apple)
                {
                    broker.RegisterAppleService(new ApplePushChannelSettings(ConfigHelp.Production, channel.Cert, channel.CertPassword), channel.ApplicationId);
                }
                else if (channel.PlatformType == PlatformType.Beyondbit)
                {
                    broker.RegisterPushClientService(new BeyondBitPushChannelSettings(channel.ApplicationId));
                }
                else throw new NotImplementedException();
            }

            return broker;
        }