public static HomeKitCondition CreateSunTime (TimeConditionOrder order, TimeConditionSunState state) { return new HomeKitCondition { SunTimeData = new Tuple<TimeConditionOrder, TimeConditionSunState> (order, state), Type = HomeKitConditionType.SunTime }; }
public static HomeKitCondition CreateSunTime(TimeConditionOrder order, TimeConditionSunState state) { return(new HomeKitCondition { SunTimeData = new Tuple <TimeConditionOrder, TimeConditionSunState> (order, state), Type = HomeKitConditionType.SunTime }); }
// Sets the cell's text to represent a solar event time condition. public void SetOrder(TimeConditionOrder order, TimeConditionSunState sunState) { string timeString; switch (sunState) { case TimeConditionSunState.Sunrise: timeString = "Sunrise"; break; case TimeConditionSunState.Sunset: timeString = "Sunset"; break; default: throw new InvalidOperationException(); } SetOrder(order, timeString, "Relative to sun"); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { base.RowSelected(tableView, indexPath); var cell = tableView.CellAt(indexPath); if (cell.SelectionStyle == UITableViewCellSelectionStyle.None) { return; } tableView.DeselectRow(indexPath, true); switch ((TimeConditionTableViewSection)indexPath.Section) { case TimeConditionTableViewSection.TimeOrSun: timeType = (TimeConditionType)indexPath.Row; ReloadDynamicSections(); return; case TimeConditionTableViewSection.BeforeOrAfter: order = (TimeConditionOrder)indexPath.Row; tableView.ReloadSections(NSIndexSet.FromIndex(indexPath.Section), UITableViewRowAnimation.Automatic); break; case TimeConditionTableViewSection.Value: if (timeType == TimeConditionType.Sun) { sunState = (TimeConditionSunState)indexPath.Row; } tableView.ReloadSections(NSIndexSet.FromIndex(indexPath.Section), UITableViewRowAnimation.Automatic); break; default: throw new InvalidOperationException("Unexpected `TimeConditionTableViewSection` value."); } }
public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { base.RowSelected (tableView, indexPath); var cell = tableView.CellAt (indexPath); if (cell.SelectionStyle == UITableViewCellSelectionStyle.None) return; tableView.DeselectRow (indexPath, true); switch ((TimeConditionTableViewSection)indexPath.Section) { case TimeConditionTableViewSection.TimeOrSun: timeType = (TimeConditionType)indexPath.Row; ReloadDynamicSections (); return; case TimeConditionTableViewSection.BeforeOrAfter: order = (TimeConditionOrder)indexPath.Row; tableView.ReloadSections (NSIndexSet.FromIndex (indexPath.Section), UITableViewRowAnimation.Automatic); break; case TimeConditionTableViewSection.Value: if (timeType == TimeConditionType.Sun) sunState = (TimeConditionSunState)indexPath.Row; tableView.ReloadSections (NSIndexSet.FromIndex (indexPath.Section), UITableViewRowAnimation.Automatic); break; default: throw new InvalidOperationException ("Unexpected `TimeConditionTableViewSection` value."); } }
// Sets the cell's text to represent a solar event time condition. public void SetOrder(TimeConditionOrder order, TimeConditionSunState sunState) { string timeString; switch (sunState) { case TimeConditionSunState.Sunrise: timeString = "Sunrise"; break; case TimeConditionSunState.Sunset: timeString = "Sunset"; break; default: throw new InvalidOperationException (); } SetOrder (order, timeString, "Relative to sun"); }