Ejemplo n.º 1
0
        public ScheduledConfigViewModel(ScheduledConfig model, ViewModelManagementBase cBase)
        {
            CurrentBase = cBase;
            Name        = model.Name;
            Description = model.Description;

            UpdateNextExecution(model.Gtid.ExecutionDate);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a list of settings for the guardian to work with.
        /// </summary>
        /// <returns></returns>
        public static HashSet <GuardianTask> GetSettingsForGuardian()
        {
            var scheduledConfigs = new HashSet <GuardianTask>();

            foreach (var pair in _wellKnownSettings)
            {
                // SettingType B is not a scheduled task => so we can ingore it here.
                if (pair.Value != SettingType.B)
                {
                    // If the config is empty, there is no point in adding it to the list.
                    var values = (GetSettingValue <string>(pair.Key) == default) ? default : GetSettingValue <string>(pair.Key).Split(',');

                                 if (values == default)
                                 {
                                     continue;
                                 }

                                 ScheduledConfig newModel = null;

                                 if (pair.Value == SettingType.DI && DateTime.TryParse(values[0], out var date))
                                 {
                                     var param = new object[2]
                                     {
                                         date,
                                         values[1] // interval
                                     };

                                     newModel = new ScheduledConfig(date, param)
                                     {
                                         Name        = pair.Key,
                                         Description = _wellKnownHandledSettingDescriptions[pair.Key]
                                     };
                                 }
                                 else if (pair.Value == SettingType.DIP && DateTime.TryParse(values[0], out var date2))
                                 {
                                     var param = new object[3]
                                     {
                                         date2,
                                         values[1], // interval
                                         values[2]  // path
                                     };
                                     newModel = new ScheduledConfig(date2, param)
                                     {
                                         Name        = pair.Key,
                                         Description = _wellKnownHandledSettingDescriptions[pair.Key]
                                     };
                                 }
                                 scheduledConfigs.Add(newModel);
                }
            }
            return(scheduledConfigs);
        }