public CustomTimersManagerEditForm([NotNull] IWurmApi wurmApi, [NotNull] TimerDefinition definition,
                                           [NotNull] TimerDefinitions timerDefinitions)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (definition == null)
            {
                throw new ArgumentNullException("definition");
            }
            if (timerDefinitions == null)
            {
                throw new ArgumentNullException("timerDefinitions");
            }
            this.wurmApi          = wurmApi;
            this.timerDefinitions = timerDefinitions;
            this.definition       = definition;

            InitializeComponent();

            foreach (var type in wurmApi.LogDefinitions.AllLogTypes)
            {
                comboBoxLogType.Items.Add(type);
            }
            comboBoxLogType.SelectedItem = LogType.Event;

            CustomTimerDefinition options = definition.CustomTimerConfig ?? new CustomTimerDefinition();

            textBoxTimerName.Text = definition.Name;
            if (options.TriggerConditions != null)
            {
                textBoxCond.Text = options.TriggerConditions[0].RegexPattern;
                if (!options.IsRegex)
                {
                    textBoxCond.Text = Regex.Unescape(textBoxCond.Text);
                }
                else
                {
                    checkBoxAsRegex.Checked = true;
                }
                comboBoxLogType.SelectedItem = options.TriggerConditions[0].LogType;
            }
            timeInputUControl2.Value    = options.Duration;
            checkBoxUptimeReset.Checked = options.ResetOnUptime;
        }
Esempio n. 2
0
 public void ApplyCustomTimerOptions(CustomTimerDefinition customTimerConfig)
 {
     this.config = customTimerConfig;
 }