Example #1
0
        public void AutoSetTimes()
        {
            //Autofill time
            DateTime[] _times = Content.GetTimes();
            if (_times != null && _times.Count() > 0)
            {
                foreach (var _time in _times)
                {
                    Times.Add(_time);
                }
            }

            string[] _contains = Content.ToWords().Where(t => t.CountOf("/") == 1).ToArray();
            if (_contains != null && _contains.Length > 0)
            {
                foreach (string value in _contains)
                {
                    try
                    {
                        int year  = DateTime.Now.Year;
                        int month = int.Parse(value.GetAfter("/"));
                        int day   = int.Parse(value.GetBefore("/"));
                        var time  = new DateTime(year, month, day)
                        {
                        };
                        Times.Add(time);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
            //BuildTime();
            if (this.IsNoTime())
            {
                if (Times == null || Times.Count == 0)
                {
                    this.SetNow();
                }
                else
                {
                    this.Start = Times.FirstOrDefault();
                    this.End   = Times.LastOrDefault();
                }
            }
        }
Example #2
0
 public MoodMonitor(Profile profile) : base(profile, MoodMonitor.Key)
 {
     morningCheck = Times.FirstOrDefault();
     eveningCheck = Times.LastOrDefault();
 }