Browse Source

优化

tags/录制修改前
zhangxueyang 4 years ago
parent
commit
356f329ee8

+ 23
- 4
Common/system/BlackboardNew.cs View File

333
         StylusPoint stylusPoint = new StylusPoint();
333
         StylusPoint stylusPoint = new StylusPoint();
334
         Stroke stroke;
334
         Stroke stroke;
335
         bool isFirst = true;
335
         bool isFirst = true;
336
-        //public void changepages(double _x, double _y, bool _new, Color _color, int _size)
336
+        //public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
337
         //{
337
         //{
338
         //    if (_new)
338
         //    if (_new)
339
         //    {
339
         //    {
349
         //            stroke.DrawingAttributes = drawingAttributes;
349
         //            stroke.DrawingAttributes = drawingAttributes;
350
         //            m_canvas.Strokes.Add(stroke);
350
         //            m_canvas.Strokes.Add(stroke);
351
         //            isFirst = true;
351
         //            isFirst = true;
352
+
353
+        //            strokes_page_all[i].lines.Last().lines_curr.Add(stroke);
354
+        //            //int currCount = strokes_page_all[i].lines.Last().lines_curr.Count;
355
+        //            //if (currCount > 0)
356
+        //            //{
357
+        //            //    strokes_page_all[i].lines.Last().lines_curr[currCount - 1].add = stroke;
358
+        //            //}
359
+
360
+
352
         //        }
361
         //        }
353
 
362
 
354
         //        stylusPoints = new StylusPointCollection();
363
         //        stylusPoints = new StylusPointCollection();
372
         //        }
381
         //        }
373
         //        else
382
         //        else
374
         //        {
383
         //        {
375
-        //            if(m_canvas.Strokes.Count)
376
-        //            stylusPoint.X = _x;
384
+        //            if (m_canvas.Strokes.Count>0)
385
+        //            {
386
+
387
+
388
+        //                stylusPoint.X = _x;
377
         //            stylusPoint.Y = _y;
389
         //            stylusPoint.Y = _y;
378
         //            stylusPoints.Add(stylusPoint);
390
         //            stylusPoints.Add(stylusPoint);
379
         //            stroke = new Stroke(stylusPoints);
391
         //            stroke = new Stroke(stylusPoints);
380
         //            m_canvas.Strokes[m_canvas.Strokes.Count - 1].StylusPoints.Add(stylusPoints);
392
         //            m_canvas.Strokes[m_canvas.Strokes.Count - 1].StylusPoints.Add(stylusPoints);
393
+        //            }
381
         //        }
394
         //        }
382
         //    }
395
         //    }
383
         //}
396
         //}
397
 
410
 
398
 
411
 
399
 
412
 
400
-        public void changepages(double _x, double _y, bool _new, Color _color, int _size,int i)
413
+        public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
401
         {
414
         {
402
             try
415
             try
403
             {
416
             {
418
 
431
 
419
                         m_canvas.Strokes.Add(stroke);
432
                         m_canvas.Strokes.Add(stroke);
420
                         strokes_page_all[i].lines.Last().lines_curr.Add(stroke);
433
                         strokes_page_all[i].lines.Last().lines_curr.Add(stroke);
434
+
435
+                        //int currCount= strokes_page_all[i].lines.Last().lines_curr.Count;
436
+                        //if (currCount > 0)
437
+                        //{
438
+                        //    strokes_page_all[i].lines.Last().lines_curr[currCount - 1] = stroke;
439
+                        //}
421
                         stroke = null;
440
                         stroke = null;
422
                     }
441
                     }
423
 
442
 

+ 4
- 4
XHWK.WKTool/App.cs View File

127
         /// 打印
127
         /// 打印
128
         /// </summary>
128
         /// </summary>
129
         public static PrintWindow W_PrintWindow = null;
129
         public static PrintWindow W_PrintWindow = null;
130
-        /// <summary>
131
-        /// 提示窗口
132
-        /// </summary>
133
-        public static PromptWindow W_PromptWindow = null;
130
+        ///// <summary>
131
+        ///// 提示窗口
132
+        ///// </summary>
133
+        //public static PromptWindow W_PromptWindow = null;
134
         #endregion
134
         #endregion
135
         #endregion
135
         #endregion
136
 
136
 

+ 4
- 4
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

159
                 <Image x:Name="imgPlayerRight" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right"  Margin="10,7,26,10" VerticalAlignment="Top" Visibility="Collapsed"/>
159
                 <Image x:Name="imgPlayerRight" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right"  Margin="10,7,26,10" VerticalAlignment="Top" Visibility="Collapsed"/>
160
                 <Image x:Name="imgPlayerLeftUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Left"  Margin="10,7,10,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
160
                 <Image x:Name="imgPlayerLeftUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Left"  Margin="10,7,10,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
161
                 <Image x:Name="imgPlayerRightUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right" Margin="10,7,26,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
161
                 <Image x:Name="imgPlayerRightUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right" Margin="10,7,26,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
162
-                <Label Content="" Grid.Column="0" HorizontalAlignment="Left" Height="10" VerticalAlignment="Top" Width="10" Background="#FF0F0F0F" Margin="1,0,0,0"/>
163
-                <Label Content="" Grid.Column="1" Height="10" Width="10" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
164
-                <Label Content="" Grid.Column="0" Height="10" Width="10" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
165
-                <Label Content="" Grid.Column="1" Height="10" Width="10" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,16,0"/>
162
+                <Label Content="" Grid.Column="0" Height="2" Width="2" HorizontalAlignment="Left"  VerticalAlignment="Top" Background="#FF0F0F0F" Margin="1,0,0,0"/>
163
+                <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
164
+                <Label Content="" Grid.Column="0" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
165
+                <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,16,0"/>
166
             </Grid>
166
             </Grid>
167
            
167
            
168
             <Grid Grid.Row="1">
168
             <Grid Grid.Row="1">

+ 85
- 122
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

188
                         if (I > 10010)
188
                         if (I > 10010)
189
                         {
189
                         {
190
                             long time = Timestamp();
190
                             long time = Timestamp();
191
-                        string imgPath= FileToolsCommon.GetFileAbsolutePath("Temp/imgplayer");
191
+                            string imgPath = FileToolsCommon.GetFileAbsolutePath("Temp/imgplayer");
192
                             //string FilePathName = ImgPath + RsImgName.Count + ".png";
192
                             //string FilePathName = ImgPath + RsImgName.Count + ".png";
193
                             string path = CameraHelper.CaptureImage(imgPath, time.ToString());
193
                             string path = CameraHelper.CaptureImage(imgPath, time.ToString());
194
                             if (!string.IsNullOrWhiteSpace(path))
194
                             if (!string.IsNullOrWhiteSpace(path))
327
                 Login();
327
                 Login();
328
                 return;
328
                 return;
329
             }
329
             }
330
-            if(APP.fileDirectoryWindow==null)
330
+            if (APP.fileDirectoryWindow == null)
331
             {
331
             {
332
                 APP.fileDirectoryWindow = new FileDirectoryWindow();
332
                 APP.fileDirectoryWindow = new FileDirectoryWindow();
333
                 //APP.fileDirectoryWindow.Topmost = true;
333
                 //APP.fileDirectoryWindow.Topmost = true;
692
             {
692
             {
693
                 if (!string.IsNullOrWhiteSpace(APP.ImgPath) && File.Exists(APP.ImgPath))
693
                 if (!string.IsNullOrWhiteSpace(APP.ImgPath) && File.Exists(APP.ImgPath))
694
                 {
694
                 {
695
-                    if(APP.pageData.currpage==0)
695
+                    if (APP.pageData.currpage == 0)
696
                     {
696
                     {
697
                         APP.pageData.pagenum += 1;
697
                         APP.pageData.pagenum += 1;
698
                         APP.pageData.currpage = APP.pageData.pagenum;
698
                         APP.pageData.currpage = APP.pageData.pagenum;
905
                             string paths = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
905
                             string paths = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
906
                             string[] page = ConvertWordToImage(filepath, paths, "", 0, 0, null, 0).ToArray();
906
                             string[] page = ConvertWordToImage(filepath, paths, "", 0, 0, null, 0).ToArray();
907
                             int num = 0;
907
                             int num = 0;
908
-                            for (int i = 0+ APP.pageData.pagenum; i < page.Length+ APP.pageData.pagenum; i++)//给画板模型加图片路径
908
+                            for (int i = 0 + APP.pageData.pagenum; i < page.Length + APP.pageData.pagenum; i++)//给画板模型加图片路径
909
                             {
909
                             {
910
-                                if (APP.PageDrawList!=null&&APP.PageDrawList.Count > i)
910
+                                if (APP.PageDrawList != null && APP.PageDrawList.Count > i)
911
                                 {
911
                                 {
912
-                                    APP.PageDrawList[i].PageImagePath = page[i- APP.pageData.pagenum]; //zxycs
913
-                                    APP.PageDrawList[i].PdfImagePath = page[i- APP.pageData.pagenum];
912
+                                    APP.PageDrawList[i].PageImagePath = page[i - APP.pageData.pagenum]; //zxycs
913
+                                    APP.PageDrawList[i].PdfImagePath = page[i - APP.pageData.pagenum];
914
                                     APP.PageDrawList[i].PageNum = i + 1;
914
                                     APP.PageDrawList[i].PageNum = i + 1;
915
                                     APP.PageDrawList[i].ImgDocumentation = true;
915
                                     APP.PageDrawList[i].ImgDocumentation = true;
916
                                 }
916
                                 }
917
                                 else
917
                                 else
918
                                 {
918
                                 {
919
-                                  
919
+
920
                                     Model_DrawData model_DrawData = new Model_DrawData();
920
                                     Model_DrawData model_DrawData = new Model_DrawData();
921
-                                    model_DrawData.PageImagePath = page[i- APP.pageData.pagenum];
922
-                                    model_DrawData.PdfImagePath = page[i- APP.pageData.pagenum];
921
+                                    model_DrawData.PageImagePath = page[i - APP.pageData.pagenum];
922
+                                    model_DrawData.PdfImagePath = page[i - APP.pageData.pagenum];
923
                                     model_DrawData.PageNum = i + 1;
923
                                     model_DrawData.PageNum = i + 1;
924
                                     model_DrawData.ImgDocumentation = true;
924
                                     model_DrawData.ImgDocumentation = true;
925
                                     APP.PageDrawList.Add(model_DrawData);
925
                                     APP.PageDrawList.Add(model_DrawData);
930
                                 APP.SaveDraw();
930
                                 APP.SaveDraw();
931
                                 num++;
931
                                 num++;
932
                             }
932
                             }
933
-                            if(num>0)
933
+                            if (num > 0)
934
                             {
934
                             {
935
                                 APP.pageData.currpage = APP.pageData.pagenum + 1;
935
                                 APP.pageData.currpage = APP.pageData.pagenum + 1;
936
                                 APP.pageData.pagenum += num;
936
                                 APP.pageData.pagenum += num;
937
                             }
937
                             }
938
-                            if (APP.pageData.currpage>0 && APP.pageData.currpage < APP.PageDrawList.Count)
938
+                            if (APP.pageData.currpage > 0 && APP.pageData.currpage < APP.PageDrawList.Count)
939
                             {
939
                             {
940
                                 imgDocumentation.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));//给当前页面展示图片
940
                                 imgDocumentation.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));//给当前页面展示图片
941
                                 imgCanvas.Source = null;
941
                                 imgCanvas.Source = null;
1016
         /// <param name="e"></param>
1016
         /// <param name="e"></param>
1017
         private void BtnRecord_Click(object sender, RoutedEventArgs e)
1017
         private void BtnRecord_Click(object sender, RoutedEventArgs e)
1018
         {
1018
         {
1019
-            if(APP.pageData.currpage > 0)
1019
+            if (APP.pageData.currpage > 0)
1020
             {
1020
             {
1021
                 blackboard_canvas.Visibility = Visibility.Visible;
1021
                 blackboard_canvas.Visibility = Visibility.Visible;
1022
             }
1022
             }
1251
                 ImgSetUpTwo.Visibility = Visibility.Collapsed;
1251
                 ImgSetUpTwo.Visibility = Visibility.Collapsed;
1252
                 btnSetUp.IsEnabled = true;
1252
                 btnSetUp.IsEnabled = true;
1253
 
1253
 
1254
-                btnLoginType.IsEnabled = true; 
1254
+                btnLoginType.IsEnabled = true;
1255
                 #endregion
1255
                 #endregion
1256
 
1256
 
1257
                 IsSuspendR = true;
1257
                 IsSuspendR = true;
1327
         /// <param name="e"></param>
1327
         /// <param name="e"></param>
1328
         private void BtnAdd_Click(object sender, RoutedEventArgs e)
1328
         private void BtnAdd_Click(object sender, RoutedEventArgs e)
1329
         {
1329
         {
1330
-      //      RectangleF rectangleF = new RectangleF();
1331
-      //      rectangleF.Width = (float)APP.PageDrawList[0].ImageSizes.CenterX;
1332
-      //      rectangleF.Height = (float)APP.PageDrawList[0].ImageSizes.CenterY;
1333
-      //      rectangleF.X= (float)APP.PageDrawList[0].ImageLocation.X;
1334
-      //      rectangleF.Y = (float)APP.PageDrawList[0].ImageLocation.Y;
1335
-
1336
-      //      //CESHI 
1337
-      //bool isImg=    MergerImg(APP.PageDrawList[0].PageImagePath, @"G:\102H.jpg", rectangleF, out string errmsg);
1338
-
1339
-
1340
-
1341
-                if (APP.pageData.currpage>0)
1342
-                {
1343
-                    APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
1344
-                }
1345
-                if(IsStartCount&& blackboard_canvas.Visibility == Visibility.Collapsed)
1346
-                {
1347
-                    blackboard_canvas.Visibility = Visibility.Visible;
1348
-                }
1349
-                APP.pageData.pagenum += 1;
1350
-                APP.pageData.currpage = APP.pageData.pagenum;
1351
-                myblackboard.changepage(APP.pageData.currpage - 1);
1352
-                ///清空页面图片UI
1353
-                imgCanvas.Source = null;
1330
+            if (APP.pageData.currpage > 0)
1331
+            {
1332
+                APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
1333
+            }
1334
+            if (IsStartCount && blackboard_canvas.Visibility == Visibility.Collapsed)
1335
+            {
1336
+                blackboard_canvas.Visibility = Visibility.Visible;
1337
+            }
1338
+            APP.pageData.pagenum += 1;
1339
+            APP.pageData.currpage = APP.pageData.pagenum;
1340
+            myblackboard.changepage(APP.pageData.currpage - 1);
1341
+            ///清空页面图片UI
1342
+            imgCanvas.Source = null;
1354
             imgDocumentation.Source = null;
1343
             imgDocumentation.Source = null;
1355
-                ///画板模型增加一页
1356
-                Model_DrawData model_DrawData = new Model_DrawData();
1357
-                model_DrawData.PageNum = APP.pageData.currpage;
1358
-                APP.PageDrawList.Add(model_DrawData);
1359
-                APP.SaveDraw();
1360
-            ///截图可用
1361
-            ImgScreenshot.Visibility = Visibility.Visible;
1362
-            ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1363
-            btnScreenshot.IsEnabled = true;
1344
+            ///画板模型增加一页
1345
+            Model_DrawData model_DrawData = new Model_DrawData();
1346
+            model_DrawData.PageNum = APP.pageData.currpage;
1347
+            APP.PageDrawList.Add(model_DrawData);
1348
+            APP.SaveDraw();
1349
+            if (btnImport.IsEnabled == true)
1350
+            {
1351
+                ///截图可用
1352
+                ImgScreenshot.Visibility = Visibility.Visible;
1353
+                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1354
+                btnScreenshot.IsEnabled = true;
1355
+            }
1364
         }
1356
         }
1365
         /// <summary>
1357
         /// <summary>
1366
         /// 打印事件
1358
         /// 打印事件
1375
 
1367
 
1376
 
1368
 
1377
 
1369
 
1378
-                    iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 25, 25, 25, 25);
1370
+                iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 25, 25, 25, 25);
1379
                 //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
1371
                 //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
1380
                 ////设置纸张横向
1372
                 ////设置纸张横向
1381
                 //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
1373
                 //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
1390
                 {
1382
                 {
1391
                     long ii = Timestamp();
1383
                     long ii = Timestamp();
1392
                     string directoryPath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
1384
                     string directoryPath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
1393
-                    string filePathOutPut = Path.Combine(directoryPath, string.Format("{0}{1}.jpg", ii, i));
1385
+                    string filePathOutPut = Path.Combine(directoryPath, string.Format("print{0}{1}.jpg", ii, i));
1394
                     RectangleF rectangleFs = new RectangleF();
1386
                     RectangleF rectangleFs = new RectangleF();
1395
                     MergerImg("", filePathOutPut, rectangleFs, out string errmsg);
1387
                     MergerImg("", filePathOutPut, rectangleFs, out string errmsg);
1396
                     image = iTextSharp.text.Image.GetInstance(filePathOutPut);
1388
                     image = iTextSharp.text.Image.GetInstance(filePathOutPut);
1398
                     {
1390
                     {
1399
 
1391
 
1400
                     }
1392
                     }
1401
-                    else if(APP.PageDrawList[i].ImgDocumentation==true)
1393
+                    else if (APP.PageDrawList[i].ImgDocumentation == true)
1402
                     {
1394
                     {
1403
                         image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
1395
                         image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
1404
                     }
1396
                     }
1413
 
1405
 
1414
                         string msg = string.Empty;
1406
                         string msg = string.Empty;
1415
                         bool isImg = MergerImg(APP.PageDrawList[i].PageImagePath, filePathOutPut, rectangleF, out msg);
1407
                         bool isImg = MergerImg(APP.PageDrawList[i].PageImagePath, filePathOutPut, rectangleF, out msg);
1416
-                        if(isImg)
1408
+                        if (isImg)
1417
                         {
1409
                         {
1418
                             image = iTextSharp.text.Image.GetInstance(filePathOutPut);
1410
                             image = iTextSharp.text.Image.GetInstance(filePathOutPut);
1419
                         }
1411
                         }
1423
                         }
1415
                         }
1424
                     }
1416
                     }
1425
 
1417
 
1426
-                   
1418
+
1427
 
1419
 
1428
 
1420
 
1429
                     if (image.Height > iTextSharp.text.PageSize.A4.Height - 25)
1421
                     if (image.Height > iTextSharp.text.PageSize.A4.Height - 25)
1451
             }
1443
             }
1452
 
1444
 
1453
 
1445
 
1454
-         
1446
+
1455
 
1447
 
1456
 
1448
 
1457
 
1449
 
1474
                 //APP.W_PrintWindow.Topmost = true;
1466
                 //APP.W_PrintWindow.Topmost = true;
1475
                 APP.W_PrintWindow.Owner = this;
1467
                 APP.W_PrintWindow.Owner = this;
1476
             }
1468
             }
1477
-            if (APP.PageDrawList.Count > 0 && !string.IsNullOrWhiteSpace(APP.PageDrawList[0].PdfImagePath))
1469
+            if (APP.PageDrawList.Count > 0 && !string.IsNullOrWhiteSpace(APP.PageDrawList[0].PageImagePath))
1478
             {
1470
             {
1479
-                APP.W_PrintWindow.Initialize(APP.PageDrawList[0].PdfImagePath);
1471
+                APP.W_PrintWindow.Initialize(APP.PageDrawList[0].PageImagePath);
1480
             }
1472
             }
1481
             else
1473
             else
1482
             {
1474
             {
1509
         {
1501
         {
1510
             if (APP.pageData.currpage > 1)
1502
             if (APP.pageData.currpage > 1)
1511
             {
1503
             {
1512
-                try
1513
-                {
1514
-                    Dispatcher.Invoke(() =>
1515
-                    {
1516
-                        string filePath = FileToolsCommon.GetFileAbsolutePath("/Data/" + APP.UserInfo.Username + "/pdfimagetemp/");
1517
-                        FileToolsCommon.CreateDirectory(filePath);
1518
-                        string filePathName = filePath + APP.pageData.currpage.ToString() + ".jpg";
1519
-                        ImageHelper.SaveUIToImage(GridMain, filePathName, (int)GridMain.ActualWidth, (int)GridMain.ActualHeight);
1520
-                        //ImgPDFPath[APP.pageData.currpage - 1] = filePathName;
1521
-                        APP.PageDrawList[APP.pageData.currpage - 1].PdfImagePath = filePathName;
1522
-                    });
1523
-                }
1524
-                catch (Exception ex)
1525
-                {
1526
-                    LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(last_button_Click)生成图片错误:" + ex.Message, ex);
1527
-                }
1528
                 APP.pageData.currpage -= 1;
1504
                 APP.pageData.currpage -= 1;
1529
                 myblackboard.changepage(APP.pageData.currpage - 1);
1505
                 myblackboard.changepage(APP.pageData.currpage - 1);
1530
-                ///截图可用
1531
-                ImgScreenshot.Visibility = Visibility.Visible;
1532
-                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1533
-                btnScreenshot.IsEnabled = true;
1506
+                if (btnImport.IsEnabled == true)
1507
+                {
1508
+                    ///截图可用
1509
+                    ImgScreenshot.Visibility = Visibility.Visible;
1510
+                    ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1511
+                    btnScreenshot.IsEnabled = true;
1512
+                }
1534
                 if (APP.pageData.currpage <= APP.PageDrawList.Count)
1513
                 if (APP.pageData.currpage <= APP.PageDrawList.Count)
1535
                 {
1514
                 {
1536
                     if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
1515
                     if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
1558
                             {
1537
                             {
1559
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1538
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1560
                                 var transform = group.Children[1] as TranslateTransform;
1539
                                 var transform = group.Children[1] as TranslateTransform;
1540
+                                #region 高低 缩放比例
1561
                                 if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1541
                                 if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1562
                                 {
1542
                                 {
1563
                                     var transform1 = group.Children[0] as ScaleTransform;
1543
                                     var transform1 = group.Children[0] as ScaleTransform;
1566
                                     imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1546
                                     imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1567
                                     imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1547
                                     imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1568
                                 }
1548
                                 }
1569
-                                //var position = e.GetPosition(img);
1549
+                                #endregion
1550
+                                #region XY轴
1570
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1551
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1571
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1552
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1553
+                                #endregion
1572
                                 mouseDown = false;
1554
                                 mouseDown = false;
1573
                             }
1555
                             }
1574
                         }
1556
                         }
1580
                     }
1562
                     }
1581
                 }
1563
                 }
1582
             }
1564
             }
1583
-
1584
         }
1565
         }
1585
         /// <summary>
1566
         /// <summary>
1586
         /// 下一页
1567
         /// 下一页
1591
         {
1572
         {
1592
             if (APP.pageData.currpage < APP.pageData.pagenum)
1573
             if (APP.pageData.currpage < APP.pageData.pagenum)
1593
             {
1574
             {
1594
-                try
1595
-                {
1596
-                    Dispatcher.Invoke(() =>
1597
-                    {
1598
-                        string filePath = FileToolsCommon.GetFileAbsolutePath("/Data/" + APP.UserInfo.Username + "/pdfimagetemp/");
1599
-                        FileToolsCommon.CreateDirectory(filePath);
1600
-                        string filePathName = filePath + APP.pageData.currpage.ToString() + ".jpg";
1601
-                        ImageHelper.SaveUIToImage(GridMain, filePathName, (int)GridMain.ActualWidth, (int)GridMain.ActualHeight);
1602
-                        //ImgPDFPath[APP.pageData.currpage - 1] = filePathName;
1603
-                        APP.PageDrawList[APP.pageData.currpage - 1].PdfImagePath = filePathName;
1604
-                    });
1605
-                }
1606
-                catch (Exception ex)
1607
-                {
1608
-                    LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(next_btn_Click)生成图片错误:" + ex.Message, ex);
1609
-                }
1610
                 APP.pageData.currpage += 1;
1575
                 APP.pageData.currpage += 1;
1611
                 myblackboard.changepage(APP.pageData.currpage - 1);
1576
                 myblackboard.changepage(APP.pageData.currpage - 1);
1612
-                ///截图可用
1613
-                ImgScreenshot.Visibility = Visibility.Visible;
1614
-                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1615
-                btnScreenshot.IsEnabled = true;
1577
+                if (btnImport.IsEnabled == true)
1578
+                {
1579
+                    ///截图可用
1580
+                    ImgScreenshot.Visibility = Visibility.Visible;
1581
+                    ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1582
+                    btnScreenshot.IsEnabled = true;
1583
+                }
1616
                 if (APP.pageData.currpage <= APP.PageDrawList.Count)
1584
                 if (APP.pageData.currpage <= APP.PageDrawList.Count)
1617
                 {
1585
                 {
1618
-
1619
                     if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
1586
                     if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
1620
                     {
1587
                     {
1621
                         APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
1588
                         APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
1622
                     }
1589
                     }
1623
                     if (!string.IsNullOrWhiteSpace(txbCurrpage.Text) && APP.pageData.currpage <= APP.PageDrawList.Count && !string.IsNullOrWhiteSpace(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath))
1590
                     if (!string.IsNullOrWhiteSpace(txbCurrpage.Text) && APP.pageData.currpage <= APP.PageDrawList.Count && !string.IsNullOrWhiteSpace(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath))
1624
                     {
1591
                     {
1625
-                        if(APP.PageDrawList[APP.pageData.currpage - 1].ImgDocumentation)
1592
+                        if (APP.PageDrawList[APP.pageData.currpage - 1].ImgDocumentation)
1626
                         {
1593
                         {
1627
                             imgCanvas.Source = null;
1594
                             imgCanvas.Source = null;
1628
                             imgDocumentation.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1595
                             imgDocumentation.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1632
                         }
1599
                         }
1633
                         else
1600
                         else
1634
                         {
1601
                         {
1635
-                            //imgCanvas.Source = new BitmapImage(new Uri(APP.Paths[APP.pageData.currpage-1]));
1636
                             imgDocumentation.Source = null;
1602
                             imgDocumentation.Source = null;
1637
-
1638
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1603
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1639
                             APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1604
                             APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1640
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1605
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1641
                             {
1606
                             {
1642
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1607
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1608
+                                #region 高低 缩放比例
1643
                                 if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1609
                                 if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1644
                                 {
1610
                                 {
1645
                                     var transform1 = group.Children[0] as ScaleTransform;
1611
                                     var transform1 = group.Children[0] as ScaleTransform;
1648
                                     imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1614
                                     imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1649
                                     imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1615
                                     imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1650
                                 }
1616
                                 }
1617
+                                #endregion
1618
+                                #region 坐标XY轴
1651
                                 var transform = group.Children[1] as TranslateTransform;
1619
                                 var transform = group.Children[1] as TranslateTransform;
1652
-                                //var position = e.GetPosition(img);
1653
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1620
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1654
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1621
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1622
+                                #endregion
1655
                                 mouseDown = false;
1623
                                 mouseDown = false;
1656
                             }
1624
                             }
1657
                         }
1625
                         }
1662
                         imgDocumentation.Source = null;
1630
                         imgDocumentation.Source = null;
1663
                     }
1631
                     }
1664
                 }
1632
                 }
1665
-                //if (!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
1666
-                //{
1667
-                //    imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
1668
-                //}
1669
             }
1633
             }
1670
         }
1634
         }
1671
         /// <summary>
1635
         /// <summary>
1676
         /// <param name="_rectangle">图片位置</param>
1640
         /// <param name="_rectangle">图片位置</param>
1677
         /// <param name="errmsg">错误消息</param>
1641
         /// <param name="errmsg">错误消息</param>
1678
         /// <returns></returns>
1642
         /// <returns></returns>
1679
-        private bool MergerImg(string _path,string _saveimg,RectangleF _rectangle, out string errmsg)
1643
+        private bool MergerImg(string _path, string _saveimg, RectangleF _rectangle, out string errmsg)
1680
         {
1644
         {
1681
             errmsg = null;
1645
             errmsg = null;
1682
             try
1646
             try
1683
             {
1647
             {
1684
                 Bitmap bitmap = null;
1648
                 Bitmap bitmap = null;
1685
 
1649
 
1686
-                 //创建要显示的图片对象,根据参数的个数设置宽度
1687
-                 Bitmap backgroudImg = new Bitmap((int)gridM.ActualWidth, (int)gridM.ActualHeight);
1650
+                //创建要显示的图片对象,根据参数的个数设置宽度
1651
+                Bitmap backgroudImg = new Bitmap((int)gridM.ActualWidth, (int)gridM.ActualHeight);
1688
                 Graphics g = Graphics.FromImage(backgroudImg);
1652
                 Graphics g = Graphics.FromImage(backgroudImg);
1689
                 //清除画布,背景设置为白色
1653
                 //清除画布,背景设置为白色
1690
                 g.Clear(System.Drawing.Color.White);
1654
                 g.Clear(System.Drawing.Color.White);
1691
 
1655
 
1692
-                if(!string.IsNullOrWhiteSpace(_path))
1656
+                if (!string.IsNullOrWhiteSpace(_path))
1693
                 {
1657
                 {
1694
-                     bitmap = ImageHelper.ReadBitmapFile(_path);
1658
+                    bitmap = ImageHelper.ReadBitmapFile(_path);
1695
                     g.DrawImage(bitmap, _rectangle);
1659
                     g.DrawImage(bitmap, _rectangle);
1696
                 }
1660
                 }
1697
 
1661
 
1698
 
1662
 
1699
                 backgroudImg.Save(_saveimg);
1663
                 backgroudImg.Save(_saveimg);
1700
-               
1664
+
1701
                 g.Dispose();
1665
                 g.Dispose();
1702
                 backgroudImg.Dispose();
1666
                 backgroudImg.Dispose();
1703
-                if(bitmap!=null)
1667
+                if (bitmap != null)
1704
                 {
1668
                 {
1705
                     bitmap.Dispose();
1669
                     bitmap.Dispose();
1706
                 }
1670
                 }
1707
-              
1671
+
1708
                 GC.Collect();
1672
                 GC.Collect();
1709
                 return true;
1673
                 return true;
1710
             }
1674
             }
1711
             catch (Exception ex)
1675
             catch (Exception ex)
1712
             {
1676
             {
1713
                 errmsg = ex.Message;
1677
                 errmsg = ex.Message;
1714
-                LogHelper.WriteErrLog("【截图合成】(MergerImg)图片合成失败:" + ex.Message,ex);
1678
+                LogHelper.WriteErrLog("【截图合成】(MergerImg)图片合成失败:" + ex.Message, ex);
1715
                 return false;
1679
                 return false;
1716
             }
1680
             }
1717
-        
1681
+
1718
         }
1682
         }
1719
         /// <summary>
1683
         /// <summary>
1720
         /// 将Word文档转换为图片的方法(该方法基于第三方DLL),你可以像这样调用该方法: ConvertPDF2Image("F:\\PdfFile.doc", "F:\\",
1684
         /// 将Word文档转换为图片的方法(该方法基于第三方DLL),你可以像这样调用该方法: ConvertPDF2Image("F:\\PdfFile.doc", "F:\\",
2097
                 //}
2061
                 //}
2098
                 stroke.Clear();
2062
                 stroke.Clear();
2099
             }
2063
             }
