Procházet zdrojové kódy

1.除了上传都可以不登陆。 2. 我的去掉

tags/录制修改前
zhangxueyang před 4 roky
rodič
revize
68ea42cb51

+ 10
- 6
Common/system/CameraHelper.cs Zobrazit soubor

@@ -99,15 +99,19 @@ namespace Common.system
99 99
             try
100 100
             {
101 101
                 Image bitmap = sourcePlayer.GetCurrentVideoFrame();
102
-                if (fileName == null) fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
103
-                string fullPath = Path.Combine(filePath, fileName + "-cap.jpg");
104
-                bitmap.Save(fullPath, ImageFormat.Jpeg);
105
-                bitmap.Dispose();
106
-                return fullPath;
102
+                if(bitmap!=null)
103
+                {
104
+                    if (fileName == null) fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
105
+                    string fullPath = Path.Combine(filePath, fileName + "-cap.jpg");
106
+                    bitmap.Save(fullPath, ImageFormat.Jpeg);
107
+                    bitmap.Dispose();
108
+                    return fullPath;
109
+                }
110
+                return null;
107 111
             }
108 112
             catch (Exception e)
109 113
             {
110
-                System.Windows.Forms.MessageBox.Show(e.Message.ToString());
114
+          
111 115
                 return null;
112 116
             }
113 117
         }

+ 2
- 0
XHWK.Model/Model_DrawData.cs Zobrazit soubor

@@ -18,6 +18,7 @@ namespace XHWK.Model
18 18
         private string _pageImagePath;
19 19
         private TranslateTransform _ImageLocation;
20 20
         private ScaleTransform _ImageSize;
21
+        private ScaleTransform _ImageSizes;
21 22
         private bool _IsImageLocation;
22 23
         //private string _PenColor;
23 24
         //private int _PenWigth;
@@ -56,6 +57,7 @@ namespace XHWK.Model
56 57
         /// true 文档图片  folse 截图图片
57 58
         /// </summary>
58 59
         public bool ImgDocumentation { get => _imgDocumentation; set => _imgDocumentation = value; }
60
+        public ScaleTransform ImageSizes { get => _ImageSizes; set => _ImageSizes = value; }
59 61
         ///// <summary>
60 62
         ///// 笔颜色 十六进制
61 63
         ///// </summary>

+ 0
- 7
XHWK.WKTool/XHMicroLessonSystemWindow.xaml Zobrazit soubor

@@ -106,13 +106,6 @@
106 106
                             <TextBlock Text="上传" FontSize="14" Foreground="#FFFFFF" HorizontalAlignment="Center"/>
107 107
                         </StackPanel>
108 108
                     </Button>
109
-                    <Button Cursor="Hand" x:Name="btnMyMine" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="30,0,30,0" Click="BtnMyMine_Click">
110
-                        <StackPanel Orientation="Vertical">
111
-                            <Image x:Name="ImgMyMine" Source="./Images/microLessonSystem_22.png" Visibility="Collapsed"/>
112
-                            <Image x:Name="ImgMyMineTwo" Source="./Images/microLessonSystem_1.png" Visibility="Visible"/>
113
-                            <TextBlock Text="我的" FontSize="14" Foreground="#FFFFFF" HorizontalAlignment="Center"/>
114
-                        </StackPanel>
115
-                    </Button>
116 109
                     <Button Cursor="Hand" x:Name="btnSetUp" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="BtnSetUp_Click">
117 110
                         <StackPanel Orientation="Vertical">
118 111
                             <Image x:Name="ImgSetUp" Source="./Images/microLessonSystem_18.png" Visibility="Visible"/>

+ 35
- 66
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Zobrazit soubor

