public Abstract_PhoneReference CreateNewPhoneReference(Abstract_Phone phoneObject)
 {
     Abstract_PhoneReference phoneRecord = new Abstract_PhoneReference(phoneObject.id);
     Connection connectionString = new Connection(phoneObject);
     phoneRecord.connection = connectionString;
     PhoneList.Add(phoneRecord);
     return phoneRecord;
 }
        public Abstract_PhoneReference CreateNewPhoneReference(Abstract_Phone phoneObject)
        {
            Abstract_PhoneReference phoneRecord = new Abstract_PhoneReference(phoneObject.id);
            Connection connectionString         = new Connection(phoneObject);

            phoneRecord.connection = connectionString;
            PhoneList.Add(phoneRecord);
            return(phoneRecord);
        }
        public string GetCurrentSubscriptionList(Server server, Abstract_Phone phone)
        {
            Abstract_PhoneReference PhoneReference = server.GetPhoneReference(phone.id);

            if (PhoneReference != null)
            {
                return(PhoneReference.subsciptions.GetSubscriptions());
            }
            else
            {
                return("This phone is not currently subscribed to this server.");
            }
        }
        public string GetAllSubscribedContent(Server server, Abstract_Phone phone)
        {
            Abstract_PhoneReference PhoneReference = server.GetPhoneReference(phone.id);

            if (PhoneReference != null)
            {
                return(server.GetAllSubscribedContent(PhoneReference));
            }
            else
            {
                return("This phone is not currently subscribed to this server.");
            }
        }
        public Abstract_PhoneReference GetPhoneReference(string PhoneID)
        {
            Abstract_PhoneReference phoneRecord = null;

            foreach (Abstract_PhoneReference phoneReference in this.PhoneList)
            {
                if (phoneReference.PhoneID == PhoneID)
                {
                    phoneRecord = phoneReference;
                    break;
                }
            }
            return(phoneRecord);
        }
        public void SubscribePhoneToServer(Server server, Abstract_Phone phone, string NewsFeedName)
        {
            Abstract_NewsFeed NewsFeed = server.GetNewsFeed(NewsFeedName);

            if (NewsFeed != null)
            {
                Abstract_PhoneReference PhoneReference = server.GetPhoneReference(phone.id);
                if (PhoneReference == null)
                {
                    PhoneReference = server.CreateNewPhoneReference(phone);
                }
                server.SubscribePhoneToFeed(PhoneReference, NewsFeed);
            }
            else
            {
                phone.Notification("A " + NewsFeedName + " newsfeed does not exist.");
            }
        }
 public SubscriberFactory(Abstract_PhoneReference phoneReference,  Abstract_NewsFeed NewsFeedObject)
 {
     IObservable<bool> NewsFeedObserver = (IObservable<bool>)NewsFeedObject;
     switch (NewsFeedObject.FeedName)
     {
         case "Business":
             {
                 phoneReference.subsciptions = new Subscription_Business(phoneReference.subsciptions, NewsFeedObject);
                 phoneReference.subsciptions.Subscribe(NewsFeedObserver);
                 break;
             }
         case "Sports":
             {
                 phoneReference.subsciptions = new Subscription_Sports(phoneReference.subsciptions, NewsFeedObject);
                 phoneReference.subsciptions.Subscribe(NewsFeedObserver);
                 break;
             }
     }
 }
Example #8
0
        public SubscriberFactory(Abstract_PhoneReference phoneReference, Abstract_NewsFeed NewsFeedObject)
        {
            IObservable <bool> NewsFeedObserver = (IObservable <bool>)NewsFeedObject;

            switch (NewsFeedObject.FeedName)
            {
            case "Business":
            {
                phoneReference.subsciptions = new Subscription_Business(phoneReference.subsciptions, NewsFeedObject);
                phoneReference.subsciptions.Subscribe(NewsFeedObserver);
                break;
            }

            case "Sports":
            {
                phoneReference.subsciptions = new Subscription_Sports(phoneReference.subsciptions, NewsFeedObject);
                phoneReference.subsciptions.Subscribe(NewsFeedObserver);
                break;
            }
            }
        }
 public void SubscribePhoneToFeed(Abstract_PhoneReference phoneReference, Abstract_NewsFeed NewsFeed)
 {
     SubscriberFactory subscriber = new SubscriberFactory(phoneReference, NewsFeed);
 }
 public string GetAllSubscribedContent(Abstract_PhoneReference phoneReference)
 {
     return phoneReference.subsciptions.GetAllContent();
 }
 public string GetAllSubscribedContent(Abstract_PhoneReference phoneReference)
 {
     return(phoneReference.subsciptions.GetAllContent());
 }
 public void SubscribePhoneToFeed(Abstract_PhoneReference phoneReference, Abstract_NewsFeed NewsFeed)
 {
     SubscriberFactory subscriber = new SubscriberFactory(phoneReference, NewsFeed);
 }