Procházet zdrojové kódy

zhao:解决冲突

tags/录制修改前
耀 před 4 roky
rodič
revize
b51134a633

+ 44
- 23
Common/system/BlackboardNew.cs Zobrazit soubor

@@ -333,7 +333,7 @@ namespace Common.system
333 333
         StylusPoint stylusPoint = new StylusPoint();
334 334
         Stroke stroke;
335 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 338
         //    if (_new)
339 339
         //    {
@@ -349,6 +349,15 @@ namespace Common.system
349 349
         //            stroke.DrawingAttributes = drawingAttributes;
350 350
         //            m_canvas.Strokes.Add(stroke);
351 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 363
         //        stylusPoints = new StylusPointCollection();
@@ -372,12 +381,16 @@ namespace Common.system
372 381
         //        }
373 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 389
         //            stylusPoint.Y = _y;
378 390
         //            stylusPoints.Add(stylusPoint);
379 391
         //            stroke = new Stroke(stylusPoints);
380 392
         //            m_canvas.Strokes[m_canvas.Strokes.Count - 1].StylusPoints.Add(stylusPoints);
393
+        //            }
381 394
         //        }
382 395
         //    }
383 396
         //}
@@ -397,13 +410,13 @@ namespace Common.system
397 410
 
398 411
 
399 412
 
400
-        public void changepages(double _x, double _y, bool _new, Color _color, int _size)
413
+        public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
401 414
         {
402
-            if (_new)
415
+            try
403 416
             {
404
-                if (stroke != null && stroke.StylusPoints.Count > 1)
417
+                if (_new)
405 418
                 {
406
-                    try
419
+                    if (stroke != null && stroke.StylusPoints.Count > 1)
407 420
                     {
408 421
                         drawingAttributes = new DrawingAttributes();
409 422
                         //m_canvas.DefaultDrawingAttributes = drawingAttributes;
@@ -415,27 +428,35 @@ namespace Common.system
415 428
 
416 429
                         stroke.DrawingAttributes = drawingAttributes;
417 430
                         //m_canvas.DefaultDrawingAttributes= drawingAttributes;
431
+
418 432
                         m_canvas.Strokes.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
+                        //}
440
+                        stroke = null;
419 441
                     }
420
-                    catch (Exception ex)
421
-                    {
422
-                        LogHelper.WriteErrLog("【点阵笔】(changepages):" + ex.Message, ex);
423
-                    }
442
+                    stylusPoints = new StylusPointCollection();
443
+                    stylusPoint = new StylusPoint();
444
+                    //stroke = new Stroke(stylusPoints);
445
+                    //stroke = null;
446
+                }
447
+                else
448
+                {
449
+                    //stylusPoints = new StylusPointCollection();
450
+                    //stylusPoint = new StylusPoint();
451
+                    stylusPoint.X = _x;
452
+                    stylusPoint.Y = _y;
453
+                    stylusPoints.Add(stylusPoint);
454
+                    stroke = new Stroke(stylusPoints);
424 455
                 }
425
-
426
-                stylusPoints = new StylusPointCollection();
427
-                stylusPoint = new StylusPoint();
428
-                //stroke = new Stroke(stylusPoints);
429
-                //stroke = null;
430 456
             }
431
-            else
457
+            catch (Exception ex)
432 458
             {
433
-                //stylusPoints = new StylusPointCollection();
434
-                //stylusPoint = new StylusPoint();
435
-                stylusPoint.X = _x;
436
-                stylusPoint.Y = _y;
437
-                stylusPoints.Add(stylusPoint);
438
-                stroke = new Stroke(stylusPoints);
459
+                LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(changepages)点阵比书写报错:" + ex.Message, ex);
439 460
             }
440 461
         }
441 462
 

+ 4
- 4
XHWK.WKTool/App.cs Zobrazit soubor

@@ -127,10 +127,10 @@ namespace XHWK.WKTool
127 127
         /// 打印
128 128
         /// </summary>
129 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 134
         #endregion
135 135
         #endregion
136 136
 

+ 4
- 4
XHWK.WKTool/XHMicroLessonSystemWindow.xaml Zobrazit soubor

@@ -159,10 +159,10 @@
159 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 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 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 166
             </Grid>
167 167
            
168 168
             <Grid Grid.Row="1">

+ 47
- 77
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Zobrazit soubor

@@ -1409,17 +1409,6 @@ namespace XHWK.WKTool
1409 1409
         /// <param name="e"></param>
1410 1410
         private void BtnAdd_Click(object sender, RoutedEventArgs e)
