public AVRendererDiscovery(DiscoveryHandler OnRendererCallback)
        {
            PollTimer.Interval   = 500;
            PollTimer.OnElapsed += new SafeTimer.TimeElapsedHandler(PollSink);

            _New     = new AVTargetDiscovery.ManagerHandler(AddSink);
            _Removed = new AVTargetDiscovery.ManagerHandler(RemovedSink);

            OnRenderer += OnRendererCallback;
            lock (this)
            {
                if (disco == null)
                {
                    disco = new AVTargetDiscovery();
                }
                if (OnRenderer != null)
                {
                    foreach (AVRenderer r in disco.GetRenderers())
                    {
                        OnRenderer(this, r);
                    }
                }
                disco.AddWeakEvent_OnRenderer(_New);
                disco.AddWeakEvent_RemovedRenderer(_Removed);
            }
            if (AVRendererDiscovery.PollPositionEnabled)
            {
                PollTimer.Start();
            }
        }
Ejemplo n.º 2
0
 public void OnStart(GameInterface game)
 {
     this.game      = game;
     settings       = this.LoadSettingsJSON <Settings>();
     pluginIsActive = true;
     this.LogPrint("Fishing spell name: " + FISHING_SPELL_NAME);
     timer = this.CreateTimer(100, game, Timer_OnElapsed);
     timer.Start();
 }
Ejemplo n.º 3
0
 private void MetroLinkEnableCyclicExecution_Click(object sender, EventArgs e)
 {
     if (safeTimer != null && safeTimer.IsRunning)
     {
         LuaCancellationRequested = true;
         safeTimer?.Dispose();
         this.LogPrint("Timer disabled");
         NotifyUser("Timer is stopped", false, false);
         SetupTimerControls(false);
     }
     else
     {
         labelRequestTime.Visible = false;
         if (!info.IsInGame)
         {
             new TaskDialog("Error!", nameof(AxTools), "Player isn't logged in", TaskDialogButton.OK, TaskDialogIcon.Stop).Show(this);
             return;
         }
         if (!int.TryParse(metroTextBoxTimerInterval.Text, out luaConsoleSettings.TimerInterval) || luaConsoleSettings.TimerInterval < 50)
         {
             TaskDialog.Show("Incorrect input!", nameof(AxTools), "Interval must be a number more or equal 50", TaskDialogButton.OK, TaskDialogIcon.Warning);
             return;
         }
         if (textBoxLuaCode.Text.Trim().Length == 0)
         {
             new TaskDialog("Error!", nameof(AxTools), "Script is empty", TaskDialogButton.OK, TaskDialogIcon.Stop).Show(this);
             return;
         }
         SetupTimerControls(true);
         LuaCancellationRequested = false;
         safeTimer = this.CreateTimer(luaConsoleSettings.TimerInterval, info, TimerLuaElapsed);
         safeTimer.Start();
         NotifyUser("Timer is started", false, false);
         this.LogPrint("Timer enabled");
     }
 }