Browse Source

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

tags/录制修改前
zhangxueyang 4 years ago
parent
commit
68ea42cb51

+ 10
- 6
Common/system/CameraHelper.cs View File

99
             try
99
             try
100
             {
100
             {
101
                 Image bitmap = sourcePlayer.GetCurrentVideoFrame();
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
             catch (Exception e)
112
             catch (Exception e)
109
             {
113
             {
110
-                System.Windows.Forms.MessageBox.Show(e.Message.ToString());
114
+          
111
                 return null;
115
                 return null;
112
             }
116
             }
113
         }
117
         }

+ 2
- 0
XHWK.Model/Model_DrawData.cs View File

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

+ 0
- 7
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

106
                             <TextBlock Text="上传" FontSize="14" Foreground="#FFFFFF" HorizontalAlignment="Center"/>
106
                             <TextBlock Text="上传" FontSize="14" Foreground="#FFFFFF" HorizontalAlignment="Center"/>
107
                         </StackPanel>
107
                         </StackPanel>
108
                     </Button>
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
                     <Button Cursor="Hand" x:Name="btnSetUp" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="BtnSetUp_Click">
109
                     <Button Cursor="Hand" x:Name="btnSetUp" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="BtnSetUp_Click">
117
                         <StackPanel Orientation="Vertical">
110
                         <StackPanel Orientation="Vertical">
118
                             <Image x:Name="ImgSetUp" Source="./Images/microLessonSystem_18.png" Visibility="Visible"/>
111
                             <Image x:Name="ImgSetUp" Source="./Images/microLessonSystem_18.png" Visibility="Visible"/>

+ 35
- 66
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

