123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- using Common.system;
- using System;
- using System.Collections.Generic;
- 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.Forms;
- using System.Windows.Ink;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
-
- namespace XHWK.WKTool
- {
- /// <summary>
- /// 主页面
- /// </summary>
- public partial class XHMicroLessonSystemWindow : Window
- {
- #region 字段
- /// <summary>
- /// 文件目录窗口
- /// </summary>
- //private CountdownWindow FileDirectoryWindows = null;
- private FolderBrowserDialog Ofd;
- private DialogResult Result;
- #endregion
-
- #region 初始化
- /// <summary>
- /// 主页面
- /// </summary>
- public XHMicroLessonSystemWindow()
- {
- InitializeComponent();
- Initialize();
- }
- /// <summary>
- /// 初始化
- /// </summary>
- public void Initialize()
- {
- //创建 DrawingAttributes 类的一个实例
- drawingAttributes = new DrawingAttributes();
- //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用
- //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型
- blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
- drawingAttributes.FitToCurve = true;
- }
- #endregion
-
- #region 事件
- /// <summary>
- /// 窗体移动
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- DragMove();
- }
- /// <summary>
- /// 摄像头打开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void RbnOpen_Click(object sender, RoutedEventArgs e)
- {
- //UCCamera win = new UCCamera();
- ////win.Topmost = true;
- //win.ShowDialog();
-
-
-
- wfhCamera.Visibility = Visibility.Visible;
- CameraHelper.IsDisplay = true;
- CameraHelper.SourcePlayer = player;
- CameraHelper.UpdateCameraDevices();
- if (CameraHelper.CameraDevices.Count > 0)
- {
- CameraHelper.SetCameraDevice(0);
- }
- }
- /// <summary>
- /// 摄像头关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void RbnTurnOff_Click(object sender, RoutedEventArgs e)
- {
- wfhCamera.Visibility = Visibility.Hidden;
- CameraHelper.CloseDevice();
- }
- #endregion
- /// <summary>
- /// 录屏事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnScreenRecording_Click(object sender, RoutedEventArgs e)
- {
- CountdownWindow win = new CountdownWindow();
- win.Topmost = true;
- win.Show();
- this.Close();
- }
- /// <summary>
- /// 上传事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnUpload_Click(object sender, RoutedEventArgs e)
- {
- FileDirectoryWindow fileDirectoryWindow = new FileDirectoryWindow();
- fileDirectoryWindow.Show();
- }
- /// <summary>
- /// 关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnDown_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 设置 保存事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnSave_Click(object sender, RoutedEventArgs e)
- {
- gridMain.Visibility = Visibility.Visible;
- gridSetUp.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 设置事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnSetUp_Click(object sender, RoutedEventArgs e)
- {
- gridMain.Visibility = Visibility.Collapsed;
- gridSetUp.Visibility = Visibility.Visible;
- }
- /// <summary>
- /// 设置 浏览事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnBrowse_Click(object sender, RoutedEventArgs e)
- {
- string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- Ofd = new System.Windows.Forms.FolderBrowserDialog();
-
- Result = Ofd.ShowDialog();
- if (Result == System.Windows.Forms.DialogResult.OK)
- {
- if (Ofd.SelectedPath != "")
- {
- txbStoragePath.Text = Ofd.SelectedPath;
- //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
- //string temp = ofd.SelectedPath;
- //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
- }
- }
- }
- /// <summary>
- /// 画笔颜色事件 白色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnWhite_Click(object sender, RoutedEventArgs e)
- {
- //创建 DrawingAttributes 类的一个实例
- drawingAttributes = new DrawingAttributes();
- //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用
- //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型
- blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
- //设置 DrawingAttributes 的 Color 属性设置颜色
- drawingAttributes.Color = Colors.White;
- }
- //声明一个 DrawingAttributes 类型的变量
- DrawingAttributes drawingAttributes;
- /// <summary>
- /// 画笔颜色事件 红色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnRed_Click(object sender, RoutedEventArgs e)
- {
-
- //设置 DrawingAttributes 的 Color 属性设置颜色
- drawingAttributes.Color = Colors.Red;
- }
- /// <summary>
- /// 画笔颜色事件 灰色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnGray_Click(object sender, RoutedEventArgs e)
- {
- drawingAttributes.Color = Colors.Gray;
- }
- /// <summary>
- /// 画笔颜色事件 青色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnCyanBlue_Click(object sender, RoutedEventArgs e)
- {
- drawingAttributes.Color = Colors.LimeGreen;
- }
- /// <summary>
- /// 画笔颜色事件 黄色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnYellow_Click(object sender, RoutedEventArgs e)
- {
- drawingAttributes.Color = Colors.Gold;
- }
- /// <summary>
- /// 画笔颜色事件 蓝色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnBlue_Click(object sender, RoutedEventArgs e)
- {
- drawingAttributes.Color = Colors.DeepSkyBlue;
- }
- /// <summary>
- /// 画笔粗细 细
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void RbnFine_Click(object sender, RoutedEventArgs e)
- {
- drawingAttributes.Width = 1;
- drawingAttributes.Height = 1;
- }
- /// <summary>
- /// 画笔粗细 中
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void RbnIn_Click(object sender, RoutedEventArgs e)
- {
- drawingAttributes.Width = 3;
- drawingAttributes.Height = 3;
- }
- /// <summary>
- /// 画笔粗细 粗
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void RbnCrude_Click(object sender, RoutedEventArgs e)
- {
- drawingAttributes.Width = 5;
- drawingAttributes.Height = 5;
- }
- }
- }
|