public Lounge(HYPInstance masterInstance) { Id = masterInstance.StringIdentifier; MasterInstance = masterInstance; Loungers = new List <Lounger>(); Loungers.Add(new Lounger(masterInstance)); Active = true; }
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); }
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); }
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(); }
public override void DidLoseInstance(HYP hype, HYPInstance instance, NSError error) { Console.WriteLine(error.DebugDescription); }
public override void DidFindInstance(HYP hype, HYPInstance instance) { Console.WriteLine(instance.StringIdentifier); }
public void RemoveItem(HYPInstance instance) { Instances.Remove(instance); TableView.ReloadData(); }
public void AddItem(HYPInstance instance) { Instances.Add(instance); TableView.ReloadData(); }
public LoungesTableViewSource(Dictionary <string, Lounge> lounges, UITableView tableView, HYPInstance hypeInstance) { LoungeDictionary = lounges; TableView = tableView; ViewHypeInstance = hypeInstance; }
public override void DidReceiveMessage(HYP hype, HYPMessage message, HYPInstance instance) { view.DecodeReceivedMessage(message); alertView.Message = "message Received"; alertView.Show(); }
public override void DidFailSending(HYP hype, HYPMessage message, HYPInstance instance, NSError error) { alertView.Message = "Falied to Send Message - " + error.DebugDescription; }
public Lounger(HYPInstance instance) { Instance = instance; Id = instance.StringIdentifier; }