![]() ![]() I started out as a complete noobie, and within a few months was helping to train other noobies, and then became a diplomat and worked up the ranks from there. I began playing Eve in 2010 and joined the freshly minted Dreddit corporation, which was founded out of a r/gaming post by the original CEO Fletcher Hammond. Some of my answers in the previous thread may be of interest to you, so click here for that. Please note that I was heavily involved in running the alliance up until about 2 years ago, and while I know most of the big characters involved in the huge fight that occurred yesterday on some level or another, I don't know all of the specifics. Some people found it interesting and suggested I do an AMA, so here I am. I started talking about my time running and helping to run what used to be the largest alliance in Eve Online, Test Alliance Please Ignore, in the thread about the guy who wrote a thesis on running a WoW guild. ![]() And that’s why you can see this private Dictionary> m_Handlers = new().In most of the cases, this list would have only one entry unless in case of a duplicate subscription.Therefore, for the sake of completeness, for each TimerIntervalElapsedEventHandler handler we would keep a list of ElapsedEventHandler handlers. Yes, this is not logical, but still it is doable.However, we also need to keep in mind that from outside, someone might subscribe the same TimerIntervalElapsedEventHandler handler more than once.This way, by knowing the passed in TimerIntervalElapsedEventHandler handler, we can know the corresponding ElapsedEventHandler handler. The only way to achieve this is through keeping track of each TimerIntervalElapsedEventHandler handler and the newly created ElapsedEventHandler handler in a dictionary.This means that at this moment, we need to be able to know which ElapsedEventHandler handler corresponds to that TimerIntervalElapsedEventHandler handler so that we can unsubscribe it from the Internal Timer.However, we also need to keep in mind that at some point someone might need to unsubscribe a handler from the TimerIntervalElapsedEventHandler event.Therefore, what we need to do is to wrap the coming in TimerIntervalElapsedEventHandler into a new internal ElapsedEventHandler.However, we need to keep in mind that the two handlers are not the same as they are actually of different types TimerIntervalElapsedEventHandler and ElapsedEventHandler.In other words, if someone from outside is having an instance of our ITimer, he should be able to do something like this t.TimerIntervalElapsed += (sender, dateTime) =>.In this case, we want to mirror this to the Internal Timer. What we need to do with this event, is to handle when someone subscribes/unsubscribes to it from outside.For public event TimerIntervalElapsedEventHandler TimerIntervalElapsed, this is the most important part so let’s analyze it step by step.For public bool Enabled, public double Interval, public void Start(), and public void Stop(), we are just delegating the implementation to the Internal Timer.We would refer to this as the Internal Timer in the rest of the steps. In the constructor we are initializing a new instance of.That’s why you can see the private bool m_IsDisposed, public void Dispose(), protected virtual void Dispose(bool disposing), and ~Timer(). We applied the IDisposable design pattern.This is where almost all the magic happens.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |