예제 #1
0
 public TimersForm([NotNull] TimersFeature timersFeature, [NotNull] ILogger logger, [NotNull] IWurmApi wurmApi,
                   [NotNull] TimerDefinitions timerDefinitions)
 {
     if (timersFeature == null)
     {
         throw new ArgumentNullException("timersFeature");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (timerDefinitions == null)
     {
         throw new ArgumentNullException("timerDefinitions");
     }
     this.timersFeature    = timersFeature;
     this.logger           = logger;
     this.wurmApi          = wurmApi;
     this.timerDefinitions = timerDefinitions;
     InitializeComponent();
     widgetManager = new WidgetModeManager(this);
     widgetManager.WidgetModeChanging += (sender, args) =>
     {
         buttonAddRemoveChars.Visible
                   = buttonCustomTimers.Visible
                   = buttonOptions.Visible
                   = label1.Visible
                   = !args.WidgetMode;
     };
 }
예제 #2
0
 public TimerInstances([NotNull] IPersistentObjectResolver persistentObjectResolver,
                       [NotNull] TimerTypes timerTypes, [NotNull] TimerDefinitions timerDefinitions)
 {
     if (persistentObjectResolver == null)
     {
         throw new ArgumentNullException("persistentObjectResolver");
     }
     if (timerTypes == null)
     {
         throw new ArgumentNullException("timerTypes");
     }
     if (timerDefinitions == null)
     {
         throw new ArgumentNullException("timerDefinitions");
     }
     this.persistentObjectResolver = persistentObjectResolver;
     this.timerTypes       = timerTypes;
     this.timerDefinitions = timerDefinitions;
 }
예제 #3
0
 public PlayerTimersGroup(string persistentObjectId, TimersFeature timersFeature,
                          [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] ISoundManager soundManager,
                          [NotNull] ITrayPopups trayPopups, [NotNull] TimerDefinitions timerDefinitions,
                          [NotNull] TimerInstances timerInstances)
     : base(persistentObjectId)
 {
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (soundManager == null)
     {
         throw new ArgumentNullException("soundManager");
     }
     if (trayPopups == null)
     {
         throw new ArgumentNullException("trayPopups");
     }
     if (timerDefinitions == null)
     {
         throw new ArgumentNullException("timerDefinitions");
     }
     if (timerInstances == null)
     {
         throw new ArgumentNullException("timerInstances");
     }
     this.Id               = Guid.Parse(persistentObjectId);
     this.timersFeature    = timersFeature;
     this.wurmApi          = wurmApi;
     this.logger           = logger;
     this.timerDefinitions = timerDefinitions;
     this.timerInstances   = timerInstances;
 }
예제 #4
0
        public TimersFeature(
            [NotNull] ITimerFactory timerFactory,
            [NotNull] ILogger logger,
            [NotNull] IWurmApi wurmApi,
            [NotNull] ISoundManager soundManager,
            [NotNull] ITrayPopups trayPopups,
            [NotNull] TimerDefinitions timerDefinitions,
            [NotNull] IPersistentObjectResolver <PlayerTimersGroup> playerTimersGroupsResolver,
            [NotNull] TimerInstances timerInstances)
        {
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException(nameof(wurmApi));
            }
            if (soundManager == null)
            {
                throw new ArgumentNullException(nameof(soundManager));
            }
            if (trayPopups == null)
            {
                throw new ArgumentNullException(nameof(trayPopups));
            }
            if (timerDefinitions == null)
            {
                throw new ArgumentNullException(nameof(timerDefinitions));
            }
            if (playerTimersGroupsResolver == null)
            {
                throw new ArgumentNullException(nameof(playerTimersGroupsResolver));
            }
            if (timerInstances == null)
            {
                throw new ArgumentNullException(nameof(timerInstances));
            }
            this.logger                     = logger;
            this.wurmApi                    = wurmApi;
            this.soundManager               = soundManager;
            this.trayPopups                 = trayPopups;
            this.timerDefinitions           = timerDefinitions;
            this.playerTimersGroupsResolver = playerTimersGroupsResolver;
            this.timerInstances             = timerInstances;

            updateTimer = timerFactory.CreateUiThreadTimer();

            updateTimer.Interval = TimeSpan.FromMilliseconds(500);
            updateTimer.Tick    += (sender, args) =>
            {
                foreach (var timergroup in timerGroups)
                {
                    timergroup.Update();
                }
                ;
            };
        }