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;
 }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
 public UControlTimerDisplay(WurmTimer wurmTimer) : this()
 {
     this.WurmTimer = wurmTimer;
     SetName(wurmTimer.TimerShortID);
 }