157
             {
157
             {
158
                 CameraHelper.SetCameraDevice(0);
158
                 CameraHelper.SetCameraDevice(0);
159
                 RbnOpen = new List<string>();
159
                 RbnOpen = new List<string>();
160
-                times = new System.Timers.Timer(200);//设置执行一次(false)还是一直执行(true)
160
+                times = new System.Timers.Timer(300);//设置执行一次(false)还是一直执行(true)
161
                 times.AutoReset = true;//设置是否执行System.Timers.Timer.Elapsed事件
161
                 times.AutoReset = true;//设置是否执行System.Timers.Timer.Elapsed事件
162
                 times.Elapsed += new System.Timers.ElapsedEventHandler(Times_Elapsed);
162
                 times.Elapsed += new System.Timers.ElapsedEventHandler(Times_Elapsed);
163
                 times.Enabled = true; //启动计时器
163
                 times.Enabled = true; //启动计时器
263
         /// <param name="e"></param>
263
         /// <param name="e"></param>
264
         private void BtnScreenRecording_Click(object sender, RoutedEventArgs e)
264
         private void BtnScreenRecording_Click(object sender, RoutedEventArgs e)
265
         {
265
         {
266
-            if (APP.IsLoginType == false)
267
-            {
268
-                Login();
269
-                return;
270
-            }
271
             string RecordScreenPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
266
             string RecordScreenPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
272
             if (FileToolsCommon.IsExistFile(RecordScreenPathName))
267
             if (FileToolsCommon.IsExistFile(RecordScreenPathName))
273
             {
268
             {
460
         /// <param name="e"></param>
455
         /// <param name="e"></param>
461
         private void BtnSetUp_Click(object sender, RoutedEventArgs e)
456
         private void BtnSetUp_Click(object sender, RoutedEventArgs e)
462
         {
457
         {
463
-            if (APP.IsLoginType == false)
464
-            {
465
-                Login();
466
-                return;
467
-            }
468
             if (!TxbRecordingWord.Text.Equals("暂停"))
458
             if (!TxbRecordingWord.Text.Equals("暂停"))
469
             {
459
             {
470
                 GridMain.Visibility = Visibility.Collapsed;
460
                 GridMain.Visibility = Visibility.Collapsed;
645
             {
635
             {
646
                 txbLoginType.Text = APP.UserInfo.Username;
636
                 txbLoginType.Text = APP.UserInfo.Username;
647
 
637
 
648
-                ImgMyMine.Visibility = Visibility.Visible;
649
-                ImgMyMineTwo.Visibility = Visibility.Collapsed;
650
                 ImgUpload.Visibility = Visibility.Visible;
638
                 ImgUpload.Visibility = Visibility.Visible;
651
                 ImgUploadTwo.Visibility = Visibility.Collapsed;
639
                 ImgUploadTwo.Visibility = Visibility.Collapsed;
652
             }
640
             }
654
             {
642
             {
655
                 txbLoginType.Text = "未登录";
643
                 txbLoginType.Text = "未登录";
656
 
644
 
657
-                ImgMyMine.Visibility = Visibility.Collapsed;
658
-                ImgMyMineTwo.Visibility = Visibility.Visible;
659
                 ImgUpload.Visibility = Visibility.Collapsed;
645
                 ImgUpload.Visibility = Visibility.Collapsed;
660
                 ImgUploadTwo.Visibility = Visibility.Visible;
646
                 ImgUploadTwo.Visibility = Visibility.Visible;
661
             }
647
             }
761
         /// <param name="e"></param>
747
         /// <param name="e"></param>
762
         private void BtnImport_Click(object sender, RoutedEventArgs e)
748
         private void BtnImport_Click(object sender, RoutedEventArgs e)
763
         {
749
         {
764
-            if (APP.IsLoginType == false)
765
-            {
766
-                Login();
767
-                return;
768
-            }
769
             try
750
             try
770
             {
751
             {
771
                 string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
752
                 string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
1132
                     ImgUploadTwo.Visibility = Visibility.Visible;
1113
                     ImgUploadTwo.Visibility = Visibility.Visible;
1133
                     btnUpload.IsEnabled = false;
1114
                     btnUpload.IsEnabled = false;
1134
 
1115
 
1135
-                    ImgMyMine.Visibility = Visibility.Collapsed;//录制中不可点击我的
1136
-                    ImgMyMineTwo.Visibility = Visibility.Visible;
1137
-                    btnMyMine.IsEnabled = false;
1138
-
1139
                     ImgSetUp.Visibility = Visibility.Collapsed;//录制中不可设置
1116
                     ImgSetUp.Visibility = Visibility.Collapsed;//录制中不可设置
1140
                     ImgSetUpTwo.Visibility = Visibility.Visible;
1117
                     ImgSetUpTwo.Visibility = Visibility.Visible;
1141
                     btnSetUp.IsEnabled = false;
1118
                     btnSetUp.IsEnabled = false;
1261
                 ImgUploadTwo.Visibility = Visibility.Collapsed;
1238
                 ImgUploadTwo.Visibility = Visibility.Collapsed;
1262
                 btnUpload.IsEnabled = true;
1239
                 btnUpload.IsEnabled = true;
1263
 
1240
 
1264
-                ImgMyMine.Visibility = Visibility.Visible;
1265
-                ImgMyMineTwo.Visibility = Visibility.Collapsed;
1266
-                btnMyMine.IsEnabled = true;
1267
-
1268
                 ImgSetUp.Visibility = Visibility.Visible;
1241
                 ImgSetUp.Visibility = Visibility.Visible;
1269
                 ImgSetUpTwo.Visibility = Visibility.Collapsed;
1242
                 ImgSetUpTwo.Visibility = Visibility.Collapsed;
1270
                 btnSetUp.IsEnabled = true;
1243
                 btnSetUp.IsEnabled = true;
1341
         /// <param name="e"></param>
1314
         /// <param name="e"></param>
1342
         private void BtnAdd_Click(object sender, RoutedEventArgs e)
1315
         private void BtnAdd_Click(object sender, RoutedEventArgs e)
1343
         {
1316
         {
1344
-            if (APP.IsLoginType == false)
1345
-            {
1346
-                Login();
1347
-                return;
1348
-            }
1349
             if (APP.pageData.pagenum < 200)
1317
             if (APP.pageData.pagenum < 200)
1350
             {
1318
             {
1351
                 if (APP.PageDrawList != null && APP.PageDrawList.Count > 0 && APP.PageDrawList.Count > APP.pageData.currpage - 1
1319
                 if (APP.PageDrawList != null && APP.PageDrawList.Count > 0 && APP.PageDrawList.Count > APP.pageData.currpage - 1
1459
             //}
1427
             //}
1460
         }
1428
         }
1461
         /// <summary>
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
         /// </summary>
1431
         /// </summary>
1477
         /// <param name="sender"></param>
1432
         /// <param name="sender"></param>
1518
                         {
1473
                         {
1519
                             imgDocumentation.Source = null;
1474
                             imgDocumentation.Source = null;
1520
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
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
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1477
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1523
                             {
1478
                             {
1524
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1479
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1525
                                 var transform = group.Children[1] as TranslateTransform;
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
                                 //var position = e.GetPosition(img);
1489
                                 //var position = e.GetPosition(img);
1533
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1490
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1534
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1491
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1595
                         {
1552
                         {
1596
                             //imgCanvas.Source = new BitmapImage(new Uri(APP.Paths[APP.pageData.currpage-1]));
1553
                             //imgCanvas.Source = new BitmapImage(new Uri(APP.Paths[APP.pageData.currpage-1]));
1597
                             imgDocumentation.Source = null;
1554
                             imgDocumentation.Source = null;
1555
+
1598
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1556
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1557
+                            APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1599
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1558
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1600
                             {
1559
                             {
1601
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
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
                                 var transform = group.Children[1] as TranslateTransform;
1569
                                 var transform = group.Children[1] as TranslateTransform;
1609
                                 //var position = e.GetPosition(img);
1570
                                 //var position = e.GetPosition(img);
1610
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1571
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1611
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1572
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1612
 
1573
 
1574
+                                
1613
 
1575
 
1614
                                 mouseDown = false;
1576
                                 mouseDown = false;
1615
                             }
1577
                             }
1808
             var transform1 = group.Children[1] as TranslateTransform;
1770
             var transform1 = group.Children[1] as TranslateTransform;
1809
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
1771
             transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
1810
             transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
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
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
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
         #endregion
1790
         #endregion
1822
 
1791
 

Loading…
Cancel
Save