protected override void OnStop() { PullCheck.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); // Stop the time Monitor.Enter(PullCheckSync); // Wait for the current check (if any) to complete Monitor.Exit(PullCheckSync); // Clean up PullCheck.Dispose(); PullCheck = null; db.Dispose(); db = null; }
public void MyOnStart(string[] args) { PullCheck = new Timer(PullCheckCallback, null, TimeSpan.Zero, PullCheckPeriod); db = new GrooveyFMDataContext("Server = michael-server; User Id = grooveyfm; Password = BWQCmdhY8tLvb7xJEJ"); var types = from appdomain in AppDomain.CurrentDomain.GetAssemblies() from type in appdomain.GetTypes() where !type.IsAbstract && !type.IsNested && type.IsPublic && type.IsSubclassOf(typeof(BaseSource)) select type; AvailableSourceTypes = types.ToDictionary(t => t.Name); }