星火微课系统客户端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

XHMicroLessonSystemWindow.xaml.cs 9.0KB

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