Example #1
0
        public virtual void Clear()
        {
            Months = ScheduleMonths.None;
            Days   = ScheduleDays.None;

            Times.Clear();
        }
 /// <summary>
 /// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1" />.
 /// </summary>
 public void Clear()
 {
     _keyFrames.Clear();
     Times.Clear();
     if (_track != null)
     {
         _track.SetupSpline();
     }
 }
Example #3
0
 private void Reset()
 {
     Status = StopwatchStatus.OnStart;
     Times.Clear();
     _stopwatchLap.Reset();
     _stopwatchLap.Start();
     _stopwatchOverall.Reset();
     _stopwatchOverall.Start();
     TimeString    = "00:00.00";
     LapTimeString = "00:00.00";
 }
Example #4
0
        protected void CalculateBedTimes()
        {
            Times.Clear();

            // Takes ~14 mins for human to fall asleep
            var timeWhenAsleep = DateTime.Now.AddMinutes(14);
            var sleepCycleTime = new TimeSpan(1, 30, 0);

            for (int i = 0; i < 6; i++)
            {
                timeWhenAsleep = timeWhenAsleep.Add(sleepCycleTime);

                Times.Add(timeWhenAsleep.ToString("h:mm tt"));
            }
        }
Example #5
0
        protected void CalculateSleepTimes(TimeSpan endtime)
        {
            Times.Clear();

            var wakeUpTime = DateTime.Today.AddDays(1) + endtime;

            var sleepCycleTime = new TimeSpan(1, 30, 0);

            for (int i = 0; i < 6; i++)
            {
                var sleepTime = wakeUpTime.Add(-sleepCycleTime);

                Times.Insert(0, sleepTime.AddMinutes(-14).ToString("h:mm tt"));
                wakeUpTime = sleepTime;
            }
        }
Example #6
0
        private void FillTimes(string com)
        {
            Times.Clear();
            List <Week>   Item      = DFill.FillWeekList(Data.get(com));
            List <string> UserNames = new List <string>((UserClassList.Keys.ToList()));

            UserNames.Sort();
            foreach (string Users in UserNames)
            {
                Timings Time = new Timings()
                {
                    Listing = Item.FindAll(o => o.Who == Users), Now = Date.StartOfWeek(DateTime.Now, 0), User = Users
                };
                Times.Add(Time);
            }
        }