@@ -157,7 +157,7 @@ namespace XHWK.WKTool
157 157
             {
158 158
                 CameraHelper.SetCameraDevice(0);
159 159
                 RbnOpen = new List<string>();
160
-                times = new System.Timers.Timer(200);//设置执行一次(false)还是一直执行(true)
160
+                times = new System.Timers.Timer(300);//设置执行一次(false)还是一直执行(true)
161 161
                 times.AutoReset = true;//设置是否执行System.Timers.Timer.Elapsed事件
162 162
                 times.Elapsed += new System.Timers.ElapsedEventHandler(Times_Elapsed);
163 163
                 times.Enabled = true; //启动计时器
@@ -263,11 +263,6 @@ namespace XHWK.WKTool
263 263
         /// <param name="e"></param>
264 264
         private void BtnScreenRecording_Click(object sender, RoutedEventArgs e)
265 265
         {
266
-            if (APP.IsLoginType == false)
267
-            {
268
-                Login();
269
-                return;
270
-            }
271 266
             string RecordScreenPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
272 267
             if (FileToolsCommon.IsExistFile(RecordScreenPathName))
273 268
             {
@@ -460,11 +455,6 @@ namespace XHWK.WKTool
460 455
         /// <param name="e"></param>
461 456
         private void BtnSetUp_Click(object sender, RoutedEventArgs e)
462 457
         {
463
-            if (APP.IsLoginType == false)
464
-            {
465
-                Login();
466
-                return;
467
-            }
468 458
             if (!TxbRecordingWord.Text.Equals("暂停"))
469 459
             {
470 460
                 GridMain.Visibility = Visibility.Collapsed;
@@ -645,8 +635,6 @@ namespace XHWK.WKTool
645 635
             {
646 636
                 txbLoginType.Text = APP.UserInfo.Username;
647 637
 
648
-                ImgMyMine.Visibility = Visibility.Visible;
649
-                ImgMyMineTwo.Visibility = Visibility.Collapsed;
650 638
                 ImgUpload.Visibility = Visibility.Visible;
651 639
                 ImgUploadTwo.Visibility = Visibility.Collapsed;
652 640
             }
@@ -654,8 +642,6 @@ namespace XHWK.WKTool
654 642
             {
655 643
                 txbLoginType.Text = "未登录";
656 644
 
657
-                ImgMyMine.Visibility = Visibility.Collapsed;
658
-                ImgMyMineTwo.Visibility = Visibility.Visible;
659 645
                 ImgUpload.Visibility = Visibility.Collapsed;
660 646
                 ImgUploadTwo.Visibility = Visibility.Visible;
661 647
             }
@@ -761,11 +747,6 @@ namespace XHWK.WKTool
761 747
         /// <param name="e"></param>
762 748
         private void BtnImport_Click(object sender, RoutedEventArgs e)
763 749
         {
764
-            if (APP.IsLoginType == false)
765
-            {
766
-                Login();
767
-                return;
768
-            }
769 750
             try
770 751
             {
771 752
                 string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
@@ -1132,10 +1113,6 @@ namespace XHWK.WKTool
1132 1113
                     ImgUploadTwo.Visibility = Visibility.Visible;
1133 1114
                     btnUpload.IsEnabled = false;
1134 1115
 
1135
-                    ImgMyMine.Visibility = Visibility.Collapsed;//录制中不可点击我的
1136
-                    ImgMyMineTwo.Visibility = Visibility.Visible;
1137
-                    btnMyMine.IsEnabled = false;
1138
-
1139 1116
                     ImgSetUp.Visibility = Visibility.Collapsed;//录制中不可设置
1140 1117
                     ImgSetUpTwo.Visibility = Visibility.Visible;
1141 1118
                     btnSetUp.IsEnabled = false;
@@ -1261,10 +1238,6 @@ namespace XHWK.WKTool
1261 1238
                 ImgUploadTwo.Visibility = Visibility.Collapsed;
1262 1239
                 btnUpload.IsEnabled = true;
1263 1240
 
1264
-                ImgMyMine.Visibility = Visibility.Visible;
1265
-                ImgMyMineTwo.Visibility = Visibility.Collapsed;
1266
-                btnMyMine.IsEnabled = true;
1267
-
1268 1241
                 ImgSetUp.Visibility = Visibility.Visible;
1269 1242
                 ImgSetUpTwo.Visibility = Visibility.Collapsed;
1270 1243
                 btnSetUp.IsEnabled = true;
@@ -1341,11 +1314,6 @@ namespace XHWK.WKTool
1341 1314
         /// <param name="e"></param>
1342 1315
         private void BtnAdd_Click(object sender, RoutedEventArgs e)
1343 1316
         {
1344
-            if (APP.IsLoginType == false)
1345
-            {
1346
-                Login();
1347
-                return;
1348
-            }
1349 1317
             if (APP.pageData.pagenum < 200)
1350 1318
             {
1351 1319
                 if (APP.PageDrawList != null && APP.PageDrawList.Count > 0 && APP.PageDrawList.Count > APP.pageData.currpage - 1
@@ -1459,19 +1427,6 @@ namespace XHWK.WKTool
1459 1427
             //}
1460 1428
         }
1461 1429
         /// <summary>
1462
-        /// 我的
1463
-        /// </summary>
1464
-        /// <param name="sender"></param>
1465
-        /// <param name="e"></param>
1466
-        private void BtnMyMine_Click(object sender, RoutedEventArgs e)
1467
-        {
1468
-            if (APP.IsLoginType == false)
1469
-            {
1470
-                Login();
1471
-                return;
1472
-            }
1473
-        }
1474
-        /// <summary>
1475 1430
         /// 上一页
1476 1431
         /// </summary>
1477 1432
         /// <param name="sender"></param>
@@ -1518,17 +1473,19 @@ namespace XHWK.WKTool
1518 1473
                         {
1519 1474
                             imgDocumentation.Source = null;
1520 1475
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1521
-                      
1476
+                            APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1522 1477
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1523 1478
                             {
1524 1479
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1525 1480
                                 var transform = group.Children[1] as TranslateTransform;
1526
-                                //if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1527
-                                //{
1528
-                                //    var transform1 = group.Children[0] as ScaleTransform;
1529
-                                //    transform1.ScaleX = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX;
1530
-                                //    transform1.ScaleY = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY;
1531
-                                //}
1481
+                                if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1482
+                                {
1483
+                                    var transform1 = group.Children[0] as ScaleTransform;
1484
+                                    transform1.ScaleX = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX;
1485
+                                    transform1.ScaleY = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY;
1486
+                                    imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1487
+                                    imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1488
+                                }
1532 1489
                                 //var position = e.GetPosition(img);
1533 1490
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1534 1491
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
@@ -1595,21 +1552,26 @@ namespace XHWK.WKTool
1595 1552
                         {
1596 1553
                             //imgCanvas.Source = new BitmapImage(new Uri(APP.Paths[APP.pageData.currpage-1]));
1597 1554
                             imgDocumentation.Source = null;
1555
+
1598 1556
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1557
+                            APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1599 1558
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1600 1559
                             {
1601 1560
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1602
-                                //if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1603
-                                //{
1604
-                                //    var transform1 = group.Children[0] as ScaleTransform;
1605
-                                //    transform1.ScaleX = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX;
1606
-                                //    transform1.ScaleY = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY;
1607
-                                //}
1561
+                                if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1562
+                                {
1563
+                                    var transform1 = group.Children[0] as ScaleTransform;
1564
+                                    transform1.ScaleX = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX;
1565
+                                    transform1.ScaleY = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY;
1566
+                                    imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1567
+                                    imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1568
+                                }
1608 1569
                                 var transform = group.Children[1] as TranslateTransform;
1609 1570
                                 //var position = e.GetPosition(img);
1610 1571
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1611 1572
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1612 1573
 
1574
+                                
1613 1575
 
1614 1576
                                 mouseDown = false;
1615 1577
                             }
@@ -1808,15 +1770,22 @@ namespace XHWK.WKTool
1808 1770
             var transform1 = group.Children[1] as TranslateTransform;
1809 1771
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
1810 1772
             transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
1773
+            LogHelper.WriteInfoLog("【img宽高】" + imgCanvas.ActualWidth.ToString() + ":"
1774
+                 + imgCanvas.ActualHeight.ToString() + "百分比:" + transform.ScaleX.ToString() + ":" + transform.ScaleY.ToString()
1775
+                );
1776
+
1811 1777
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
1812 1778
 
1813
-            //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize = new ScaleTransform();
1814
-            //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX = transform.ScaleX;
1815
-            //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY = transform.ScaleY;
1816
-            //APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation = new TranslateTransform();
1817
-            //APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X = transform1.X;
1818
-            //APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y = transform1.Y;
1819
-            //APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1779
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSize = new ScaleTransform();
1780
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX = transform.ScaleX;
1781
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY = transform.ScaleY;
1782
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation = new TranslateTransform();
1783
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X = transform1.X;
1784
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y = transform1.Y;
1785
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes = new ScaleTransform();
1786
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX = imgCanvas.ActualWidth;
1787
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY = imgCanvas.ActualHeight;
1788
+            APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1820 1789
         }
1821 1790
         #endregion
1822 1791
 

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