public CLWSQL() { connection = new SqlConnection(); Logger.Initiate(""); areaPollHandler = null; areaLastFiveSearched = new Dictionary<AreaDetails, ArrayList>(); users = new List<User>(); }
public bool Open(string dbName) { //EAGLE-D8C30EC3C\JHAR try { //connection.ConnectionString = "user id=username;password=password;server=localhost;Trusted_Connection=yes;database=CLWDB;connection timeout=30"; connection.ConnectionString = string.Format("user id=username;password=password;server={0};Trusted_Connection=yes;database=master;connection timeout=30", dbName); connection.Open(); //There should be something here that checks to see if the current database exists //if so, it should check to see if we have any prior entries and load them and //pass them to the poll handler. //That way we don't get any duplicates. SqlCommand command = connection.CreateCommand(); command.CommandText = "SELECT * FROM Users"; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) users.Add(new User(reader[0].ToString())); reader.Close(); foreach (User user in users) user.Populate(connection); //Make a Handler for each subscribed user in the users.db Areas.Instance.Initialize(); areaPollHandler = new AreaPollHandler(); //Subscribe to all with this. areaPollHandler.Subscribe(Areas.Instance.AreasList, this); areaPollHandler.Start(new TimeSpan(0, 15, 0)); } catch (System.Exception ex) { return false; } return true; }
public CLWTabPage() { InitializeComponent(); tickInterval = new TimeSpan(0, 0, 1); refreshInterval = new TimeSpan(0, 0, 0); keywords = new List<string>(); previousRefreshMin1 = 0; Min1 = 0; Min2 = 0; Sec1 = 0; Sec2 = 0; totalFound = 0; totalSearched = 0; totalEntries = 0; pollHandler = new AreaPollHandler(); areaLastFiveSearched = new Dictionary<AreaDetails, List<string>>(); pollHandler.PollTimerTick += new AreaPollHandler.PollTimerTickHandler(this.UpdateRefreshTimeControl); pollHandler.PollStarted += new AreaPollHandler.PollStartedHandler(this.PollStarted); pollHandler.PollEnded += new AreaPollHandler.PollEndedHandler(this.PollEnded); _pollErrorHandler = new BaseBackgroundPoller.PollErrorHandler(this.OnPollError); _pollDoneHandler = new BaseBackgroundPoller.PollDoneHandler(this.OnPollDone); _numberOfEntriesFoundHandler = new BaseBackgroundPoller.NumberOfEntriesFoundHandler(this.OnNumberOfEntriesFound); _entryParsedHandler = new BaseBackgroundPoller.EntryParsedHandler(this.OnEntryParsed); _entryFoundHandler = new BaseBackgroundPoller.EntryFoundHandler(this.OnEntryFound); Locations.Instance.PopulateTreeView(ref this.trAreas); Categories.Instance.PopulateTreeView(ref this.trSections); this.wbEntries.Navigate("about:blank"); this.wbEntries.Document.OpenNew(true); this.wbEntries.Refresh(); }