Example #7
0
        /// <summary>
        /// Инициализация
        /// </summary>
        void Initialize()
        {
            Employees     = Db.Employees.Include(x => x.Person).ToList();
            Groups        = Db.Groups.ToList();
            SelectedGroup = Groups.FirstOrDefault();

            Month = Culture.DateTimeFormat.MonthNames[SelectedDate.Month - 1];

            var Time = Db.ScheduleTimes.FirstOrDefault();

            if (Time != null)
            {
                var Date = new DateTime(2020, 5, 3).AddHours(Time.WorkingHourStart);

                Times.Clear();
                //Добавление часов
                for (int i = 0; i < Time.WorkingHourEnd - Time.WorkingHourStart; i++)
                {
                    int turn;
                    if (i == 0)
                    {
                        turn = 0;
                    }
                    else if (i == Time.DinnerAfter)
                    {
                        turn = Time.DinnerDuration;
                    }
                    else if (i == Time.DinnerAfter + 1)
                    {
                        turn = Time.AfterDinnerTurnDuration;
                    }
                    else
                    {
                        turn = Time.TurnDuration;
                    }

                    var DateStart = Date.AddMinutes(turn);
                    Date = DateStart.AddMinutes(Time.LessonDuration);


                    Times.Add(new ScheduleTemplate
                    {
                        Title        = $"{DateStart:HH:mm} - {Date:HH:mm}",
                        LessonNumber = i + 1,
                        DayOfWeek    = 0,
                    });
Example #8
0
        public void LoadActivityTimes(Guid id)
        {
            Times.Clear();
            var used = 0;

            foreach (var time in ActivityTimeService.GetAllActivityTimes(id).OrderByDescending(time => time.Timestamp))
            {
                used += time.Hours;
                Times.Add(new ActivityTimeListItem(time, ActivityTimeService, LanguageService));
            }
            TimeUsed = used;

            if (Activity.TimeBudget == 0)
            {
                TimeUsedFactor = "";
                return;
            }

            var factor = (double)used / (double)Activity.TimeBudget * 100;

            TimeUsedFactor = (int)factor + "%";
        }
        private void LoadStrategy()
        {
            SlideHeaders.Clear();
            SourcePrograms.Clear();
            Lengths.Clear();
            Stations.Clear();
            CustomDemos.Clear();
            Dayparts.Clear();
            Times.Clear();

            if (ResourceManager.Instance.MediaListsFile.ExistsLocal())
            {
                var document = new XmlDocument();
                document.Load(ResourceManager.Instance.MediaListsFile.LocalPath);

                XmlNode node = document.SelectSingleNode(String.Format(@"/{0}Strategy", XmlRootPrefix));
                if (node != null)
                {
                    foreach (XmlNode childeNode in node.ChildNodes)
                    {
                        switch (childeNode.Name)
                        {
                        case "SlideHeader":
                            foreach (XmlAttribute attribute in childeNode.Attributes)
                            {
                                switch (attribute.Name)
                                {
                                case "Value":
                                    if (!string.IsNullOrEmpty(attribute.Value) && !SlideHeaders.Contains(attribute.Value))
                                    {
                                        SlideHeaders.Add(attribute.Value);
                                    }
                                    break;
                                }
                            }
                            break;

                        case "FlexFlightDatesAllowed":
                        {
                            bool temp;
                            if (Boolean.TryParse(childeNode.InnerText, out temp))
                            {
                                FlexFlightDatesAllowed = temp;
                            }
                        }
                        break;

                        case "Daypart":
                            var daypart = new Daypart();
                            foreach (XmlAttribute attribute in childeNode.Attributes)
                            {
                                switch (attribute.Name)
                                {
                                case "Name":
                                    daypart.Name = attribute.Value;
                                    break;

                                case "Code":
                                    daypart.Code = attribute.Value;
                                    break;
                                }
                            }
                            if (!string.IsNullOrEmpty(daypart.Name))
                            {
                                Dayparts.Add(daypart);
                            }
                            break;

                        case "CustomDemo":
                            foreach (XmlAttribute attribute in childeNode.Attributes)
                            {
                                switch (attribute.Name)
                                {
                                case "Value":
                                    if (!CustomDemos.Contains(attribute.Value))
                                    {
                                        CustomDemos.Add(attribute.Value);
                                    }
                                    break;
                                }
                            }
                            break;

                        case "Lenght":
                            foreach (XmlAttribute attribute in childeNode.Attributes)
                            {
                                switch (attribute.Name)
                                {
                                case "Value":
                                    if (!string.IsNullOrEmpty(attribute.Value) && !SlideHeaders.Contains(attribute.Value))
                                    {
                                        Lengths.Add(attribute.Value);
                                    }
                                    break;
                                }
                            }
                            break;

                        case "Station":
                            var station = new Station();
                            foreach (XmlAttribute attribute in childeNode.Attributes)
                            {
                                switch (attribute.Name)
                                {
                                case "Name":
                                    station.Name = attribute.Value;
                                    break;

                                case "Logo":
                                    if (!string.IsNullOrEmpty(attribute.Value))
                                    {
                                        station.Logo = new Bitmap(new MemoryStream(Convert.FromBase64String(attribute.Value)));
                                    }
                                    break;
                                }
                            }
                            if (!string.IsNullOrEmpty(station.Name))
                            {
                                Stations.Add(station);
                            }
                            break;

                        case "Program":
                            var sourceProgram = new SourceProgram();
                            GetProgramProperties(childeNode, ref sourceProgram);
                            if (!string.IsNullOrEmpty(sourceProgram.Name))
                            {
                                SourcePrograms.Add(sourceProgram);
                            }
                            break;

                        case "Status":
                            foreach (XmlAttribute attribute in childeNode.Attributes)
                            {
                                switch (attribute.Name)
                                {
                                case "Value":
                                    if (!Statuses.Contains(attribute.Value))
                                    {
                                        Statuses.Add(attribute.Value);
                                    }
                                    break;
                                }
                            }
                            break;

                        case "BroadcastMonthTemplate":
                            var monthTemplate = new MediaMonthTemplate();
                            monthTemplate.Deserialize(childeNode);
                            MonthTemplatesMondayBased.Add(monthTemplate);
                            MonthTemplatesSundayBased.Add(monthTemplate);
                            break;

                        case "DefaultWeeklyScheduleSettings":
                            DefaultWeeklyScheduleSettings.Deserialize(childeNode);
                            break;

                        case "DefaultMonthlyScheduleSettings":
                            DefaultMonthlyScheduleSettings.Deserialize(childeNode);
                            break;

                        case "DefaultSnapshotSettings":
                            DefaultSnapshotSettings.Deserialize(childeNode);
                            break;

                        case "DefaultSnapshotSummarySettings":
                            DefaultSnapshotSummarySettings.Deserialize(childeNode);
                            break;

                        case "DefaultOptionsSettings":
                            DefaultOptionsSettings.Deserialize(childeNode);
                            break;

                        case "DefaultOptionsSummarySettings":
                            DefaultOptionsSummarySettings.Deserialize(childeNode);
                            break;

                        case "DefaultBroadcastCalendarSettings":
                            DefaultBroadcastCalendarSettings.Deserialize(childeNode);
                            break;

                        case "DefaultCustomCalendarSettings":
                            DefaultCustomCalendarSettings.Deserialize(childeNode);
                            break;
                        }
                    }
                }
            }

            if (SourcePrograms.Count > 0)
            {
                Times.AddRange(SourcePrograms.Select(x => x.Time).Distinct().ToArray());
                Days.AddRange(SourcePrograms.Select(x => x.Day).Distinct().ToArray());
            }
        }