Exemplo n.º 1
0
 private bool CheckDatingProper(string NPC)
 {
     if (Dates.Contains(NPC) ^ Modworks.Player.GetFriendshipStatus(NPC) == FriendshipStatus.Dating)
     {
         Date(NPC);                                                                                            //fix desynced status
     }
     return(Dates.Contains(NPC));
 }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="date"></param>
 /// <returns></returns>
 public bool ContainsDate(DateTime date)
 {
     if (Dates.Contains(date))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
        /// <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
        }
Exemplo n.º 4
0
 /// <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
 }
Exemplo n.º 5
0
        /// <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));
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
 /// <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));
 }