123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920 |
- 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;
- using System.Windows.Media.Animation;
- using System.Threading;
-
- 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();
- /// <summary>
- /// 是否已打开课堂工具二级列表
- /// </summary>
- private bool heibanshow = false;
- #endregion
-
- #region 初始化
- public ToolbarWindow()
- {
- InitializeComponent();
-
- if (!APP.CheckScreenCapturerRecorder())
- {
- MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
- APP.InstallScreenCapturerRecorder();
- }
-
- txbName.Text = APP.LoginUser.username;
-
- heiban_btn.Click += Heiban_btn_Click;
- pizhu_btn.Click += Pizhu_btn_Click;
- 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;
-
- Thread t = new Thread(new ThreadStart(startSocket))
- {
- IsBackground = true
- };
- t.Start();
- }
- #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();
- if (StartLive(out string ErrMessage))
- {
- pageData.menuList[1].Pic = "../Images/ToolBar/img_shared_1.gif";
- pageData.menuList[1].Name = "正在直播";
-
- if (APP.W_CameraWindow == null)
- {
- APP.W_CameraWindow = new CameraWindow();
- APP.W_CameraWindow.Topmost = true;
- APP.W_CameraWindow.Left = pwidth - 300;
- APP.W_CameraWindow.Top = 0;
- }
- APP.W_CameraWindow.Show();
- }
- else
- {
- pageData.tongping = !pageData.tongping;
- MessageWindow.Show(ErrMessage);
- }
- }
- else
- {
- //tongpingEnd();
- EndLive();
- pageData.menuList[1].Pic = "../Images/ToolBar/直播@2x.png";
- pageData.menuList[1].Name = "直播";
- APP.W_CameraWindow.Hide();
- }
- }
- else if (clickindex == 2)//抢答点名
- {
- //HideLevel2();
- try
- {
- //#region 关闭冲突页面
-
- //if (IsOpenRollCallWindow)
- //{
- // return;
- //}
- //else
- //{
- // CloseOrHideWindowPage();
- //}
-
- //#endregion 关闭冲突页面
-
- if (APP.W_RollCallWindow == null)
- {
- APP.W_RollCallWindow = new RollCallWindow();
- //APP.W_RollCallWindow.click_closeClick += RollCallWindow_click_closeClick;
- }
- else
- {
- //APP.W_RollCallWindow.Initialize();
- }
- APP.W_RollCallWindow.Owner = this;
- //ZSocketServer.getInstance().addWin(rollCallWindow);
- //IsOpenRollCallWindow = true;
- APP.W_RollCallWindow.Show();
- }
- catch (Exception ex)
- {
- //IsOpenRollCallWindow = false;
- //rollCallWindow = null;
- LogHelper.WriteErrLog("【抢答点名(toolbar_item_Click)" + ex.Message, ex);
- }
- }
- else if (clickindex == 3)//课堂工具。
- {
- 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 == 4)//本节考勤
- {
- //HideLevel2();
- try
- {
- showKaoqin();
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
- }
- }
- else if (clickindex == 5)//结束课堂。
- {
- 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;
- }
- /// <summary>
- /// 考勤
- /// </summary>
- private void showKaoqin()
- {
- //if (
- // attendanceWindow != null &&
- // !attendanceWindow.IsFocused
- // )
- //{
- // attendanceWindow.Focus();
- //}
- //else
- //{
- try
- {
- #region 关闭冲突页面
-
- //if (IsOpenAttendanceWindow)
- //{
- // return;
- //}
- //else
- //{
- // CloseOrHideWindowPage();
- //}
-
- #endregion 关闭冲突页面
-
- if (APP.W_AttendanceWindow == null)
- {
- APP.W_AttendanceWindow = new AttendanceWindow
- {
- Owner = this
- };
- //APP.W_AttendanceWindow.Closed += AttendanceWindow_Closed;
- }
- else
- {
- //APP.W_AttendanceWindow.Initialize();
- }
- //IsOpenAttendanceWindow = true;
- APP.W_AttendanceWindow.Show();
- }
- catch (Exception ex)
- {
- //IsOpenAttendanceWindow = false;
- //attendanceWindow = null;
- LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
- }
- //}
- }
- /// <summary>
- /// 黑板
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Heiban_btn_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- heibanshow = !heibanshow;
-
- #region 关闭冲突页面
-
- //CloseOrHideWindowPage();
-
- #endregion 关闭冲突页面
-
- List<DependencyObject> list = new List<DependencyObject>
- {
- heiban_btn,
- pizhu_btn
- };
- hideOrShow(heibanshow, ketangTool, list);
- if (APP.W_ZBlackboardWindow == null)
- {
- APP.W_ZBlackboardWindow = new ZBlackboardWindow
- {
- Topmost = true,
- Width = pwidth,
- Height = pHeight,
- Left = 0,
- Top = 0,
- Owner = this
- };
- //APP.W_ZBlackboardWindow.click_closeClick += BlackboardWin2_click_closeClick;
- }
- //ZSocketServer.getInstance().addWin(blackboardWin2);
- APP.W_ZBlackboardWindow.ShowDialog();
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【黑板(Heiban_btn_Click)" + ex.Message, ex);
- }
- }
- /// <summary>
- /// 批注
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Pizhu_btn_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- heibanshow = !heibanshow;
-
- #region 关闭冲突页面
-
- //CloseOrHideWindowPage();
-
- #endregion 关闭冲突页面
-
- List<DependencyObject> list = new List<DependencyObject>
- {
- heiban_btn,
- pizhu_btn
- };
- hideOrShow(heibanshow, ketangTool, list);
- if (APP.W_PracticeWindow == null)
- {
- APP.W_PracticeWindow = new PracticeWindow();
- APP.W_PracticeWindow.click_closeClick += PracticeWin_click_closeClick;
- APP.W_PracticeWindow.Topmost = true;//zhangxueyang
- APP.W_PracticeWindow.Width = pwidth;
- APP.W_PracticeWindow.Height = pHeight;
- APP.W_PracticeWindow.Left = 0;
- APP.W_PracticeWindow.Top = 0;
-
- APP.W_PracticeWindow.Unloaded += PracticeWin_Unloaded;
- }
- APP.W_PracticeWindow.Owner = this;//zhangxueyang
- Hide();
- addimage();
- //ZSocketServer.getInstance().addWin(practiceWin);
- APP.W_PracticeWindow.ShowDialog();
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【批注(Pizhu_btn_Click)" + ex.Message, ex);
- }
- }
- /// <summary>
- /// 添加截图到批注
- /// </summary>
- private void addimage()
- {
- string ImagePath = ImageHelper.GetTempImagePath();
- ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), ImagePath,false,out BitmapImage bitmapImage,-1);
- APP.W_PracticeWindow.addImage(ImagePath);
- }
- /// <summary>
- /// 批注关闭
- /// </summary>
- private void PracticeWin_click_closeClick()
- {
- APP.W_PracticeWindow = null;
- }
- /// <summary>
- /// 批注关闭时显示工具栏
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void PracticeWin_Unloaded(object sender, RoutedEventArgs e)
- {
- Show();
- }
- /// <summary>
- /// 结束课堂
- /// </summary>
- private void closeAction()
- {
- //MyApp.myloading.Show();//加载等待
-
- try
- {
- //#region 加载通知栏图标
-
- //System.Windows.Forms.NotifyIcon ico = new System.Windows.Forms.NotifyIcon
- //{
- // Icon = new System.Drawing.Icon(FileToolsCommon.GetFileAbsolutePath("favicon256.ico")),
- // //this.Icon.DoubleClick += Icon_DoubleClick;//双击恢复 暂无
- // Visible = true
- //};
-
- //#endregion 加载通知栏图标
-
- //WindowState = WindowState.Minimized;
-
- //#region 关闭已打开窗口
-
- //pageData.tongping = !pageData.tongping;
- ////停止屏幕共享
- //if (pageData.tongping)
- //{
- // tongpingEnd();
- // pageData.menuList[1].Pic = "../Images/MainInterface/屏幕共享@2x.png";
- // pageData.menuList[1].Name = "屏幕共享";
- // gridAnimated.Visibility = Visibility.Collapsed;
- //}
- //if (blackboardWin2 != null)
- //{
- // blackboardWin2.Close();
- //}
- //if (rollCallWindow != null)
- //{
- // rollCallWindow.Close();
- //}
- //if (classroomExamWindow != null)
- //{
- // classroomExamWindow.Close();
- //}
- //if (classReportWindow != null)
- //{
- // classReportWindow.Close();
- //}
- //if (practiceWin != null)
- //{
- // practiceWin.Close();
- //}
- //if (classroomQuestionsWindow != null)
- //{
- // classroomQuestionsWindow.Close();
- //}
- //if (jietuWindow != null)
- //{
- // jietuWindow.Close();
- //}
- //if (attendanceWindow != null)
- //{
- // attendanceWindow.Close();
- //}
- //if (userCenterWindow != null)
- //{
- // userCenterWindow.Close();
- //}
-
- //#endregion 关闭已打开窗口
-
-
-
- //new Thread(o =>
- //{
- // StopNginx();
- // string msg = ZSocketMsgManger.classEnd();
- // ZSocketServer.getInstance().SendMessage(msg);
-
-
- // #region 清除没有上线人数的课堂数据
- // /*
- // * 上传本地数据库数据
- // * 判断该节课是否有人上线 若没人在线删除本节课数据。
- // * 可能存在多节课 1.多节课都没人上线,删除所有数据不上传。 2.多节课有上线的有没上线的情况,删除没有上线人数课的数据,将其余数据上传。
- // *
- // *
- // *
- // */
- // List<ClassData> classDataList = new List<ClassData>();
- // classDataList = ZSqliteManger.queryClassData();//取所有数据
-
-
- // if (classDataList.Count > 0)
- // {
- // for (int i = 0; i < classDataList.Count; i++)
- // {
- // if ("startclass".Equals(classDataList[i].api))//获取每节课的课堂id
- // {
- // List<ClassData> classroomidDataList = new List<ClassData>();
- // classroomidDataList = ZSqliteManger.queryClassRoomidData(classDataList[i].roomid);//取该节课的所有数据
- // for (int j = 0; j < classroomidDataList.Count; j++)
- // {
- // if ("sign".Equals(classroomidDataList[j].api))//若存在上线学生跳出循环
- // {
- // break;
- // }
- // if (j + 1 == classroomidDataList.Count)//若遍历完所有数据仍没有上线学生,删除该课堂id下所有数据
- // {
- // ZSqliteManger.clearClassData(classroomidDataList[j].roomid);
- // if (classroomidDataList[j].roomid == ZCommonData.roomid)
- // {
- // try
- // {
- // string path = ZConfig.classRoomImagePath();
- // if (Directory.Exists(path))
- // {
- // Directory.Delete(path, true);
- // }
- // }
- // catch (Exception ex)
- // {
- // LogHelper.WriteErrLog("ToolbarWindow(删除无效课堂文件夹报错:)" + ex.Message, ex);
- // }
- // }
- // }
- // }
- // }
- // }
-
- // classDataList = new List<ClassData>();
- // classDataList = ZSqliteManger.queryClassData();//取所有数据
- // }
- // #endregion
-
- // if (classDataList.Count > 0)
- // {
- // bool isRoomid = false;
- // for (int i = 0; i < classDataList.Count; i++)
- // {
- // if (classDataList[i].roomid == ZCommonData.roomid)
- // {
- // isRoomid = true;
- // }
- // }
-
- // if (isRoomid)
- // {
- // Dictionary<string, object> stopclass = new Dictionary<string, object>
- // {
- // { "roomid", ZCommonData.roomid },
- // { "endtime", ZNumUtil.unixTime() }
- // };
- // ZCommonData.askid = ZNumUtil.randomNum();
- // ZSqliteManger.insertClassData(new ClassData()
- // {
- // unix = ZNumUtil.unixTime(),
- // roomid = ZCommonData.roomid,
- // api = "stopclass",
- // json = ZJsonHelper.ToJson(stopclass),
- // askid = ZCommonData.askid
- // });
- // }
- // }
- // ZSocketServer.getInstance().Dispose();
-
- // if (classDataList.Count > 0)
- // {
- // MyApp.ZipFile();
- // }
-
-
- Dispatcher.Invoke(new Action(() =>
- {
- System.Environment.Exit(0);
- }));
- //}).Start();
- }
- catch (Exception ex)
- {
-
- LogHelper.WriteErrLog("【ToolbarWindow】(closeAction)" + ex.Message, ex);
- }
-
-
- }
- /// <summary>
- /// 二级工具栏打开隐藏
- /// </summary>
- /// <param name="toolShow"></param>
- /// <param name="target"></param>
- /// <param name="contentList"></param>
- private void hideOrShow(bool toolShow, DependencyObject target, List<DependencyObject> contentList)
- {
- Storyboard story = new Storyboard();
- DoubleAnimation da = new DoubleAnimation();
- if (toolShow)
- {
- da.From = 0;
- da.To = 173;
- }
- else
- {
- da.From = 173.0;
- da.To = 0.0;
- }
-
- //可选属性:是否往返播放
- da.AutoReverse = false;
- //da.RepeatBehavior = RepeatBehavior.Forever;
- //da.RepeatBehavior = new RepeatBehavior(2);
- da.Duration = new Duration(TimeSpan.FromSeconds(0.3));
- Storyboard.SetTarget(da, target);
- Storyboard.SetTargetProperty(da, new PropertyPath("Width"));
- story.Children.Add(da);
-
- foreach (DependencyObject item in contentList)
- {
- DoubleAnimation da2 = new DoubleAnimation();
- if (toolShow)
- {
- da2.From = 0;
- da2.To = 1.0;
- }
- else
- {
- da2.From = 1.0;
- da2.To = 0.0;
- }
- da2.Duration = new Duration(TimeSpan.FromSeconds(0.1));
- Storyboard.SetTarget(da2, item);
- Storyboard.SetTargetProperty(da2, new PropertyPath("Opacity"));
- story.Children.Add(da2);
- }
-
- story.Begin();
- }
- /// <summary>
- /// 工具栏打开与缩放
- /// </summary>
- /// <param name="toolShow"></param>
- /// <param name="target"></param>
- /// <param name="contentList"></param>
- private void hideOrShowToolbar(bool toolShow, DependencyObject target, List<DependencyObject> contentList)
- {
- if (txbName.Visibility == Visibility.Visible)
- {
- txbName.Visibility = Visibility.Collapsed;
- //if ("正在共享".Equals(pageData.menuList[1].Name))
- //{
- // gridAnimated.Visibility = Visibility.Collapsed;
- //}
- }
- else
- {
- txbName.Visibility = Visibility.Visible;
- //if("正在共享".Equals(pageData.menuList[1].Name))
- //{
- // gridAnimated.Visibility = Visibility.Visible;
- //}
- }
-
- Storyboard story = new Storyboard();
- DoubleAnimation da = new DoubleAnimation();
- if (toolShow)
- {
- da.From = 0;
- da.To = 670;
- }
- else
- {
- da.From = 670;
- da.To = 0.0;
- }
-
- //可选属性:是否往返播放
- da.AutoReverse = false;
- //da.RepeatBehavior = RepeatBehavior.Forever;
- //da.RepeatBehavior = new RepeatBehavior(2);
- da.Duration = new Duration(TimeSpan.FromSeconds(0.3));
- Storyboard.SetTarget(da, target);
- Storyboard.SetTargetProperty(da, new PropertyPath("Height"));
- story.Children.Add(da);
-
- foreach (DependencyObject item in contentList)
- {
- DoubleAnimation da2 = new DoubleAnimation();
- if (toolShow)
- {
- da2.From = 0;
- da2.To = 1.0;
- }
- else
- {
- da2.From = 1.0;
- da2.To = 0.0;
- }
- da2.Duration = new Duration(TimeSpan.FromSeconds(0.1));
- Storyboard.SetTarget(da2, item);
- Storyboard.SetTargetProperty(da2, new PropertyPath("Opacity"));
- story.Children.Add(da2);
- }
-
- story.Begin();
- }
- 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 int time = NumUtil.unixTime();
- private void Rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- int temptime = NumUtil.unixTime();
- if (temptime - time < 1)
- {
- pageData.IsOpen = !pageData.IsOpen;
-
- List<DependencyObject> list = new List<DependencyObject>
- {
- toolbar_list
- };
-
- hideOrShowToolbar(pageData.IsOpen, toolbar, list);
-
- if (!pageData.IsOpen)
- {
- if (heibanshow)
- {
- List<DependencyObject> list3 = new List<DependencyObject>();
- heibanshow = false;
- list3.Add(heiban_btn);
- list3.Add(pizhu_btn);
- hideOrShow(heibanshow, ketangTool, list3);
- }
- }
- }
- }
- /// <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
-
- #region 方法
- /// <summary>
- /// 启动WS
- /// </summary>
- private void startSocket()
- {
- //ZSocketServer.getInstance().startWsServer();
- }
- #endregion
- #region 直播
- /// <summary>
- /// 直播间节点和房号
- /// </summary>
- string NodeKey = "live/test";
- /// <summary>
- /// 开始直播
- /// </summary>
- public bool StartLive(out string ErrMessage)
- {
- try
- {
-
-
-
- //NodeKey=Node+Key;
- System.Drawing.Size DesktopSize = PrimaryScreen.DESKTOP;
- //开始直播
- if(APP.FFmpeg.StartLiveRecordingVideo(APP.RTMPServerPath, NodeKey, DesktopSize,out ErrMessage))
- {
- return true;
- }
- else
- {
- return false;
- }
-
- }
- catch (Exception ex)
- {
- ErrMessage = "无法开始直播:" + ex.Message;
- LogHelper.WriteErrLog(ErrMessage, ex);
- return false;
- }
- }
- /// <summary>
- /// 结束直播
- /// </summary>
- public void EndLive()
- {
- APP.FFmpeg.StopLive();
- }
- #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"); }
- }
- }
- }
|