public void DidRemoveService(HMHome home, HMService service, HMServiceGroup group)
 {
     if (ServiceGroup == group)
     {
         ReloadData();
     }
 }
Ejemplo n.º 2
0
        public void DidUpdateNameForService(HMAccessory accessory, HMService service)
        {
            var index = displayedServices.IndexOf(service);

            if (index >= 0)
            {
                var path = NSIndexPath.FromRowSection(index, (int)AccessoryTableViewSection.Services);
                TableView.ReloadRows(new [] { path }, UITableViewRowAnimation.Automatic);
            }
        }
Ejemplo n.º 3
0
        public void DidUpdateValueForCharacteristic(HMAccessory accessory, HMService service, HMCharacteristic characteristic)
        {
            var index = Array.IndexOf(service.Characteristics, characteristic);

            if (index >= 0)
            {
                var indexPath = NSIndexPath.FromRowSection(index, 0);
                var cell      = (CharacteristicCell)TableView.CellAt(indexPath);
                cell.SetValue(characteristic.Value, false);
            }
        }
		public CharacteristicsTableViewDataSource (HMService service, UITableView tableView, ICharacteristicCellDelegate @delegate, bool showsFavorites = false, bool allowsAllWrites = false)
		{
			Service = service;
			Delegate = @delegate;
			this.showsFavorites = showsFavorites;
			this.allowsAllWrites = allowsAllWrites;

			tableView.DataSource = this;
			tableView.RowHeight = UITableView.AutomaticDimension;
			tableView.EstimatedRowHeight = 50;
			RegisterReuseIdentifiers (tableView);
		}
        public CharacteristicsTableViewDataSource(HMService service, UITableView tableView, ICharacteristicCellDelegate @delegate, bool showsFavorites = false, bool allowsAllWrites = false)
        {
            Service              = service;
            Delegate             = @delegate;
            this.showsFavorites  = showsFavorites;
            this.allowsAllWrites = allowsAllWrites;

            tableView.DataSource         = this;
            tableView.RowHeight          = UITableView.AutomaticDimension;
            tableView.EstimatedRowHeight = 50;
            RegisterReuseIdentifiers(tableView);
        }
Ejemplo n.º 6
0
        // Sets the cell's text to represent a characteristic and target value.
        // For example, "Brightness → 60%"
        // Sets the subtitle to the service and accessory that this characteristic represents.
        public void SetCharacteristic(HMCharacteristic characteristic, NSNumber targetValue)
        {
            var targetDescription = string.Format("{0} → {1}", characteristic.LocalizedDescription, characteristic.DescriptionForValue(targetValue));

            TextLabel.Text = targetDescription;

            HMService service = characteristic.Service;

            if (service != null && service.Accessory != null)
            {
                TrySetDetailText(string.Format("{0} in {1}", service.Name, service.Accessory.Name));
            }
            else
            {
                TrySetDetailText("Unknown Characteristic");
            }
        }
Ejemplo n.º 7
0
        public void DidUpdateValueForCharacteristic(HMAccessory accessory, HMService service, HMCharacteristic characteristic)
        {
            var s = characteristic.Service;

            if (s == null)
            {
                return;
            }

            var a = service.Accessory;

            if (a == null)
            {
                return;
            }

            var indexOfAccessory = Array.IndexOf(favoriteAccessories, accessory);

            if (indexOfAccessory < 0)
            {
                return;
            }

            var favoriteCharacteristics = FavoritesManager.SharedManager.FavoriteCharacteristicsForAccessory(accessory);
            var indexOfCharacteristic   = Array.IndexOf(favoriteCharacteristics, characteristic);

            if (indexOfCharacteristic < 0)
            {
                return;
            }

            var indexPath = NSIndexPath.FromRowSection(indexOfCharacteristic, indexOfAccessory);
            var cell      = (CharacteristicCell)TableView.CellAt(indexPath);

            cell.SetValue(characteristic.Value, false);
        }
		public void DidUpdateNameForService (HMAccessory accessory, HMService service)
		{
			ReloadData ();
		}
		public void DidRemoveService (HMHome home, HMService service, HMServiceGroup group)
		{
			if (ServiceGroup == group)
				ReloadData ();
		}
 public void DidUpdateNameForService(HMAccessory accessory, HMService service)
 {
     ReloadData();
 }
		public void DidUpdateAssociatedServiceType (HMAccessory accessory, HMService service)
		{
			ReloadData ();
		}
Ejemplo n.º 12
0
 // returns: `true` if this service is a 'control type'; `false` otherwise.
 public static bool IsControllType(this HMService self)
 {
     return(self.ServiceType != HMServiceType.AccessoryInformation && self.ServiceType != HMServiceType.LockManagement);
 }
Ejemplo n.º 13
0
 public void DidUpdateAssociatedServiceType(HMAccessory accessory, HMService service)
 {
     ReloadData();
 }
 public void DidUpdateNameForService(HMAccessory accessory, HMService service)
 {
     var index = displayedServices.IndexOf (service);
     if (index >= 0) {
         var path = NSIndexPath.FromRowSection (index, (int)AccessoryTableViewSection.Services);
         TableView.ReloadRows (new []{ path }, UITableViewRowAnimation.Automatic);
     }
 }
		public void DidUpdateValueForCharacteristic (HMAccessory accessory, HMService service, HMCharacteristic characteristic)
		{
			var index = Array.IndexOf (service.Characteristics, characteristic);
			if (index >= 0) {
				var indexPath = NSIndexPath.FromRowSection (index, 0);
				var cell = (CharacteristicCell)TableView.CellAt (indexPath);
				cell.SetValue (characteristic.Value, false);
			}
		}
		public void DidUpdateValueForCharacteristic (HMAccessory accessory, HMService service, HMCharacteristic characteristic)
		{
			var s = characteristic.Service;
			if (s == null)
				return;

			var a = service.Accessory;
			if (a == null)
				return;

			var indexOfAccessory = Array.IndexOf (favoriteAccessories, accessory);
			if (indexOfAccessory < 0)
				return;

			var favoriteCharacteristics = FavoritesManager.SharedManager.FavoriteCharacteristicsForAccessory (accessory);
			var indexOfCharacteristic = Array.IndexOf (favoriteCharacteristics, characteristic);
			if (indexOfCharacteristic < 0)
				return;

			var indexPath = NSIndexPath.FromRowSection (indexOfCharacteristic, indexOfAccessory);
			var cell = (CharacteristicCell)TableView.CellAt (indexPath);
			cell.SetValue (characteristic.Value, false);
		}
Ejemplo n.º 17
0
 // returns: `true` if this service supports the `associatedServiceType` property; `false` otherwise.
 public static bool SupportsAssociatedServiceType(this HMService self)
 {
     return(self.ServiceType == HMServiceType.Outlet || self.ServiceType == HMServiceType.Switch);
 }