星火微课系统客户端
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.

XHMicroLessonSystemWindow.xaml.cs 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. using Common.system;
  2. using System;
  3. using System.Windows;
  4. using System.Windows.Forms;
  5. using System.Windows.Ink;
  6. using System.Windows.Input;
  7. using System.Windows.Media;
  8. namespace XHWK.WKTool
  9. {
  10. /// <summary>
  11. /// 主页面
  12. /// </summary>
  13. public partial class XHMicroLessonSystemWindow : Window
  14. {
  15. #region 初始值
  16. /// <summary>
  17. /// 文件目录窗口
  18. /// </summary>
  19. //private CountdownWindow FileDirectoryWindows = null;
  20. private FolderBrowserDialog Ofd;
  21. private DialogResult Result;
  22. #endregion
  23. #region 初始化
  24. /// <summary>
  25. /// 主页面
  26. /// </summary>
  27. public XHMicroLessonSystemWindow()
  28. {
  29. InitializeComponent();
  30. Initialize();
  31. }
  32. /// <summary>
  33. /// 初始化
  34. /// </summary>
  35. public void Initialize()
  36. {
  37. //创建 DrawingAttributes 类的一个实例
  38. drawingAttributes = new DrawingAttributes();
  39. //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用
  40. //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型
  41. blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
  42. drawingAttributes.FitToCurve = true;
  43. }
  44. #endregion
  45. #region 事件
  46. /// <summary>
  47. /// 窗体移动
  48. /// </summary>
  49. /// <param name="sender"></param>
  50. /// <param name="e"></param>
  51. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  52. {
  53. DragMove();
  54. }
  55. /// <summary>
  56. /// 摄像头打开事件
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="e"></param>
  60. private void RbnOpen_Click(object sender, RoutedEventArgs e)
  61. {
  62. //UCCamera win = new UCCamera();
  63. ////win.Topmost = true;
  64. //win.ShowDialog();
  65. wfhCamera.Visibility = Visibility.Visible;
  66. CameraHelper.IsDisplay = true;
  67. CameraHelper.SourcePlayer = player;
  68. CameraHelper.UpdateCameraDevices();
  69. if (CameraHelper.CameraDevices.Count > 0)
  70. {
  71. CameraHelper.SetCameraDevice(0);
  72. }
  73. }
  74. /// <summary>
  75. /// 摄像头关闭事件
  76. /// </summary>
  77. /// <param name="sender"></param>
  78. /// <param name="e"></param>
  79. private void RbnTurnOff_Click(object sender, RoutedEventArgs e)
  80. {
  81. wfhCamera.Visibility = Visibility.Hidden;
  82. CameraHelper.CloseDevice();
  83. }
  84. #endregion
  85. /// <summary>
  86. /// 录屏事件
  87. /// </summary>
  88. /// <param name="sender"></param>
  89. /// <param name="e"></param>
  90. private void BtnScreenRecording_Click(object sender, RoutedEventArgs e)
  91. {
  92. if (APP.W_CountdownWindow == null)
  93. {
  94. APP.W_CountdownWindow = new CountdownWindow();
  95. //APP.W_CountdownWindow.Topmost = true;
  96. }
  97. else
  98. {
  99. APP.W_CountdownWindow.Initialize();
  100. APP.W_CountdownWindow.Topmost = true;
  101. }
  102. APP.W_CountdownWindow.Show();
  103. if (APP.W_ScreenRecordingToolbarWindow == null)
  104. {
  105. APP.W_ScreenRecordingToolbarWindow = new ScreenRecordingToolbarWindow
  106. {
  107. Topmost = true
  108. };
  109. APP.W_ScreenRecordingToolbarWindow.Initialize();
  110. }
  111. else
  112. {
  113. APP.W_ScreenRecordingToolbarWindow.Initialize();
  114. }
  115. //显示在右下角
  116. //APP.W_ScreenRecordingToolbarWindow.Left= PrimaryScreen.DESKTOP.Width - APP.W_ScreenRecordingToolbarWindow.Width - 10;
  117. //APP.W_ScreenRecordingToolbarWindow.Top= PrimaryScreen.DESKTOP.Height - APP.W_ScreenRecordingToolbarWindow.Height - 60;
  118. this.Hide();
  119. Hide();
  120. }
  121. /// <summary>
  122. /// 上传事件
  123. /// </summary>
  124. /// <param name="sender"></param>
  125. /// <param name="e"></param>
  126. private void BtnUpload_Click(object sender, RoutedEventArgs e)
  127. {
  128. FileDirectoryWindow fileDirectoryWindow = new FileDirectoryWindow();
  129. fileDirectoryWindow.Show();
  130. }
  131. /// <summary>
  132. /// 关闭事件
  133. /// </summary>
  134. /// <param name="sender"></param>
  135. /// <param name="e"></param>
  136. private void BtnDown_Click(object sender, RoutedEventArgs e)
  137. {
  138. this.Close();
  139. }
  140. /// <summary>
  141. /// 设置 保存事件
  142. /// </summary>
  143. /// <param name="sender"></param>
  144. /// <param name="e"></param>
  145. private void BtnSave_Click(object sender, RoutedEventArgs e)
  146. {
  147. gridMain.Visibility = Visibility.Visible;
  148. gridSetUp.Visibility = Visibility.Collapsed;
  149. }
  150. /// <summary>
  151. /// 设置事件
  152. /// </summary>
  153. /// <param name="sender"></param>
  154. /// <param name="e"></param>
  155. private void BtnSetUp_Click(object sender, RoutedEventArgs e)
  156. {
  157. gridMain.Visibility = Visibility.Collapsed;
  158. gridSetUp.Visibility = Visibility.Visible;
  159. }
  160. /// <summary>
  161. /// 设置 浏览事件
  162. /// </summary>
  163. /// <param name="sender"></param>
  164. /// <param name="e"></param>
  165. private void BtnBrowse_Click(object sender, RoutedEventArgs e)
  166. {
  167. string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  168. Ofd = new System.Windows.Forms.FolderBrowserDialog();
  169. Result = Ofd.ShowDialog();
  170. if (Result == System.Windows.Forms.DialogResult.OK)
  171. {
  172. if (Ofd.SelectedPath != "")
  173. {
  174. txbStoragePath.Text = Ofd.SelectedPath;
  175. //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
  176. //string temp = ofd.SelectedPath;
  177. //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
  178. }
  179. }
  180. }
  181. /// <summary>
  182. /// 画笔颜色事件 白色
  183. /// </summary>
  184. /// <param name="sender"></param>
  185. /// <param name="e"></param>
  186. private void BtnWhite_Click(object sender, RoutedEventArgs e)
  187. {
  188. //创建 DrawingAttributes 类的一个实例
  189. drawingAttributes = new DrawingAttributes();
  190. //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用
  191. //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型
  192. blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
  193. //设置 DrawingAttributes 的 Color 属性设置颜色
  194. drawingAttributes.Color = Colors.White;
  195. }
  196. //声明一个 DrawingAttributes 类型的变量
  197. DrawingAttributes drawingAttributes;
  198. /// <summary>
  199. /// 画笔颜色事件 红色
  200. /// </summary>
  201. /// <param name="sender"></param>
  202. /// <param name="e"></param>
  203. private void BtnRed_Click(object sender, RoutedEventArgs e)
  204. {
  205. //设置 DrawingAttributes 的 Color 属性设置颜色
  206. drawingAttributes.Color = Colors.Red;
  207. }
  208. /// <summary>
  209. /// 画笔颜色事件 灰色
  210. /// </summary>
  211. /// <param name="sender"></param>
  212. /// <param name="e"></param>
  213. private void BtnGray_Click(object sender, RoutedEventArgs e)
  214. {
  215. drawingAttributes.Color = Colors.Gray;
  216. }
  217. /// <summary>
  218. /// 画笔颜色事件 青色
  219. /// </summary>
  220. /// <param name="sender"></param>
  221. /// <param name="e"></param>
  222. private void BtnCyanBlue_Click(object sender, RoutedEventArgs e)
  223. {
  224. drawingAttributes.Color = Colors.LimeGreen;
  225. }
  226. /// <summary>
  227. /// 画笔颜色事件 黄色
  228. /// </summary>
  229. /// <param name="sender"></param>
  230. /// <param name="e"></param>
  231. private void BtnYellow_Click(object sender, RoutedEventArgs e)
  232. {
  233. drawingAttributes.Color = Colors.Gold;
  234. }
  235. /// <summary>
  236. /// 画笔颜色事件 蓝色
  237. /// </summary>
  238. /// <param name="sender"></param>
  239. /// <param name="e"></param>
  240. private void BtnBlue_Click(object sender, RoutedEventArgs e)
  241. {
  242. drawingAttributes.Color = Colors.DeepSkyBlue;
  243. }
  244. /// <summary>
  245. /// 画笔粗细 细
  246. /// </summary>
  247. /// <param name="sender"></param>
  248. /// <param name="e"></param>
  249. private void RbnFine_Click(object sender, RoutedEventArgs e)
  250. {
  251. drawingAttributes.Width = 1;
  252. drawingAttributes.Height = 1;
  253. }
  254. /// <summary>
  255. /// 画笔粗细 中
  256. /// </summary>
  257. /// <param name="sender"></param>
  258. /// <param name="e"></param>
  259. private void RbnIn_Click(object sender, RoutedEventArgs e)
  260. {
  261. drawingAttributes.Width = 3;
  262. drawingAttributes.Height = 3;
  263. }
  264. /// <summary>
  265. /// 画笔粗细 粗
  266. /// </summary>
  267. /// <param name="sender"></param>
  268. /// <param name="e"></param>
  269. private void RbnCrude_Click(object sender, RoutedEventArgs e)
  270. {
  271. drawingAttributes.Width = 5;
  272. drawingAttributes.Height = 5;
  273. }
  274. }
  275. }