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 { /// /// 主页面 /// public partial class XHMicroLessonSystemWindow : Window { #region 字段 /// /// 文件目录窗口 /// //private CountdownWindow FileDirectoryWindows = null; private FolderBrowserDialog Ofd; private DialogResult Result; #endregion #region 初始化 /// /// 主页面 /// public XHMicroLessonSystemWindow() { InitializeComponent(); Initialize(); } /// /// 初始化 /// public void Initialize() { //创建 DrawingAttributes 类的一个实例 drawingAttributes = new DrawingAttributes(); //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用 //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型 blackboard_canvas.DefaultDrawingAttributes = drawingAttributes; drawingAttributes.FitToCurve = true; } #endregion #region 事件 /// /// 窗体移动 /// /// /// private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DragMove(); } /// /// 摄像头打开事件 /// /// /// 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); } } /// /// 摄像头关闭事件 /// /// /// private void RbnTurnOff_Click(object sender, RoutedEventArgs e) { wfhCamera.Visibility = Visibility.Hidden; CameraHelper.CloseDevice(); } #endregion /// /// 录屏事件 /// /// /// private void BtnScreenRecording_Click(object sender, RoutedEventArgs e) { CountdownWindow win = new CountdownWindow(); win.Topmost = true; win.Show(); this.Close(); } /// /// 上传事件 /// /// /// private void BtnUpload_Click(object sender, RoutedEventArgs e) { FileDirectoryWindow fileDirectoryWindow = new FileDirectoryWindow(); fileDirectoryWindow.Show(); } /// /// 关闭事件 /// /// /// private void BtnDown_Click(object sender, RoutedEventArgs e) { this.Close(); } /// /// 设置 保存事件 /// /// /// private void BtnSave_Click(object sender, RoutedEventArgs e) { gridMain.Visibility = Visibility.Visible; gridSetUp.Visibility = Visibility.Collapsed; } /// /// 设置事件 /// /// /// private void BtnSetUp_Click(object sender, RoutedEventArgs e) { gridMain.Visibility = Visibility.Collapsed; gridSetUp.Visibility = Visibility.Visible; } /// /// 设置 浏览事件 /// /// /// 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); } } } /// /// 画笔颜色事件 白色 /// /// /// 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; /// /// 画笔颜色事件 红色 /// /// /// private void BtnRed_Click(object sender, RoutedEventArgs e) { //设置 DrawingAttributes 的 Color 属性设置颜色 drawingAttributes.Color = Colors.Red; } /// /// 画笔颜色事件 灰色 /// /// /// private void BtnGray_Click(object sender, RoutedEventArgs e) { drawingAttributes.Color = Colors.Gray; } /// /// 画笔颜色事件 青色 /// /// /// private void BtnCyanBlue_Click(object sender, RoutedEventArgs e) { drawingAttributes.Color = Colors.LimeGreen; } /// /// 画笔颜色事件 黄色 /// /// /// private void BtnYellow_Click(object sender, RoutedEventArgs e) { drawingAttributes.Color = Colors.Gold; } /// /// 画笔颜色事件 蓝色 /// /// /// private void BtnBlue_Click(object sender, RoutedEventArgs e) { drawingAttributes.Color = Colors.DeepSkyBlue; } /// /// 画笔粗细 细 /// /// /// private void RbnFine_Click(object sender, RoutedEventArgs e) { drawingAttributes.Width = 1; drawingAttributes.Height = 1; } /// /// 画笔粗细 中 /// /// /// private void RbnIn_Click(object sender, RoutedEventArgs e) { drawingAttributes.Width = 3; drawingAttributes.Height = 3; } /// /// 画笔粗细 粗 /// /// /// private void RbnCrude_Click(object sender, RoutedEventArgs e) { drawingAttributes.Width = 5; drawingAttributes.Height = 5; } } }