123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- using XHZB.Model;
- using Common.ZB;
- using XHZB.Desktop.Utils;
- using Common.system;
-
- namespace XHZB.Desktop
- {
- /// <summary>
- /// ToolbarWindow.xaml 的交互逻辑
- /// </summary>
- public partial class ToolbarWindow : Window
- {
- #region 字段
- /// <summary>
- /// 屏幕宽
- /// </summary>
- internal double pwidth = SystemParameters.PrimaryScreenWidth;
- /// <summary>
- /// 屏幕高
- /// </summary>
- internal double pHeight = SystemParameters.PrimaryScreenHeight;
- /// <summary>
- /// 工具栏数据
- /// </summary>
- internal ToolbarModel pageData = new ToolbarModel();
- #endregion
-
- #region 初始化
- public ToolbarWindow()
- {
- InitializeComponent();
- Topmost = true;
- Left = pwidth - 300;
- Top = (pHeight - 568) / 2;
-
- pageData.menuList.Add(new ToolbarMenu()
- {
- Name = "个人空间",
- Pic = "../Images/ToolBar/我的备课@2x.png"
- });
- pageData.menuList.Add(new ToolbarMenu()
- {
- Name = "直播",
- Pic = "../Images/ToolBar/直播@2x.png"
- });
- pageData.menuList.Add(new ToolbarMenu()
- {
- Name = "抢答点名",
- Pic = "../Images/ToolBar/抢答@2x.png"
- });
- pageData.menuList.Add(new ToolbarMenu()
- {
- Name = "课堂工具",
- Pic = "../Images/ToolBar/黑板01@2x.png"
- });
- pageData.menuList.Add(new ToolbarMenu()
- {
- Name = "本节考勤",
- Pic = "../Images/ToolBar/本节考勤01@2x.png"
- });
- pageData.menuList.Add(new ToolbarMenu()
- {
- Name = "结束课堂",
- Pic = "../Images/ToolBar/下课@2x.png"
- });
-
- DataContext = pageData;
- }
- #endregion
-
-
-
-
-
-
- #region 事件
- /// <summary>
- /// 模块点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void toolbar_item_Click(object sender, RoutedEventArgs e)
- {
- int clickindex = 0;
- List<Button> buttons = VTHelper.FindChilds<Button>(toolbar_list, "toolbar_item");
- for (int i = 0; i < buttons.Count; i++)
- {
- if (buttons[i] == sender)
- {
- clickindex = i;
- break;
- }
- }
- ToolbarMenu item = pageData.menuList[clickindex];
- if (clickindex == 0)//个人空间
- {
- try
- {
- //HideLevel2();
- if (APP.W_UserCenterWindow != null && !APP.W_UserCenterWindow.IsFocused)
- {
- APP.W_UserCenterWindow.Focus();
- }
- else
- {
- APP.W_UserCenterWindow = new UserCenterWindow();
- APP.W_UserCenterWindow.Show();
- APP.W_UserCenterWindow.Closed += UserCenterWindow_Closed;
- }
- //IsOpenUserCenterWindow = true;
- }
- catch (Exception ex)
- {
- //IsOpenUserCenterWindow = false;
- //userCenterWindow = null;
- LogHelper.WriteErrLog("【个人空间(toolbar_item_Click)" + ex.Message, ex);
- }
- }
- else if (clickindex == 1)//直播
- {
- //HideLevel2();
- pageData.tongping = !pageData.tongping;
- if (pageData.tongping)
- {
- //tongpingBegin();
- pageData.menuList[1].Pic = "../Images/ToolBar/img_shared_1.gif";
- pageData.menuList[1].Name = "正在直播";
- }
- else
- {
- //tongpingEnd();
- pageData.menuList[1].Pic = "../Images/ToolBar/直播@2x.png";
- pageData.menuList[1].Name = "直播";
- }
- }
- //else if (clickindex == 2)//课堂提问
- //{
- // HideLevel2();
- // try
- // {
- // #region 关闭冲突页面
-
- // CloseOrHideWindowPage();
- // #endregion 关闭冲突页面
-
- // if (screenshotWindow != null)
- // {
- // screenshotWindow.initialization();
- // }
- // else
- // {
- // screenshotWindow = new ScreenshotWindow();
- // // 订阅事件
- // screenshotWindow.ChangeTextEvent += new ChangeTextHandler(frm_ChangeTextEvent);
- // screenshotWindow.click_closeJietuWindowClick += JietuWindow_click_closeJietuWindowClick;
-
- // }
-
- // screenshotWindow.Owner = this;
- // screenshotWindow.Show();
- // jietuType = 1;
- // //ZSocketServer.getInstance().addWin(jietuWindow);
- // //jietuWindow = null;
- // //GC.Collect();
- // }
- // catch (Exception ex)
- // {
- // jietuWindow = null;
- // LogHelper.WriteErrLog("【课堂提问(toolbar_item_Click)" + ex.Message, ex);
- // }
- //}
- //else if (clickindex == 4)//抢答点名
- //{
- // HideLevel2();
- // try
- // {
- // #region 关闭冲突页面
-
- // if (IsOpenRollCallWindow)
- // {
- // return;
- // }
- // else
- // {
- // CloseOrHideWindowPage();
- // }
-
- // #endregion 关闭冲突页面
-
- // if (rollCallWindow == null)
- // {
- // rollCallWindow = new RollCallWindow();
- // rollCallWindow.click_closeClick += RollCallWindow_click_closeClick;
- // }
- // else
- // {
- // rollCallWindow.Initialize();
- // }
- // rollCallWindow.Owner = this;
- // //ZSocketServer.getInstance().addWin(rollCallWindow);
- // IsOpenRollCallWindow = true;
- // rollCallWindow.Show();
- // }
- // catch (Exception ex)
- // {
- // IsOpenRollCallWindow = false;
- // rollCallWindow = null;
- // LogHelper.WriteErrLog("【抢答点名(toolbar_item_Click)" + ex.Message, ex);
- // }
- //}
- //else if (clickindex == 5)//课堂工具。
- //{
- // try
- // {
- // heibanshow = !heibanshow;
- // List<DependencyObject> list = new List<DependencyObject>
- // {
- // heiban_btn,
- // pizhu_btn
- // };
- // if (tangceshow)
- // {
- // tangceshow = !tangceshow;
- // List<DependencyObject> lists = new List<DependencyObject>
- // {
- // import_word_btn,
- // jietu_btn
- // };
- // hideOrShow(tangceshow, tangceTool, lists);
- // }
- // hideOrShow(heibanshow, ketangTool, list);
- // }
- // catch (Exception ex)
- // {
- // LogHelper.WriteErrLog("【课堂工具(toolbar_item_Click)" + ex.Message, ex);
- // }
- //}
- //else if (clickindex == 7)//本节考勤
- //{
- // HideLevel2();
- // try
- // {
- // showKaoqin();
- // }
- // catch (Exception ex)
- // {
- // LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
- // }
- //}
- //else if (clickindex == 8)//结束课堂。
- //{
- // if (MessageWindow.Show("是否结束课堂?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
- // {
- // closeAction();
- // }
- //}
- }
- /// <summary>
- /// 个人空间关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void UserCenterWindow_Closed(object sender, EventArgs e)
- {
- APP.W_UserCenterWindow = null;
- //IsOpenUserCenterWindow = false;
- }
- private void toolbar_win_Closed(object sender, EventArgs e)
- {
-
- }
-
- private void toolbar_win_ContentRendered(object sender, EventArgs e)
- {
-
- }
-
- private void toolbar_win_Loaded(object sender, RoutedEventArgs e)
- {
-
- }
-
- private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
- {
-
- }
-
- private void Rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
-
- }
- /// <summary>
- /// 工具栏移动事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Rectangle_MouseMove(object sender, MouseEventArgs e)
- {
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- DragMove();
- }
- }
- #endregion
- }
- /// <summary>
- /// 工具栏模型
- /// </summary>
- public class ToolbarModel : NotifyModel
- {
- public ObservableCollection<ToolbarMenu> menuList { get; set; }
-
- internal bool _tongping = false;
-
- public bool tongping
- {
- get => _tongping;
- set { _tongping = value; OnPropertyChanged("tongping"); }
- }
-
- internal bool _IsOpen = true;
-
- public bool IsOpen
- {
- get => _IsOpen;
- set { _IsOpen = value; OnPropertyChanged("IsOpen"); }
- }
-
- public ToolbarModel()
- {
- menuList = new ObservableCollection<ToolbarMenu>();
- }
- }
-
- /// <summary>
- /// 工具栏菜单模型
- /// </summary>
- public class ToolbarMenu : NotifyModel
- {
- internal string _name;
-
- public string Name
- {
- get => _name;
- set { _name = value; OnPropertyChanged("Name"); }
- }
-
- internal string _Pic;
-
- public string Pic
- {
- get => _Pic;
- set { _Pic = value; OnPropertyChanged("Pic"); }
- }
- }
- }
|