SimpleAlert.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace ShareWifi.Views.Components
  11. {
  12. /// <summary>
  13. /// 进度条弹框消息
  14. /// </summary>
  15. public partial class SimpleAlert : Form
  16. {
  17. public SimpleAlert()
  18. {
  19. InitializeComponent();
  20. }
  21. public static SimpleAlert getInstance()
  22. {
  23. return new SimpleAlert();
  24. }
  25. public void Show(string message)
  26. {
  27. lbMessage.Text = message;
  28. Show();
  29. }
  30. private void SimpleAlert_Load(object sender, EventArgs e)
  31. {
  32. timer1.Start();
  33. }
  34. /// <summary>
  35. /// 500 ms 之后窗体自动关闭
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. private void timer1_Tick(object sender, EventArgs e)
  40. {
  41. timer1.Stop();
  42. Close();
  43. }
  44. }
  45. }