Skip to content

Instantly share code, notes, and snippets.

@xezrunner
Last active March 6, 2020 16:10
Show Gist options
  • Save xezrunner/ac8bfe6a5262fde0dca6ab2491ae0af0 to your computer and use it in GitHub Desktop.
Save xezrunner/ac8bfe6a5262fde0dca6ab2491ae0af0 to your computer and use it in GitHub Desktop.
// The progressringAnimation Timer object is placed in a form (WinForms designer), and has an Interval of 30.
// The progressRing Label object has its Font property set to the Setup font.
// In case you are using the Segoe Boot Semilight font, make sure to check the character codes!
// There's better ways to do this, this was my solution back in 2015.
// This is the "first frame - 1" character code. You can get the character codes with the Character map.
char code = "\ue051"[0];
private async void progressringAnimator_Tick(object sender, EventArgs e)
{
// increase frame number
code++;
// set the Label text to the frame character
progressRing.Text = code.ToString();
// when we reach the end, start over from the beginning
if (code == "\ue0CB"[0])
{
await Task.Delay(TimeSpan.FromSeconds(.2)); // the progressring usually has a tiny delay, this is optional.
code = "\ue051"[0]; // reset animation to first frame
}
}
void ShowProgressRing()
{
progressRing.Show();
code = "\ue051"[0];
progressringAnimator.Start();
}
void HideProgressRing()
{
progressring.Hide();
progressring.Text = "";
progressringAnimator.Stop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment