星火直播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.

ToolbarWindow.xaml.cs 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. using XHZB.Model;
  16. using Common.ZB;
  17. using XHZB.Desktop.Utils;
  18. using Common.system;
  19. namespace XHZB.Desktop
  20. {
  21. /// <summary>
  22. /// ToolbarWindow.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class ToolbarWindow : Window
  25. {
  26. #region 字段
  27. /// <summary>
  28. /// 屏幕宽
  29. /// </summary>
  30. internal double pwidth = SystemParameters.PrimaryScreenWidth;
  31. /// <summary>
  32. /// 屏幕高
  33. /// </summary>
  34. internal double pHeight = SystemParameters.PrimaryScreenHeight;
  35. /// <summary>
  36. /// 工具栏数据
  37. /// </summary>
  38. internal ToolbarModel pageData = new ToolbarModel();
  39. #endregion
  40. #region 初始化
  41. public ToolbarWindow()
  42. {
  43. InitializeComponent();
  44. Topmost = true;
  45. Left = pwidth - 300;
  46. Top = (pHeight - 568) / 2;
  47. pageData.menuList.Add(new ToolbarMenu()
  48. {
  49. Name = "个人空间",
  50. Pic = "../Images/ToolBar/我的备课@2x.png"
  51. });
  52. pageData.menuList.Add(new ToolbarMenu()
  53. {
  54. Name = "直播",
  55. Pic = "../Images/ToolBar/直播@2x.png"
  56. });
  57. pageData.menuList.Add(new ToolbarMenu()
  58. {
  59. Name = "抢答点名",
  60. Pic = "../Images/ToolBar/抢答@2x.png"
  61. });
  62. pageData.menuList.Add(new ToolbarMenu()
  63. {
  64. Name = "课堂工具",
  65. Pic = "../Images/ToolBar/黑板01@2x.png"
  66. });
  67. pageData.menuList.Add(new ToolbarMenu()
  68. {
  69. Name = "本节考勤",
  70. Pic = "../Images/ToolBar/本节考勤01@2x.png"
  71. });
  72. pageData.menuList.Add(new ToolbarMenu()
  73. {
  74. Name = "结束课堂",
  75. Pic = "../Images/ToolBar/下课@2x.png"
  76. });
  77. DataContext = pageData;
  78. }
  79. #endregion
  80. #region 事件
  81. /// <summary>
  82. /// 模块点击
  83. /// </summary>
  84. /// <param name="sender"></param>
  85. /// <param name="e"></param>
  86. private void toolbar_item_Click(object sender, RoutedEventArgs e)
  87. {
  88. int clickindex = 0;
  89. List<Button> buttons = VTHelper.FindChilds<Button>(toolbar_list, "toolbar_item");
  90. for (int i = 0; i < buttons.Count; i++)
  91. {
  92. if (buttons[i] == sender)
  93. {
  94. clickindex = i;
  95. break;
  96. }
  97. }
  98. ToolbarMenu item = pageData.menuList[clickindex];
  99. if (clickindex == 0)//个人空间
  100. {
  101. try
  102. {
  103. //HideLevel2();
  104. if (APP.W_UserCenterWindow != null && !APP.W_UserCenterWindow.IsFocused)
  105. {
  106. APP.W_UserCenterWindow.Focus();
  107. }
  108. else
  109. {
  110. APP.W_UserCenterWindow = new UserCenterWindow();
  111. APP.W_UserCenterWindow.Show();
  112. APP.W_UserCenterWindow.Closed += UserCenterWindow_Closed;
  113. }
  114. //IsOpenUserCenterWindow = true;
  115. }
  116. catch (Exception ex)
  117. {
  118. //IsOpenUserCenterWindow = false;
  119. //userCenterWindow = null;
  120. LogHelper.WriteErrLog("【个人空间(toolbar_item_Click)" + ex.Message, ex);
  121. }
  122. }
  123. else if (clickindex == 1)//直播
  124. {
  125. //HideLevel2();
  126. pageData.tongping = !pageData.tongping;
  127. if (pageData.tongping)
  128. {
  129. //tongpingBegin();
  130. pageData.menuList[1].Pic = "../Images/ToolBar/img_shared_1.gif";
  131. pageData.menuList[1].Name = "正在直播";
  132. }
  133. else
  134. {
  135. //tongpingEnd();
  136. pageData.menuList[1].Pic = "../Images/ToolBar/直播@2x.png";
  137. pageData.menuList[1].Name = "直播";
  138. }
  139. }
  140. //else if (clickindex == 2)//课堂提问
  141. //{
  142. // HideLevel2();
  143. // try
  144. // {
  145. // #region 关闭冲突页面
  146. // CloseOrHideWindowPage();
  147. // #endregion 关闭冲突页面
  148. // if (screenshotWindow != null)
  149. // {
  150. // screenshotWindow.initialization();
  151. // }
  152. // else
  153. // {
  154. // screenshotWindow = new ScreenshotWindow();
  155. // // 订阅事件
  156. // screenshotWindow.ChangeTextEvent += new ChangeTextHandler(frm_ChangeTextEvent);
  157. // screenshotWindow.click_closeJietuWindowClick += JietuWindow_click_closeJietuWindowClick;
  158. // }
  159. // screenshotWindow.Owner = this;
  160. // screenshotWindow.Show();
  161. // jietuType = 1;
  162. // //ZSocketServer.getInstance().addWin(jietuWindow);
  163. // //jietuWindow = null;
  164. // //GC.Collect();
  165. // }
  166. // catch (Exception ex)
  167. // {
  168. // jietuWindow = null;
  169. // LogHelper.WriteErrLog("【课堂提问(toolbar_item_Click)" + ex.Message, ex);
  170. // }
  171. //}
  172. //else if (clickindex == 4)//抢答点名
  173. //{
  174. // HideLevel2();
  175. // try
  176. // {
  177. // #region 关闭冲突页面
  178. // if (IsOpenRollCallWindow)
  179. // {
  180. // return;
  181. // }
  182. // else
  183. // {
  184. // CloseOrHideWindowPage();
  185. // }
  186. // #endregion 关闭冲突页面
  187. // if (rollCallWindow == null)
  188. // {
  189. // rollCallWindow = new RollCallWindow();
  190. // rollCallWindow.click_closeClick += RollCallWindow_click_closeClick;
  191. // }
  192. // else
  193. // {
  194. // rollCallWindow.Initialize();
  195. // }
  196. // rollCallWindow.Owner = this;
  197. // //ZSocketServer.getInstance().addWin(rollCallWindow);
  198. // IsOpenRollCallWindow = true;
  199. // rollCallWindow.Show();
  200. // }
  201. // catch (Exception ex)
  202. // {
  203. // IsOpenRollCallWindow = false;
  204. // rollCallWindow = null;
  205. // LogHelper.WriteErrLog("【抢答点名(toolbar_item_Click)" + ex.Message, ex);
  206. // }
  207. //}
  208. //else if (clickindex == 5)//课堂工具。
  209. //{
  210. // try
  211. // {
  212. // heibanshow = !heibanshow;
  213. // List<DependencyObject> list = new List<DependencyObject>
  214. // {
  215. // heiban_btn,
  216. // pizhu_btn
  217. // };
  218. // if (tangceshow)
  219. // {
  220. // tangceshow = !tangceshow;
  221. // List<DependencyObject> lists = new List<DependencyObject>
  222. // {
  223. // import_word_btn,
  224. // jietu_btn
  225. // };
  226. // hideOrShow(tangceshow, tangceTool, lists);
  227. // }
  228. // hideOrShow(heibanshow, ketangTool, list);
  229. // }
  230. // catch (Exception ex)
  231. // {
  232. // LogHelper.WriteErrLog("【课堂工具(toolbar_item_Click)" + ex.Message, ex);
  233. // }
  234. //}
  235. //else if (clickindex == 7)//本节考勤
  236. //{
  237. // HideLevel2();
  238. // try
  239. // {
  240. // showKaoqin();
  241. // }
  242. // catch (Exception ex)
  243. // {
  244. // LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
  245. // }
  246. //}
  247. //else if (clickindex == 8)//结束课堂。
  248. //{
  249. // if (MessageWindow.Show("是否结束课堂?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
  250. // {
  251. // closeAction();
  252. // }
  253. //}
  254. }
  255. /// <summary>
  256. /// 个人空间关闭
  257. /// </summary>
  258. /// <param name="sender"></param>
  259. /// <param name="e"></param>
  260. private void UserCenterWindow_Closed(object sender, EventArgs e)
  261. {
  262. APP.W_UserCenterWindow = null;
  263. //IsOpenUserCenterWindow = false;
  264. }
  265. private void toolbar_win_Closed(object sender, EventArgs e)
  266. {
  267. }
  268. private void toolbar_win_ContentRendered(object sender, EventArgs e)
  269. {
  270. }
  271. private void toolbar_win_Loaded(object sender, RoutedEventArgs e)
  272. {
  273. }
  274. private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
  275. {
  276. }
  277. private void Rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  278. {
  279. }
  280. /// <summary>
  281. /// 工具栏移动事件
  282. /// </summary>
  283. /// <param name="sender"></param>
  284. /// <param name="e"></param>
  285. private void Rectangle_MouseMove(object sender, MouseEventArgs e)
  286. {
  287. if (e.LeftButton == MouseButtonState.Pressed)
  288. {
  289. DragMove();
  290. }
  291. }
  292. #endregion
  293. }
  294. /// <summary>
  295. /// 工具栏模型
  296. /// </summary>
  297. public class ToolbarModel : NotifyModel
  298. {
  299. public ObservableCollection<ToolbarMenu> menuList { get; set; }
  300. internal bool _tongping = false;
  301. public bool tongping
  302. {
  303. get => _tongping;
  304. set { _tongping = value; OnPropertyChanged("tongping"); }
  305. }
  306. internal bool _IsOpen = true;
  307. public bool IsOpen
  308. {
  309. get => _IsOpen;
  310. set { _IsOpen = value; OnPropertyChanged("IsOpen"); }
  311. }
  312. public ToolbarModel()
  313. {
  314. menuList = new ObservableCollection<ToolbarMenu>();
  315. }
  316. }
  317. /// <summary>
  318. /// 工具栏菜单模型
  319. /// </summary>
  320. public class ToolbarMenu : NotifyModel
  321. {
  322. internal string _name;
  323. public string Name
  324. {
  325. get => _name;
  326. set { _name = value; OnPropertyChanged("Name"); }
  327. }
  328. internal string _Pic;
  329. public string Pic
  330. {
  331. get => _Pic;
  332. set { _Pic = value; OnPropertyChanged("Pic"); }
  333. }
  334. }
  335. }