using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
//using System.ServiceModel.Web;
using System.Text;

namespace WP7PushNotification
{
    public delegate void NotificationURLChangedEventHandler(object sender, URLChangedEventArgs e);

    //WCF Dienst zum Empfangen der Benachrichtigungs-URL vom Gerät
    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single)]
    public class ReceiveNotificationURLService : IReceiveNotificationURLService
    {
        #region Ereigniserstellung, welche von der Form verwendet werden kann
        public event NotificationURLChangedEventHandler NotificationURLChanged;

        protected virtual void OnNotificationURLChanged(URLChangedEventArgs e)
        {
            if (NotificationURLChanged != null)
            {
                NotificationURLChanged(this, e);
            }
        }
        #endregion

        //WCF Dienstmethode, welche den Wert der URL erhält
        public void GetNotificationURL(string value)
        {
            URLChangedEventArgs e = new URLChangedEventArgs();
            e.NewURL = value;
            OnNotificationURLChanged(e);
        }
    }
}
