using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Threading; namespace FCC_Uber_MDX_Configurator { public partial class BusyDoingCrapForm : Form { private bool looping = false; public BusyDoingCrapForm(Bitmap _image, int max) { SetupBusyDoingCrapForm(_image, max, false); } public BusyDoingCrapForm(Bitmap _image, int max, bool animated) { SetupBusyDoingCrapForm(_image, max, animated); } public void SetupBusyDoingCrapForm(Bitmap _image, int max, bool animated) { InitializeComponent(); if (animated) { _PICTURE.Image = _image; } else { _PICTURE.BackgroundImageLayout = ImageLayout.Stretch; _PICTURE.BackgroundImage = _image; } _BAR.Value = 0; _BAR.Step = 1; if (max <= 0) { looping = true; _BAR.Maximum = 2500; } else { _BAR.Maximum = max; } _PICTURE.Update(); } public void UpdateBar() { if (!looping) { _BAR.PerformStep(); } else { _BAR.PerformStep(); if (_BAR.Value >= _BAR.Maximum) { _BAR.Value = 1; } } _BAR.Update(); _PICTURE.Update(); this.Update(); } public void UpdateBar(int newValue) { if (newValue < _BAR.Maximum) { _BAR.Value = newValue; _BAR.Update(); } _PICTURE.Update(); this.Update(); } } }