星火直播PC
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ToolbarWindow.xaml.cs 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  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. using System.Windows.Media.Animation;
  20. using System.Threading;
  21. namespace XHZB.Desktop
  22. {
  23. /// <summary>
  24. /// ToolbarWindow.xaml 的交互逻辑
  25. /// </summary>
  26. public partial class ToolbarWindow : Window
  27. {
  28. #region 字段
  29. /// <summary>
  30. /// 屏幕宽
  31. /// </summary>
  32. internal double pwidth = SystemParameters.PrimaryScreenWidth;
  33. /// <summary>
  34. /// 屏幕高
  35. /// </summary>
  36. internal double pHeight = SystemParameters.PrimaryScreenHeight;
  37. /// <summary>
  38. /// 工具栏数据
  39. /// </summary>
  40. internal ToolbarModel pageData = new ToolbarModel();
  41. /// <summary>
  42. /// 是否已打开课堂工具二级列表
  43. /// </summary>
  44. private bool heibanshow = false;
  45. #endregion
  46. #region 初始化
  47. public ToolbarWindow()
  48. {
  49. InitializeComponent();
  50. txbName.Text = APP.LoginUser.username;
  51. heiban_btn.Click += Heiban_btn_Click;
  52. pizhu_btn.Click += Pizhu_btn_Click;
  53. Topmost = true;
  54. Left = pwidth - 300;
  55. Top = (pHeight - 568) / 2;
  56. pageData.menuList.Add(new ToolbarMenu()
  57. {
  58. Name = "个人空间",
  59. Pic = "../Images/ToolBar/我的备课@2x.png"
  60. });
  61. pageData.menuList.Add(new ToolbarMenu()
  62. {
  63. Name = "直播",
  64. Pic = "../Images/ToolBar/直播@2x.png"
  65. });
  66. pageData.menuList.Add(new ToolbarMenu()
  67. {
  68. Name = "抢答点名",
  69. Pic = "../Images/ToolBar/抢答@2x.png"
  70. });
  71. pageData.menuList.Add(new ToolbarMenu()
  72. {
  73. Name = "课堂工具",
  74. Pic = "../Images/ToolBar/黑板01@2x.png"
  75. });
  76. pageData.menuList.Add(new ToolbarMenu()
  77. {
  78. Name = "本节考勤",
  79. Pic = "../Images/ToolBar/本节考勤01@2x.png"
  80. });
  81. pageData.menuList.Add(new ToolbarMenu()
  82. {
  83. Name = "结束课堂",
  84. Pic = "../Images/ToolBar/下课@2x.png"
  85. });
  86. DataContext = pageData;
  87. Thread t = new Thread(new ThreadStart(startSocket))
  88. {
  89. IsBackground = true
  90. };
  91. t.Start();
  92. }
  93. #endregion
  94. #region 事件
  95. /// <summary>
  96. /// 模块点击
  97. /// </summary>
  98. /// <param name="sender"></param>
  99. /// <param name="e"></param>
  100. private void toolbar_item_Click(object sender, RoutedEventArgs e)
  101. {
  102. int clickindex = 0;
  103. List<Button> buttons = VTHelper.FindChilds<Button>(toolbar_list, "toolbar_item");
  104. for (int i = 0; i < buttons.Count; i++)
  105. {
  106. if (buttons[i] == sender)
  107. {
  108. clickindex = i;
  109. break;
  110. }
  111. }
  112. ToolbarMenu item = pageData.menuList[clickindex];
  113. if (clickindex == 0)//个人空间
  114. {
  115. try
  116. {
  117. //HideLevel2();
  118. if (APP.W_UserCenterWindow != null && !APP.W_UserCenterWindow.IsFocused)
  119. {
  120. APP.W_UserCenterWindow.Focus();
  121. }
  122. else
  123. {
  124. APP.W_UserCenterWindow = new UserCenterWindow();
  125. APP.W_UserCenterWindow.Show();
  126. APP.W_UserCenterWindow.Closed += UserCenterWindow_Closed;
  127. }
  128. //IsOpenUserCenterWindow = true;
  129. }
  130. catch (Exception ex)
  131. {
  132. //IsOpenUserCenterWindow = false;
  133. //userCenterWindow = null;
  134. LogHelper.WriteErrLog("【个人空间(toolbar_item_Click)" + ex.Message, ex);
  135. }
  136. }
  137. else if (clickindex == 1)//直播
  138. {
  139. //HideLevel2();
  140. pageData.tongping = !pageData.tongping;
  141. if (pageData.tongping)
  142. {
  143. //tongpingBegin();
  144. pageData.menuList[1].Pic = "../Images/ToolBar/img_shared_1.gif";
  145. pageData.menuList[1].Name = "正在直播";
  146. if(APP.W_CameraWindow==null)
  147. {
  148. APP.W_CameraWindow = new CameraWindow();
  149. APP.W_CameraWindow.Topmost = true;
  150. APP.W_CameraWindow.Left = pwidth - 300;
  151. APP.W_CameraWindow.Top = 0;
  152. }
  153. APP.W_CameraWindow.Show();
  154. }
  155. else
  156. {
  157. //tongpingEnd();
  158. pageData.menuList[1].Pic = "../Images/ToolBar/直播@2x.png";
  159. pageData.menuList[1].Name = "直播";
  160. APP.W_CameraWindow.Hide();
  161. }
  162. }
  163. else if (clickindex == 2)//抢答点名
  164. {
  165. //HideLevel2();
  166. try
  167. {
  168. //#region 关闭冲突页面
  169. //if (IsOpenRollCallWindow)
  170. //{
  171. // return;
  172. //}
  173. //else
  174. //{
  175. // CloseOrHideWindowPage();
  176. //}
  177. //#endregion 关闭冲突页面
  178. if (APP.W_RollCallWindow == null)
  179. {
  180. APP.W_RollCallWindow = new RollCallWindow();
  181. //APP.W_RollCallWindow.click_closeClick += RollCallWindow_click_closeClick;
  182. }
  183. else
  184. {
  185. //APP.W_RollCallWindow.Initialize();
  186. }
  187. APP.W_RollCallWindow.Owner = this;
  188. //ZSocketServer.getInstance().addWin(rollCallWindow);
  189. //IsOpenRollCallWindow = true;
  190. APP.W_RollCallWindow.Show();
  191. }
  192. catch (Exception ex)
  193. {
  194. //IsOpenRollCallWindow = false;
  195. //rollCallWindow = null;
  196. LogHelper.WriteErrLog("【抢答点名(toolbar_item_Click)" + ex.Message, ex);
  197. }
  198. }
  199. else if (clickindex == 3)//课堂工具。
  200. {
  201. try
  202. {
  203. heibanshow = !heibanshow;
  204. List<DependencyObject> list = new List<DependencyObject>
  205. {
  206. heiban_btn,
  207. pizhu_btn
  208. };
  209. //if (tangceshow)
  210. //{
  211. // tangceshow = !tangceshow;
  212. // List<DependencyObject> lists = new List<DependencyObject>
  213. // {
  214. // import_word_btn,
  215. // jietu_btn
  216. // };
  217. // hideOrShow(tangceshow, tangceTool, lists);
  218. //}
  219. hideOrShow(heibanshow, ketangTool, list);
  220. }
  221. catch (Exception ex)
  222. {
  223. LogHelper.WriteErrLog("【课堂工具(toolbar_item_Click)" + ex.Message, ex);
  224. }
  225. }
  226. else if (clickindex == 4)//本节考勤
  227. {
  228. //HideLevel2();
  229. try
  230. {
  231. showKaoqin();
  232. }
  233. catch (Exception ex)
  234. {
  235. LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
  236. }
  237. }
  238. else if (clickindex == 5)//结束课堂。
  239. {
  240. if (MessageWindow.Show("是否结束课堂?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
  241. {
  242. closeAction();
  243. }
  244. }
  245. }
  246. /// <summary>
  247. /// 个人空间关闭
  248. /// </summary>
  249. /// <param name="sender"></param>
  250. /// <param name="e"></param>
  251. private void UserCenterWindow_Closed(object sender, EventArgs e)
  252. {
  253. APP.W_UserCenterWindow = null;
  254. //IsOpenUserCenterWindow = false;
  255. }
  256. /// <summary>
  257. /// 考勤
  258. /// </summary>
  259. private void showKaoqin()
  260. {
  261. //if (
  262. // attendanceWindow != null &&
  263. // !attendanceWindow.IsFocused
  264. // )
  265. //{
  266. // attendanceWindow.Focus();
  267. //}
  268. //else
  269. //{
  270. try
  271. {
  272. #region 关闭冲突页面
  273. //if (IsOpenAttendanceWindow)
  274. //{
  275. // return;
  276. //}
  277. //else
  278. //{
  279. // CloseOrHideWindowPage();
  280. //}
  281. #endregion 关闭冲突页面
  282. if (APP.W_AttendanceWindow == null)
  283. {
  284. APP.W_AttendanceWindow = new AttendanceWindow
  285. {
  286. Owner = this
  287. };
  288. //APP.W_AttendanceWindow.Closed += AttendanceWindow_Closed;
  289. }
  290. else
  291. {
  292. //APP.W_AttendanceWindow.Initialize();
  293. }
  294. //IsOpenAttendanceWindow = true;
  295. APP.W_AttendanceWindow.Show();
  296. }
  297. catch (Exception ex)
  298. {
  299. //IsOpenAttendanceWindow = false;
  300. //attendanceWindow = null;
  301. LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
  302. }
  303. //}
  304. }
  305. /// <summary>
  306. /// 黑板
  307. /// </summary>
  308. /// <param name="sender"></param>
  309. /// <param name="e"></param>
  310. private void Heiban_btn_Click(object sender, RoutedEventArgs e)
  311. {
  312. try
  313. {
  314. heibanshow = !heibanshow;
  315. #region 关闭冲突页面
  316. //CloseOrHideWindowPage();
  317. #endregion 关闭冲突页面
  318. List<DependencyObject> list = new List<DependencyObject>
  319. {
  320. heiban_btn,
  321. pizhu_btn
  322. };
  323. hideOrShow(heibanshow, ketangTool, list);
  324. if (APP.W_ZBlackboardWindow == null)
  325. {
  326. APP.W_ZBlackboardWindow = new ZBlackboardWindow
  327. {
  328. Topmost = true,
  329. Width = pwidth,
  330. Height = pHeight,
  331. Left = 0,
  332. Top = 0,
  333. Owner = this
  334. };
  335. //APP.W_ZBlackboardWindow.click_closeClick += BlackboardWin2_click_closeClick;
  336. }
  337. //ZSocketServer.getInstance().addWin(blackboardWin2);
  338. APP.W_ZBlackboardWindow.ShowDialog();
  339. }
  340. catch (Exception ex)
  341. {
  342. LogHelper.WriteErrLog("【黑板(Heiban_btn_Click)" + ex.Message, ex);
  343. }
  344. }
  345. /// <summary>
  346. /// 批注
  347. /// </summary>
  348. /// <param name="sender"></param>
  349. /// <param name="e"></param>
  350. private void Pizhu_btn_Click(object sender, RoutedEventArgs e)
  351. {
  352. try
  353. {
  354. heibanshow = !heibanshow;
  355. #region 关闭冲突页面
  356. //CloseOrHideWindowPage();
  357. #endregion 关闭冲突页面
  358. List<DependencyObject> list = new List<DependencyObject>
  359. {
  360. heiban_btn,
  361. pizhu_btn
  362. };
  363. hideOrShow(heibanshow, ketangTool, list);
  364. if (APP.W_PracticeWindow == null)
  365. {
  366. APP.W_PracticeWindow = new PracticeWindow();
  367. APP.W_PracticeWindow.click_closeClick += PracticeWin_click_closeClick;
  368. APP.W_PracticeWindow.Topmost = true;//zhangxueyang
  369. APP.W_PracticeWindow.Width = pwidth;
  370. APP.W_PracticeWindow.Height = pHeight;
  371. APP.W_PracticeWindow.Left = 0;
  372. APP.W_PracticeWindow.Top = 0;
  373. APP.W_PracticeWindow.Unloaded += PracticeWin_Unloaded;
  374. }
  375. APP.W_PracticeWindow.Owner = this;//zhangxueyang
  376. Hide();
  377. addimage();
  378. //ZSocketServer.getInstance().addWin(practiceWin);
  379. APP.W_PracticeWindow.ShowDialog();
  380. }
  381. catch (Exception ex)
  382. {
  383. LogHelper.WriteErrLog("【批注(Pizhu_btn_Click)" + ex.Message, ex);
  384. }
  385. }
  386. /// <summary>
  387. /// 添加截图到批注
  388. /// </summary>
  389. private void addimage()
  390. {
  391. string ImagePath = ImageHelper.GetTempImagePath();
  392. ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), ImagePath,false,out BitmapImage bitmapImage,-1);
  393. APP.W_PracticeWindow.addImage(ImagePath);
  394. }
  395. /// <summary>
  396. /// 批注关闭
  397. /// </summary>
  398. private void PracticeWin_click_closeClick()
  399. {
  400. APP.W_PracticeWindow = null;
  401. }
  402. /// <summary>
  403. /// 批注关闭时显示工具栏
  404. /// </summary>
  405. /// <param name="sender"></param>
  406. /// <param name="e"></param>
  407. private void PracticeWin_Unloaded(object sender, RoutedEventArgs e)
  408. {
  409. Show();
  410. }
  411. /// <summary>
  412. /// 结束课堂
  413. /// </summary>
  414. private void closeAction()
  415. {
  416. //MyApp.myloading.Show();//加载等待
  417. try
  418. {
  419. //#region 加载通知栏图标
  420. //System.Windows.Forms.NotifyIcon ico = new System.Windows.Forms.NotifyIcon
  421. //{
  422. // Icon = new System.Drawing.Icon(FileToolsCommon.GetFileAbsolutePath("favicon256.ico")),
  423. // //this.Icon.DoubleClick += Icon_DoubleClick;//双击恢复 暂无
  424. // Visible = true
  425. //};
  426. //#endregion 加载通知栏图标
  427. //WindowState = WindowState.Minimized;
  428. //#region 关闭已打开窗口
  429. //pageData.tongping = !pageData.tongping;
  430. ////停止屏幕共享
  431. //if (pageData.tongping)
  432. //{
  433. // tongpingEnd();
  434. // pageData.menuList[1].Pic = "../Images/MainInterface/屏幕共享@2x.png";
  435. // pageData.menuList[1].Name = "屏幕共享";
  436. // gridAnimated.Visibility = Visibility.Collapsed;
  437. //}
  438. //if (blackboardWin2 != null)
  439. //{
  440. // blackboardWin2.Close();
  441. //}
  442. //if (rollCallWindow != null)
  443. //{
  444. // rollCallWindow.Close();
  445. //}
  446. //if (classroomExamWindow != null)
  447. //{
  448. // classroomExamWindow.Close();
  449. //}
  450. //if (classReportWindow != null)
  451. //{
  452. // classReportWindow.Close();
  453. //}
  454. //if (practiceWin != null)
  455. //{
  456. // practiceWin.Close();
  457. //}
  458. //if (classroomQuestionsWindow != null)
  459. //{
  460. // classroomQuestionsWindow.Close();
  461. //}
  462. //if (jietuWindow != null)
  463. //{
  464. // jietuWindow.Close();
  465. //}
  466. //if (attendanceWindow != null)
  467. //{
  468. // attendanceWindow.Close();
  469. //}
  470. //if (userCenterWindow != null)
  471. //{
  472. // userCenterWindow.Close();
  473. //}
  474. //#endregion 关闭已打开窗口
  475. //new Thread(o =>
  476. //{
  477. // StopNginx();
  478. // string msg = ZSocketMsgManger.classEnd();
  479. // ZSocketServer.getInstance().SendMessage(msg);
  480. // #region 清除没有上线人数的课堂数据
  481. // /*
  482. // * 上传本地数据库数据
  483. // * 判断该节课是否有人上线 若没人在线删除本节课数据。
  484. // * 可能存在多节课 1.多节课都没人上线,删除所有数据不上传。 2.多节课有上线的有没上线的情况,删除没有上线人数课的数据,将其余数据上传。
  485. // *
  486. // *
  487. // *
  488. // */
  489. // List<ClassData> classDataList = new List<ClassData>();
  490. // classDataList = ZSqliteManger.queryClassData();//取所有数据
  491. // if (classDataList.Count > 0)
  492. // {
  493. // for (int i = 0; i < classDataList.Count; i++)
  494. // {
  495. // if ("startclass".Equals(classDataList[i].api))//获取每节课的课堂id
  496. // {
  497. // List<ClassData> classroomidDataList = new List<ClassData>();
  498. // classroomidDataList = ZSqliteManger.queryClassRoomidData(classDataList[i].roomid);//取该节课的所有数据
  499. // for (int j = 0; j < classroomidDataList.Count; j++)
  500. // {
  501. // if ("sign".Equals(classroomidDataList[j].api))//若存在上线学生跳出循环
  502. // {
  503. // break;
  504. // }
  505. // if (j + 1 == classroomidDataList.Count)//若遍历完所有数据仍没有上线学生,删除该课堂id下所有数据
  506. // {
  507. // ZSqliteManger.clearClassData(classroomidDataList[j].roomid);
  508. // if (classroomidDataList[j].roomid == ZCommonData.roomid)
  509. // {
  510. // try
  511. // {
  512. // string path = ZConfig.classRoomImagePath();
  513. // if (Directory.Exists(path))
  514. // {
  515. // Directory.Delete(path, true);
  516. // }
  517. // }
  518. // catch (Exception ex)
  519. // {
  520. // LogHelper.WriteErrLog("ToolbarWindow(删除无效课堂文件夹报错:)" + ex.Message, ex);
  521. // }
  522. // }
  523. // }
  524. // }
  525. // }
  526. // }
  527. // classDataList = new List<ClassData>();
  528. // classDataList = ZSqliteManger.queryClassData();//取所有数据
  529. // }
  530. // #endregion
  531. // if (classDataList.Count > 0)
  532. // {
  533. // bool isRoomid = false;
  534. // for (int i = 0; i < classDataList.Count; i++)
  535. // {
  536. // if (classDataList[i].roomid == ZCommonData.roomid)
  537. // {
  538. // isRoomid = true;
  539. // }
  540. // }
  541. // if (isRoomid)
  542. // {
  543. // Dictionary<string, object> stopclass = new Dictionary<string, object>
  544. // {
  545. // { "roomid", ZCommonData.roomid },
  546. // { "endtime", ZNumUtil.unixTime() }
  547. // };
  548. // ZCommonData.askid = ZNumUtil.randomNum();
  549. // ZSqliteManger.insertClassData(new ClassData()
  550. // {
  551. // unix = ZNumUtil.unixTime(),
  552. // roomid = ZCommonData.roomid,
  553. // api = "stopclass",
  554. // json = ZJsonHelper.ToJson(stopclass),
  555. // askid = ZCommonData.askid
  556. // });
  557. // }
  558. // }
  559. // ZSocketServer.getInstance().Dispose();
  560. // if (classDataList.Count > 0)
  561. // {
  562. // MyApp.ZipFile();
  563. // }
  564. Dispatcher.Invoke(new Action(() =>
  565. {
  566. System.Environment.Exit(0);
  567. }));
  568. //}).Start();
  569. }
  570. catch (Exception ex)
  571. {
  572. LogHelper.WriteErrLog("【ToolbarWindow】(closeAction)" + ex.Message, ex);
  573. }
  574. }
  575. /// <summary>
  576. /// 二级工具栏打开隐藏
  577. /// </summary>
  578. /// <param name="toolShow"></param>
  579. /// <param name="target"></param>
  580. /// <param name="contentList"></param>
  581. private void hideOrShow(bool toolShow, DependencyObject target, List<DependencyObject> contentList)
  582. {
  583. Storyboard story = new Storyboard();
  584. DoubleAnimation da = new DoubleAnimation();
  585. if (toolShow)
  586. {
  587. da.From = 0;
  588. da.To = 173;
  589. }
  590. else
  591. {
  592. da.From = 173.0;
  593. da.To = 0.0;
  594. }
  595. //可选属性:是否往返播放
  596. da.AutoReverse = false;
  597. //da.RepeatBehavior = RepeatBehavior.Forever;
  598. //da.RepeatBehavior = new RepeatBehavior(2);
  599. da.Duration = new Duration(TimeSpan.FromSeconds(0.3));
  600. Storyboard.SetTarget(da, target);
  601. Storyboard.SetTargetProperty(da, new PropertyPath("Width"));
  602. story.Children.Add(da);
  603. foreach (DependencyObject item in contentList)
  604. {
  605. DoubleAnimation da2 = new DoubleAnimation();
  606. if (toolShow)
  607. {
  608. da2.From = 0;
  609. da2.To = 1.0;
  610. }
  611. else
  612. {
  613. da2.From = 1.0;
  614. da2.To = 0.0;
  615. }
  616. da2.Duration = new Duration(TimeSpan.FromSeconds(0.1));
  617. Storyboard.SetTarget(da2, item);
  618. Storyboard.SetTargetProperty(da2, new PropertyPath("Opacity"));
  619. story.Children.Add(da2);
  620. }
  621. story.Begin();
  622. }
  623. /// <summary>
  624. /// 工具栏打开与缩放
  625. /// </summary>
  626. /// <param name="toolShow"></param>
  627. /// <param name="target"></param>
  628. /// <param name="contentList"></param>
  629. private void hideOrShowToolbar(bool toolShow, DependencyObject target, List<DependencyObject> contentList)
  630. {
  631. if (txbName.Visibility == Visibility.Visible)
  632. {
  633. txbName.Visibility = Visibility.Collapsed;
  634. //if ("正在共享".Equals(pageData.menuList[1].Name))
  635. //{
  636. // gridAnimated.Visibility = Visibility.Collapsed;
  637. //}
  638. }
  639. else
  640. {
  641. txbName.Visibility = Visibility.Visible;
  642. //if("正在共享".Equals(pageData.menuList[1].Name))
  643. //{
  644. // gridAnimated.Visibility = Visibility.Visible;
  645. //}
  646. }
  647. Storyboard story = new Storyboard();
  648. DoubleAnimation da = new DoubleAnimation();
  649. if (toolShow)
  650. {
  651. da.From = 0;
  652. da.To = 670;
  653. }
  654. else
  655. {
  656. da.From = 670;
  657. da.To = 0.0;
  658. }
  659. //可选属性:是否往返播放
  660. da.AutoReverse = false;
  661. //da.RepeatBehavior = RepeatBehavior.Forever;
  662. //da.RepeatBehavior = new RepeatBehavior(2);
  663. da.Duration = new Duration(TimeSpan.FromSeconds(0.3));
  664. Storyboard.SetTarget(da, target);
  665. Storyboard.SetTargetProperty(da, new PropertyPath("Height"));
  666. story.Children.Add(da);
  667. foreach (DependencyObject item in contentList)
  668. {
  669. DoubleAnimation da2 = new DoubleAnimation();
  670. if (toolShow)
  671. {
  672. da2.From = 0;
  673. da2.To = 1.0;
  674. }
  675. else
  676. {
  677. da2.From = 1.0;
  678. da2.To = 0.0;
  679. }
  680. da2.Duration = new Duration(TimeSpan.FromSeconds(0.1));
  681. Storyboard.SetTarget(da2, item);
  682. Storyboard.SetTargetProperty(da2, new PropertyPath("Opacity"));
  683. story.Children.Add(da2);
  684. }
  685. story.Begin();
  686. }
  687. private void toolbar_win_Closed(object sender, EventArgs e)
  688. {
  689. }
  690. private void toolbar_win_ContentRendered(object sender, EventArgs e)
  691. {
  692. }
  693. private void toolbar_win_Loaded(object sender, RoutedEventArgs e)
  694. {
  695. }
  696. private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
  697. {
  698. }
  699. private int time = NumUtil.unixTime();
  700. private void Rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  701. {
  702. int temptime = NumUtil.unixTime();
  703. if (temptime - time < 1)
  704. {
  705. pageData.IsOpen = !pageData.IsOpen;
  706. List<DependencyObject> list = new List<DependencyObject>
  707. {
  708. toolbar_list
  709. };
  710. hideOrShowToolbar(pageData.IsOpen, toolbar, list);
  711. if (!pageData.IsOpen)
  712. {
  713. if (heibanshow)
  714. {
  715. List<DependencyObject> list3 = new List<DependencyObject>();
  716. heibanshow = false;
  717. list3.Add(heiban_btn);
  718. list3.Add(pizhu_btn);
  719. hideOrShow(heibanshow, ketangTool, list3);
  720. }
  721. }
  722. }
  723. }
  724. /// <summary>
  725. /// 工具栏移动事件
  726. /// </summary>
  727. /// <param name="sender"></param>
  728. /// <param name="e"></param>
  729. private void Rectangle_MouseMove(object sender, MouseEventArgs e)
  730. {
  731. if (e.LeftButton == MouseButtonState.Pressed)
  732. {
  733. DragMove();
  734. }
  735. }
  736. #endregion
  737. #region 方法
  738. /// <summary>
  739. /// 启动WS
  740. /// </summary>
  741. private void startSocket()
  742. {
  743. //ZSocketServer.getInstance().startWsServer();
  744. }
  745. #endregion
  746. }
  747. /// <summary>
  748. /// 工具栏模型
  749. /// </summary>
  750. public class ToolbarModel : NotifyModel
  751. {
  752. public ObservableCollection<ToolbarMenu> menuList { get; set; }
  753. internal bool _tongping = false;
  754. public bool tongping
  755. {
  756. get => _tongping;
  757. set { _tongping = value; OnPropertyChanged("tongping"); }
  758. }
  759. internal bool _IsOpen = true;
  760. public bool IsOpen
  761. {
  762. get => _IsOpen;
  763. set { _IsOpen = value; OnPropertyChanged("IsOpen"); }
  764. }
  765. public ToolbarModel()
  766. {
  767. menuList = new ObservableCollection<ToolbarMenu>();
  768. }
  769. }
  770. /// <summary>
  771. /// 工具栏菜单模型
  772. /// </summary>
  773. public class ToolbarMenu : NotifyModel
  774. {
  775. internal string _name;
  776. public string Name
  777. {
  778. get => _name;
  779. set { _name = value; OnPropertyChanged("Name"); }
  780. }
  781. internal string _Pic;
  782. public string Pic
  783. {
  784. get => _Pic;
  785. set { _Pic = value; OnPropertyChanged("Pic"); }
  786. }
  787. }
  788. }