public FormTimerSettingsDefault(WurmTimer wurmTimer) { ParentTimer = wurmTimer; InitializeComponent(); if (wurmTimer.MoreOptionsAvailable) buttonMoreOptions.Visible = true; this.Text = wurmTimer.TimerID; //set all options values this.checkBoxPopup.Checked = ParentTimer.PopupNotify; this.checkBoxSound.Checked = ParentTimer.SoundNotify; this.checkBoxPopupPersistent.Checked = ParentTimer.PersistentPopup; this.textBoxSoundName.Text = ParentTimer.SoundName; this.checkBoxOnAssistantLaunch.Checked = ParentTimer.PopupOnWALaunch; int popupDurationMillis = ParentTimer.PopupDuration; this.numericUpDownPopupDuration.Value = GeneralHelper.ConstrainValue<int>( popupDurationMillis / 1000, (int)numericUpDownPopupDuration.Minimum, (int)numericUpDownPopupDuration.Maximum); isInited = true; }
internal void RemoveTimer(WurmTimer timer) { try { var type = WurmTimerDescriptors.GetTimerType(timer); Settings.Value.ActiveTimers.Remove(type); } catch (InvalidOperationException _e) { if (timer is CustomTimer) { Logger.LogInfo("there was an issue with removing custom timer, attempting fix now"); Settings.Value.ActiveTimers.RemoveWhere(x => timer.NameID == x.NameID); Logger.LogInfo("fixed"); } else Logger.LogError("problem removing timer from active list, ID: " + timer.TimerID, this, _e); } Settings.DelayedSave(); WurmTimers.Remove(timer); timer.Stop(); }
/// <summary> /// /// </summary> /// <param name="timer"></param> /// <exception cref="InvalidOperationException">Descriptors did not contain type of this timer</exception> /// <returns></returns> public static TimerType GetTimerType(WurmTimer timer) { return Descriptors.First(x => x.NameID == timer.NameID && x.Group == timer.TargetServerGroup); }
public UControlTimerDisplay(WurmTimer wurmTimer) : this() { this.WurmTimer = wurmTimer; SetName(wurmTimer.TimerShortID); }