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); }