Beispiel #1
0
        /// <summary>
        /// Registers an end-point for notifications based on a mobile device platform.
        /// </summary>
        /// <param name="platformType">The device platform.</param>
        /// <param name="notificationEndPoint">The end-point for the specific platform.</param>
        public void RegisterEndPoint(MobileDevicePlatformType platformType, IPushSharpNotificationEndPoint notificationEndPoint)
        {
            if (this.notificationEndPoints.ContainsKey(platformType))
            {
                throw new ArgumentException("Platform type (" + platformType + ") has already been registered.", nameof(platformType));
            }

            this.notificationEndPoints.Add(platformType, notificationEndPoint);
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the MobileDevice class.
        /// </summary>
        /// <param name="deviceId">A unique id for the device.</param>
        /// <param name="platformType">The type of platform used by the device.</param>
        /// <param name="appVersion">The version number for the application running on the device.</param>
        /// <param name="arePushNotificationsEnabled">A value indicating whether or not push notifications are enabled.</param>
        /// <param name="pushNotificationToken">A unique token identifying the device when sending push notifications.</param>
        public MobileDevice(
            string deviceId,
            MobileDevicePlatformType platformType,
            string appVersion,
            bool arePushNotificationsEnabled,
            string pushNotificationToken)
        {
            if (arePushNotificationsEnabled &&
                string.IsNullOrWhiteSpace(pushNotificationToken))
            {
                throw new ArgumentException("A push notification token must be specified if push notifications are enabled for the device.", nameof(pushNotificationToken));
            }

            this.DeviceId     = deviceId;
            this.PlatformType = platformType;
            this.AppVersion   = appVersion;
            this.ArePushNotificationsEnabled = arePushNotificationsEnabled;
            this.PushNotificationToken       = pushNotificationToken;
        }