/// <summary> /// Main initializer. /// </summary> private void Init() { //Database log.Debug(@"Initializing connections."); if (Database.Connect()) { GetSpecificCollections(); //BindingOperations.EnableCollectionSynchronization(CourseRowList.CRList, SyncLock); } else { MessageBox.Show("Database issue."); } CourseList.RefreshList(); //Global loop DispatcherTimer mainLoopTimer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 3) }; mainLoopTimer.Tick += MainLoopTimerOnTick; mainLoopTimer.Start(); //TCP callback if (!TCPState.IsConnected) { TCP.Open(); } MainLoopThread = new Thread(TcpLoop); MainLoopThread.Start(); //TCP Ping TCP.TcpPingTimer.Interval = new TimeSpan(0, 0, 10); TCP.TcpPingTimer.Tick += _tcpPingTimer_Tick; TCP.TcpPingTimer.Start(); //if (CourseList.CList != null) CourseGrid.ItemsSource = CourseList.CList; /*//Course Timer * _courseTimer.Interval = TimeSpan.FromMilliseconds(2000); * _courseTimer.Tick += _Timer_Tick; * _courseTimer.Start();*/ TimerLabel.Content = "00:00.00"; }