// Sets the cell's text to represent an exact time condition. public void SetOrder(TimeConditionOrder order, NSDateComponents dateComponents) { var date = NSCalendar.CurrentCalendar.DateFromComponents(dateComponents); var timeString = DateFormatter.StringFor(date); SetOrder(order, timeString, "Relative to Time"); }
public static HomeKitCondition CreateSunTime (TimeConditionOrder order, TimeConditionSunState state) { return new HomeKitCondition { SunTimeData = new Tuple<TimeConditionOrder, TimeConditionSunState> (order, state), Type = HomeKitConditionType.SunTime }; }
public static HomeKitCondition CreateExactTime (TimeConditionOrder order, NSDateComponents components) { return new HomeKitCondition { ExactTimeData = new Tuple<TimeConditionOrder, NSDateComponents> (order, components), Type = HomeKitConditionType.ExactTime }; }
public static HomeKitCondition CreateExactTime(TimeConditionOrder order, NSDateComponents components) { return(new HomeKitCondition { ExactTimeData = new Tuple <TimeConditionOrder, NSDateComponents> (order, components), Type = HomeKitConditionType.ExactTime }); }
public static HomeKitCondition CreateSunTime(TimeConditionOrder order, TimeConditionSunState state) { return(new HomeKitCondition { SunTimeData = new Tuple <TimeConditionOrder, TimeConditionSunState> (order, state), Type = HomeKitConditionType.SunTime }); }
// Reloads the BeforeOrAfter and Value section. void ReloadDynamicSections() { if (timeType == TimeConditionType.Sun && order == TimeConditionOrder.At) { order = TimeConditionOrder.Before; } var reloadIndexSet = NSIndexSet.FromNSRange(new NSRange((int)TimeConditionTableViewSection.BeforeOrAfter, 2)); TableView.ReloadSections(reloadIndexSet, UITableViewRowAnimation.Automatic); }
// 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"); }
// Sets the cell's text to represent an ordered time with a set context string. public void SetOrder(TimeConditionOrder order, string timeString, string contextString) { string formatString; switch (order) { case TimeConditionOrder.Before: formatString = "Before {0}"; break; case TimeConditionOrder.After: formatString = "After {0}"; break; case TimeConditionOrder.At: formatString = "At {0}"; break; default: throw new InvalidOperationException (); } TextLabel.Text = string.Format (formatString, timeString); TrySetDetailText (contextString); }
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 an ordered time with a set context string. public void SetOrder(TimeConditionOrder order, string timeString, string contextString) { string formatString; switch (order) { case TimeConditionOrder.Before: formatString = "Before {0}"; break; case TimeConditionOrder.After: formatString = "After {0}"; break; case TimeConditionOrder.At: formatString = "At {0}"; break; default: throw new InvalidOperationException(); } TextLabel.Text = string.Format(formatString, timeString); TrySetDetailText(contextString); }
// Reloads the BeforeOrAfter and Value section. void ReloadDynamicSections () { if (timeType == TimeConditionType.Sun && order == TimeConditionOrder.At) order = TimeConditionOrder.Before; var reloadIndexSet = NSIndexSet.FromNSRange (new NSRange ((int)TimeConditionTableViewSection.BeforeOrAfter, 2)); TableView.ReloadSections (reloadIndexSet, UITableViewRowAnimation.Automatic); }
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"); }
// Sets the cell's text to represent an exact time condition. public void SetOrder(TimeConditionOrder order, NSDateComponents dateComponents) { var date = NSCalendar.CurrentCalendar.DateFromComponents (dateComponents); var timeString = DateFormatter.StringFor (date); SetOrder (order, timeString, "Relative to Time"); }