Exemplo n.º 1
0
 public Lounge(HYPInstance masterInstance)
 {
     Id             = masterInstance.StringIdentifier;
     MasterInstance = masterInstance;
     Loungers       = new List <Lounger>();
     Loungers.Add(new Lounger(masterInstance));
     Active = true;
 }
Exemplo n.º 2
0
 public override void DidLoseInstance(HYP hype, HYPInstance instance, NSError error)
 {
     FoundInstances.Remove(instance.StringIdentifier);
     //Add the instance to the table view source.
     //((InstancesViewSource)view.loungesView.Source)?.RemoveItem(instance.StringIdentifier);
     Console.WriteLine(string.Format("Lost Instance : {0}. {1}", instance.StringIdentifier, error.DebugDescription));
     //HandleNSError(error, alertView);
 }
Exemplo n.º 3
0
        public void SendToInstance <T>(T objectToSend, HYPInstance instance, LoungeMessageType messageType) where T : class
        {
            if (instance == null)
            {
                return;
            }

            bool isList = IsInstanceOfGenericType(typeof(List <>), objectToSend);

            string serializedObject  = JsonConvert.SerializeObject(objectToSend);
            var    message           = new LoungeMessage(serializedObject, (int)messageType, isList);
            string serializedMessage = JsonConvert.SerializeObject(message);

            NSData data = NSData.FromString(serializedMessage, NSStringEncoding.UTF8);

            hype.SendData(data, instance);
        }
Exemplo n.º 4
0
            public override void DidFindInstance(HYP hype, HYPInstance instance)
            {
                FoundInstances.Add(instance.StringIdentifier, instance);
                if (view.FoundLounges.Count > 0)
                {
                    view.SendToInstance(view.FoundLounges.Values.ToList(), instance, LoungeMessageType.LoungeDiscovery);
                }
                //Add the instance to the table view source.
                //((InstancesViewSource)view.loungesView.Source)?.AddItem(instance);

                //var newData = NSData.FromString("You have a new message from : " + hype.DomesticInstance.StringIdentifier, NSStringEncoding.UTF8);
                //HYPMessage newMessage = hype.SendData(newData, instance);
                //Console.WriteLine(newMessage);
                Console.WriteLine("Found Instance : " + instance.StringIdentifier);
                alertView.Message = "Found Instance : " + instance.StringIdentifier;
                alertView.Show();
            }
Exemplo n.º 5
0
 public override void DidLoseInstance(HYP hype, HYPInstance instance, NSError error)
 {
     Console.WriteLine(error.DebugDescription);
 }
Exemplo n.º 6
0
 public override void DidFindInstance(HYP hype, HYPInstance instance)
 {
     Console.WriteLine(instance.StringIdentifier);
 }
Exemplo n.º 7
0
 public void RemoveItem(HYPInstance instance)
 {
     Instances.Remove(instance);
     TableView.ReloadData();
 }
Exemplo n.º 8
0
 public void AddItem(HYPInstance instance)
 {
     Instances.Add(instance);
     TableView.ReloadData();
 }
Exemplo n.º 9
0
 public LoungesTableViewSource(Dictionary <string, Lounge> lounges, UITableView tableView, HYPInstance hypeInstance)
 {
     LoungeDictionary = lounges;
     TableView        = tableView;
     ViewHypeInstance = hypeInstance;
 }
Exemplo n.º 10
0
 public override void DidReceiveMessage(HYP hype, HYPMessage message, HYPInstance instance)
 {
     view.DecodeReceivedMessage(message);
     alertView.Message = "message Received";
     alertView.Show();
 }
Exemplo n.º 11
0
 public override void DidFailSending(HYP hype, HYPMessage message, HYPInstance instance, NSError error)
 {
     alertView.Message = "Falied to Send Message - " + error.DebugDescription;
 }
Exemplo n.º 12
0
 public Lounger(HYPInstance instance)
 {
     Instance = instance;
     Id       = instance.StringIdentifier;
 }