/// <summary> /// Every time the timer ticks we will perform actions based on the Events that were send from the dll /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Timer_Tick(object sender, EventArgs e) { Console.WriteLine($"{_count++} HTE elapsed"); Hotel.PerformAllActions(); // Fix frequent GC calls //Every timer tick we refresh the facility layout _fillFacillityTB(); //Every timer tick we refresh the movable layout _fillMoveAbleTB(); // Disposing the movable bitmap to prevent memory leaking // https://blogs.msdn.microsoft.com/davidklinems/2005/11/16/three-common-causes-of-memory-leaks-in-managed-applications/ _hotelImage.Dispose(); _hotelImage = Hotel.DrawMap(); _hotelBackground.Image = _hotelImage; }