2100
-            if(APP.pageData.currpage>0)
2064
+            if (APP.pageData.currpage > 0)
2101
             {
2065
             {
2102
                 Dispatcher.Invoke(new Action(() =>
2066
                 Dispatcher.Invoke(new Action(() =>
2103
                 {
2067
                 {
2104
-                    //myblackboard.changepages(0, 0, true);
2105
                     myblackboard.changepages(0, 0, true, Color, Size, APP.pageData.currpage - 1);
2068
                     myblackboard.changepages(0, 0, true, Color, Size, APP.pageData.currpage - 1);
2106
                 }));
2069
                 }));
2107
             }
2070
             }
2108
-         
2071
+
2109
 
2072
 
2110
         }
2073
         }
2111
 
2074
 
2238
                 double testX = (double)cx * PropW;
2201
                 double testX = (double)cx * PropW;
2239
                 double testY = (double)cy * PropH;
2202
                 double testY = (double)cy * PropH;
2240
                 //pageSerial //点阵IP地址  与打印的页面关联
2203
                 //pageSerial //点阵IP地址  与打印的页面关联
2241
-                if(APP.pageData.currpage>0)
2204
+                if (APP.pageData.currpage > 0)
2242
                 {
2205
                 {
2243
                     Dispatcher.Invoke(new Action(() =>
2206
                     Dispatcher.Invoke(new Action(() =>
2244
                     {
2207
                     {
2246
                         myblackboard.changepages(testX, testY, false, Color, Size, APP.pageData.currpage - 1);
2209
                         myblackboard.changepages(testX, testY, false, Color, Size, APP.pageData.currpage - 1);
2247
                     }));
2210
                     }));
2248
                 }
2211
                 }
2249
-             
2212
+
2250
 
2213
 
2251
 
2214
 
2252
                 ////每3个点画一条曲线
2215
                 ////每3个点画一条曲线
2330
         /// </summary>
2293
         /// </summary>
2331
         /// <param name="sender"></param>
2294
         /// <param name="sender"></param>
2332
         /// <param name="e"></param>
2295
         /// <param name="e"></param>
2333
-        private void BtnOk_Click(object sender, RoutedEventArgs e) 
2296
+        private void BtnOk_Click(object sender, RoutedEventArgs e)
2334
         {
2297
         {
2335
             //APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
2298
             //APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
2336
             //btnOk.Visibility = Visibility.Collapsed;
2299
             //btnOk.Visibility = Visibility.Collapsed;

Loading…
Cancel
Save