public void Dispose() { netcom.ClientConnected -= new EventHandler<EventArgs>(netcom_ClientConnected); netcom.ClientDisconnected -= new EventHandler<DisconnectedEventArgs>(netcom_ClientDisconnected); netcom.ChatReceived -= new EventHandler<ChatEventArgs>(netcom_ChatReceived); UnregisterClientEvents(client); beamTimer.Dispose(); beamTimer = null; if (lookAtTimer != null) { lookAtTimer.Dispose(); lookAtTimer = null; } if (walkTimer != null) { walkTimer.Dispose(); walkTimer = null; } if (autosit != null) { autosit.Dispose(); autosit = null; } if (lslHelper == null) { lslHelper.Dispose(); lslHelper = null; } }
public StateManager(RadegastInstance instance) { this.instance = instance; this.instance.ClientChanged += new EventHandler<ClientChangedEventArgs>(instance_ClientChanged); KnownAnimations = Animations.ToDictionary(); autosit = new AutoSit(this.instance); pseudohome = new PseudoHome(this.instance); lslHelper = new LSLHelper(this.instance); beamTimer = new System.Timers.Timer(); beamTimer.Enabled = false; beamTimer.Elapsed += new ElapsedEventHandler(beamTimer_Elapsed); // Callbacks netcom.ClientConnected += new EventHandler<EventArgs>(netcom_ClientConnected); netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(netcom_ClientDisconnected); netcom.ChatReceived += new EventHandler<ChatEventArgs>(netcom_ChatReceived); RegisterClientEvents(client); }