private bool CheckDatingProper(string NPC) { if (Dates.Contains(NPC) ^ Modworks.Player.GetFriendshipStatus(NPC) == FriendshipStatus.Dating) { Date(NPC); //fix desynced status } return(Dates.Contains(NPC)); }
/// <summary> /// /// </summary> /// <param name="date"></param> /// <returns></returns> public bool ContainsDate(DateTime date) { if (Dates.Contains(date)) { return(true); } return(false); }
/// <summary> /// Adds today's date if it is not already added /// </summary> public void AddDate() { if (!Dates.Contains(DateTime.Today)) { Dates.Add(DateTime.Today); } else { Dates.Remove(DateTime.Today); } NotifyPropertyChanged("Dates"); // to changed si nyní kolekce Dates zavolá sama }
/// <summary> /// Check if a date is valid according to this restriction. /// </summary> /// <param name="dateTime">The date to check.</param> /// <returns>True if the date is valid, False if the date is not valid and null if the restriction does not apply to the given date.</returns> public bool?IsValid(DateTime dateTime) { if (Dates == null && DaysOfWeek == null && (TimeStart == null || TimeEnd == null)) { return(null); } return((Dates?.Contains(dateTime.Date) ?? true) && (DaysOfWeek?.Contains(dateTime.DayOfWeek) ?? true) && ((TimeStart == null || TimeEnd == null) || (TimeStart.Value.TimeOfDay <= dateTime.TimeOfDay && TimeEnd.Value.TimeOfDay >= dateTime.TimeOfDay)) ? (bool?)(Type == RestrictionType.Allow) : null); //Restriction is not applicable }
/// <summary> /// Add/remove today day /// </summary> public void AddDate() { if (!Dates.Contains(DateTime.Today)) { Dates.Add(DateTime.Today); } else { Dates.Remove(DateTime.Today); } NotifyPropertyChanged(nameof(Dates)); }
internal static ILayout GetLayout(string dataType, Config config, FieldConfig fieldConfig) { string vtype = string.Empty; if (Shorts.Contains(dataType) || Integers.Contains(dataType) || Longs.Contains(dataType)) { vtype = "int"; if (dataType.EndsWith("_strict")) { vtype = "int-strict"; } if (dataType.EndsWith("_strict2")) { vtype = "int-strict2"; } return(new TextBox(config, fieldConfig, vtype)); } if (Decimals.Contains(dataType)) { vtype = "dec"; if (dataType.EndsWith("_strict")) { vtype = "dec-strict"; } if (dataType.EndsWith("_strict2")) { vtype = "dec-strict2"; } return(new TextBox(config, fieldConfig, vtype)); } if (Bools.Contains(dataType)) { return(new Radios(config, fieldConfig)); } if (Dates.Contains(dataType)) { return(new TextBox(config, fieldConfig, "date")); } return(Files.Contains(dataType) ? new TextBox(config, fieldConfig, "file") : new TextBox(config, fieldConfig)); }
/// <summary> /// Returns true if the date is a business day for the given market. /// </summary> /// <param name="date">The date to check.</param> public bool IsSignificantDay(DateTime date) { return(Dates.Contains(date)); }