1411 1411
         {
1412
-            //      RectangleF rectangleF = new RectangleF();
1413
-            //      rectangleF.Width = (float)APP.PageDrawList[0].ImageSizes.CenterX;
1414
-            //      rectangleF.Height = (float)APP.PageDrawList[0].ImageSizes.CenterY;
1415
-            //      rectangleF.X= (float)APP.PageDrawList[0].ImageLocation.X;
1416
-            //      rectangleF.Y = (float)APP.PageDrawList[0].ImageLocation.Y;
1417
-
1418
-            //      //CESHI 
1419
-            //bool isImg=    MergerImg(APP.PageDrawList[0].PageImagePath, @"G:\102H.jpg", rectangleF, out string errmsg);
1420
-
1421
-
1422
-
1423 1412
             if (APP.pageData.currpage > 0)
1424 1413
             {
1425 1414
                 APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
@@ -1439,10 +1428,13 @@ namespace XHWK.WKTool
1439 1428
             model_DrawData.PageNum = APP.pageData.currpage;
1440 1429
             APP.PageDrawList.Add(model_DrawData);
1441 1430
             APP.SaveDraw();
1442
-            ///截图可用
1443
-            ImgScreenshot.Visibility = Visibility.Visible;
1444
-            ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1445
-            btnScreenshot.IsEnabled = true;
1431
+            if (btnImport.IsEnabled == true)
1432
+            {
1433
+                ///截图可用
1434
+                ImgScreenshot.Visibility = Visibility.Visible;
1435
+                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1436
+                btnScreenshot.IsEnabled = true;
1437
+            }
1446 1438
         }
1447 1439
         /// <summary>
1448 1440
         /// 打印事件
@@ -1472,7 +1464,7 @@ namespace XHWK.WKTool
1472 1464
                 {
1473 1465
                     long ii = Timestamp();
1474 1466
                     string directoryPath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
1475
-                    string filePathOutPut = Path.Combine(directoryPath, string.Format("{0}{1}.jpg", ii, i));
1467
+                    string filePathOutPut = Path.Combine(directoryPath, string.Format("print{0}{1}.jpg", ii, i));
1476 1468
                     RectangleF rectangleFs = new RectangleF();
1477 1469
                     MergerImg("", filePathOutPut, rectangleFs, out string errmsg);
1478 1470
                     image = iTextSharp.text.Image.GetInstance(filePathOutPut);
@@ -1556,9 +1548,9 @@ namespace XHWK.WKTool
1556 1548
                 //APP.W_PrintWindow.Topmost = true;
1557 1549
                 APP.W_PrintWindow.Owner = this;
1558 1550
             }
1559
-            if (APP.PageDrawList.Count > 0 && !string.IsNullOrWhiteSpace(APP.PageDrawList[0].PdfImagePath))
1551
+            if (APP.PageDrawList.Count > 0 && !string.IsNullOrWhiteSpace(APP.PageDrawList[0].PageImagePath))
1560 1552
             {
1561
-                APP.W_PrintWindow.Initialize(APP.PageDrawList[0].PdfImagePath);
1553
+                APP.W_PrintWindow.Initialize(APP.PageDrawList[0].PageImagePath);
1562 1554
             }
1563 1555
             else
1564 1556
             {
@@ -1591,28 +1583,15 @@ namespace XHWK.WKTool
1591 1583
         {
1592 1584
             if (APP.pageData.currpage > 1)
1593 1585
             {
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】(last_button_Click)生成图片错误:" + ex.Message, ex);
1609
-                }
1610 1586
                 APP.pageData.currpage -= 1;
1611 1587
                 myblackboard.changepage(APP.pageData.currpage - 1);
1612
-                ///截图可用
1613
-                ImgScreenshot.Visibility = Visibility.Visible;
1614
-                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1615
-                btnScreenshot.IsEnabled = true;
1588
+                if (btnImport.IsEnabled == true)
1589
+                {
1590
+                    ///截图可用
1591
+                    ImgScreenshot.Visibility = Visibility.Visible;
1592
+                    ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1593
+                    btnScreenshot.IsEnabled = true;
1594
+                }
1616 1595
                 if (APP.pageData.currpage <= APP.PageDrawList.Count)
1617 1596
                 {
1618 1597
                     if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
@@ -1640,6 +1619,7 @@ namespace XHWK.WKTool
1640 1619
                             {
1641 1620
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1642 1621
                                 var transform = group.Children[1] as TranslateTransform;
1622
+                                #region 高低 缩放比例
1643 1623
                                 if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1644 1624
                                 {
1645 1625
                                     var transform1 = group.Children[0] as ScaleTransform;
@@ -1648,9 +1628,11 @@ namespace XHWK.WKTool
1648 1628
                                     imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1649 1629
                                     imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1650 1630
                                 }
1651
-                                //var position = e.GetPosition(img);
1631
+                                #endregion
1632
+                                #region XY轴
1652 1633
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1653 1634
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1635
+                                #endregion
1654 1636
                                 mouseDown = false;
1655 1637
                             }
1656 1638
                         }
@@ -1662,7 +1644,6 @@ namespace XHWK.WKTool
1662 1644
                     }
1663 1645
                 }
1664 1646
             }
1665
-
1666 1647
         }
1667 1648
         /// <summary>
1668 1649
         /// 下一页
