星火直播PC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RollCallPerfectionWindow.xaml.cs 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Threading;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. namespace XHZB.Desktop
  6. {
  7. //定义委托
  8. public delegate void ChangeTextHandler(string text);
  9. /// <summary>
  10. /// RollCallPerfectionWindow.xaml 的交互逻辑
  11. /// </summary>
  12. public partial class RollCallPerfectionWindow : Window
  13. {
  14. //定义事件
  15. public event ChangeTextHandler ChangeTextEvent;
  16. public RollCallPerfectionWindow(string _name, string _pic)
  17. {
  18. InitializeComponent();
  19. this.Opacity = 1;
  20. txbName.Text = _name;
  21. }
  22. public void Name(string _name)
  23. {
  24. this.Opacity = 1;
  25. txbName.Text = _name;
  26. }
  27. /// <summary>
  28. /// </summary>
  29. /// <param name="sender">事件源</param>
  30. /// <param name="e">事件对象</param>
  31. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  32. {
  33. }
  34. /// <summary>
  35. /// 结束
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. private void btnEnd_Click(object sender, RoutedEventArgs e)
  40. {
  41. //ToolbarWindow.IsNotOperation = false;
  42. new Thread(new ThreadStart(new Action(() =>
  43. {
  44. Dispatcher.Invoke(new Action(() =>
  45. {
  46. txbName.Text = "";
  47. this.Opacity = 0;
  48. }));
  49. Thread.Sleep(200);
  50. Dispatcher.Invoke(new Action(() =>
  51. {
  52. ChangeTextEvent?.Invoke("关闭窗口");
  53. Hide();
  54. }));
  55. }))).Start();
  56. }
  57. /// <summary>
  58. /// 重新点名
  59. /// </summary>
  60. /// <param name="sender"></param>
  61. /// <param name="e"></param>
  62. private void btnNewRollCall_Click(object sender, RoutedEventArgs e)
  63. {
  64. RadioButton rdo = sender as RadioButton;
  65. //引发事件
  66. if (ChangeTextEvent != null)
  67. {
  68. ChangeTextEvent("重新点名");
  69. }
  70. new Thread(new ThreadStart(new Action(() =>
  71. {
  72. Dispatcher.Invoke(new Action(() =>
  73. {
  74. txbName.Text = "";
  75. this.Opacity = 0;
  76. }));
  77. Thread.Sleep(200);
  78. Dispatcher.Invoke(new Action(() =>
  79. {
  80. Hide();
  81. }));
  82. }))).Start();
  83. }
  84. }
  85. }