@@ -1673,31 +1654,17 @@ namespace XHWK.WKTool
1673 1654
         {
1674 1655
             if (APP.pageData.currpage < APP.pageData.pagenum)
1675 1656
             {
1676
-                try
1677
-                {
1678
-                    Dispatcher.Invoke(() =>
1679
-                    {
1680
-                        string filePath = FileToolsCommon.GetFileAbsolutePath("/Data/" + APP.UserInfo.Username + "/pdfimagetemp/");
1681
-                        FileToolsCommon.CreateDirectory(filePath);
1682
-                        string filePathName = filePath + APP.pageData.currpage.ToString() + ".jpg";
1683
-                        ImageHelper.SaveUIToImage(GridMain, filePathName, (int)GridMain.ActualWidth, (int)GridMain.ActualHeight);
1684
-                        //ImgPDFPath[APP.pageData.currpage - 1] = filePathName;
1685
-                        APP.PageDrawList[APP.pageData.currpage - 1].PdfImagePath = filePathName;
1686
-                    });
1687
-                }
1688
-                catch (Exception ex)
1689
-                {
1690
-                    LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(next_btn_Click)生成图片错误:" + ex.Message, ex);
1691
-                }
1692 1657
                 APP.pageData.currpage += 1;
1693 1658
                 myblackboard.changepage(APP.pageData.currpage - 1);
1694
-                ///截图可用
1695
-                ImgScreenshot.Visibility = Visibility.Visible;
1696
-                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1697
-                btnScreenshot.IsEnabled = true;
1659
+                if (btnImport.IsEnabled == true)
1660
+                {
1661
+                    ///截图可用
1662
+                    ImgScreenshot.Visibility = Visibility.Visible;
1663
+                    ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1664
+                    btnScreenshot.IsEnabled = true;
1665
+                }
1698 1666
                 if (APP.pageData.currpage <= APP.PageDrawList.Count)
1699 1667
                 {
1700
-
1701 1668
                     if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
1702 1669
                     {
1703 1670
                         APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
@@ -1714,14 +1681,13 @@ namespace XHWK.WKTool
1714 1681
                         }
1715 1682
                         else
1716 1683
                         {
1717
-                            //imgCanvas.Source = new BitmapImage(new Uri(APP.Paths[APP.pageData.currpage-1]));
1718 1684
                             imgDocumentation.Source = null;
1719
-
1720 1685
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1721 1686
                             APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1722 1687
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1723 1688
                             {
1724 1689
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1690
+                                #region 高低 缩放比例
1725 1691
                                 if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1726 1692
                                 {
1727 1693
                                     var transform1 = group.Children[0] as ScaleTransform;
@@ -1730,10 +1696,12 @@ namespace XHWK.WKTool
1730 1696
                                     imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1731 1697
                                     imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1732 1698
                                 }
1699
+                                #endregion
1700
+                                #region 坐标XY轴
1733 1701
                                 var transform = group.Children[1] as TranslateTransform;
1734
-                                //var position = e.GetPosition(img);
1735 1702
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1736 1703
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1704
+                                #endregion
1737 1705
                                 mouseDown = false;
1738 1706
                             }
1739 1707
                         }
@@ -1744,10 +1712,6 @@ namespace XHWK.WKTool
1744 1712
                         imgDocumentation.Source = null;
1745 1713
                     }
1746 1714
                 }
1747
-                //if (!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
1748
-                //{
1749
-                //    imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
1750
-                //}
1751 1715
             }
1752 1716
         }
1753 1717
         /// <summary>
@@ -2179,11 +2143,14 @@ namespace XHWK.WKTool
2179 2143
                 //}
2180 2144
                 stroke.Clear();
2181 2145
             }
2182
-            Dispatcher.Invoke(new Action(() =>
2146
+            if (APP.pageData.currpage > 0)
2183 2147
             {
2184
-                //myblackboard.changepages(0, 0, true);
2185
-                myblackboard.changepages(0, 0, true, Color, Size);
2186
-            }));
2148
+                Dispatcher.Invoke(new Action(() =>
2149
+                {
2150
+                    myblackboard.changepages(0, 0, true, Color, Size, APP.pageData.currpage - 1);
2151
+                }));
2152
+            }
2153
+
2187 2154
 
2188 2155
         }
2189 2156
 
@@ -2316,12 +2283,15 @@ namespace XHWK.WKTool
2316 2283
                 double testX = (double)cx * PropW;
2317 2284
                 double testY = (double)cy * PropH;
2318 2285
                 //pageSerial //点阵IP地址  与打印的页面关联
2319
-
2320
-                Dispatcher.Invoke(new Action(() =>
2286
+                if (APP.pageData.currpage > 0)
2321 2287
                 {
2322
-                    //myblackboard.changepages(testX, testY,false);
2323
-                    myblackboard.changepages(testX, testY, false, Color, Size);
2324
-                }));
2288
+                    Dispatcher.Invoke(new Action(() =>
2289
+                    {
2290
+                        //myblackboard.changepages(testX, testY,false);
2291
+                        myblackboard.changepages(testX, testY, false, Color, Size, APP.pageData.currpage - 1);
2292
+                    }));
2293
+                }
2294
+
2325 2295
 
2326 2296
 
2327 2297
                 ////每3个点画一条曲线

Načítá se…
Zrušit
Uložit