Browse Source

1.4.6 导入图片

tags/录制修改前
zhangxueyang 3 years ago
parent
commit
fd70cb7b2e

+ 2
- 2
XHWK.WKTool/App.config View File

@@ -32,8 +32,8 @@
32 32
     <!--上传每片大小 Mb-->
33 33
     <add key="UploadSliceLen" value="1" />
34 34
     <!--版本号-->
35
-    <add key="VersionCode" value="46" />
36
-    <add key="VersionName" value="1.4.5" />
35
+    <add key="VersionCode" value="47" />
36
+    <add key="VersionName" value="1.4.6" />
37 37
     <add key="ClientSettingsProvider.ServiceUri" value="" />
38 38
   </appSettings>
39 39
   <system.web>

+ 2
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs View File

@@ -49,5 +49,5 @@ using System.Windows;
49 49
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
50 50
 //通过使用 "*",如下所示:
51 51
 // [assembly: AssemblyVersion("1.0.*")]
52
-[assembly: AssemblyVersion("1.4.5.0")]
53
-[assembly: AssemblyFileVersion("1.4.5.0")]
52
+[assembly: AssemblyVersion("1.4.6.0")]
53
+[assembly: AssemblyFileVersion("1.4.6.0")]

+ 98
- 1
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

@@ -1061,7 +1061,8 @@ namespace XHWK.WKTool
1061 1061
                 ofd = new System.Windows.Forms.OpenFileDialog
1062 1062
                 {
1063 1063
                     //Filter = "文档|*.docx;*.doc;*.ppt;*.pptx",
1064
-                    Filter = "文档|*.docx;*.doc;*.ppt;*.pptx;*.pdf",
1064
+                    //增加导入图片
1065
+                    Filter = "文档|*.docx;*.doc;*.ppt;*.pptx;*.pdf|图片|*.jpg;*.jpeg;*.png;*.bmp",
1065 1066
                     InitialDirectory = desktopPath,
1066 1067
                     Multiselect = false,
1067 1068
                     AddExtension = true,
@@ -1107,12 +1108,14 @@ namespace XHWK.WKTool
1107 1108
             {
1108 1109
                 if (ofd.FileName != "")
1109 1110
                 {
1111
+                    List<string> imagelist = new List<string>() { "jpg", "jpeg", "png", "bmp" };
1110 1112
                     Dispatcher.Invoke(new Action(() =>
1111 1113
                     {
1112 1114
                         APP.myloading.Show();
1113 1115
                         myblackboard.changepage(APP.pageData.pagenum);
1114 1116
                     }));
1115 1117
                     string filepath = ofd.FileName;
1118
+                    string filesuff = filepath.Substring(filepath.LastIndexOf(".") + 1).ToLower();
1116 1119
                     string path = ofd.SafeFileName.Replace(".ppt", "").Replace(".pptx", "").Trim();
1117 1120
                     string type = ofd.SafeFileName.Replace(".ppt", "typezsygppt").Replace(".pptx", "typezsygppt").Replace(".pdf", "typepdf").Trim();
1118 1121
                     if (type.Contains("typezsygppt"))//ppt
@@ -1374,6 +1377,100 @@ namespace XHWK.WKTool
1374 1377
                         }
1375 1378
 
1376 1379
                     }
1380
+                    else if(imagelist.Contains(filesuff))///导入图片
1381
+                    {
1382
+                        string imagepath = AppDomain.CurrentDomain.BaseDirectory + "temp";
1383
+
1384
+                        if (!Directory.Exists(imagepath))
1385
+                        {
1386
+                            Directory.CreateDirectory(imagepath);
1387
+                        }
1388
+                        TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
1389
+                        string timestr = Convert.ToInt64(ts.TotalMilliseconds).ToString();
1390
+                        string filepathCopy = Path.Combine(imagepath, timestr + ofd.SafeFileName);
1391
+                       
1392
+                        System.IO.File.Copy(filepath, filepathCopy);
1393
+                        filepath = filepathCopy;
1394
+
1395
+                        APP.ImgPath = filepath;
1396
+                        Dispatcher.Invoke(new Action(() =>
1397
+                        {
1398
+                        if (APP.pageData.currpage == 0)
1399
+                        {
1400
+                            APP.pageData.pagenum += 1;
1401
+                            APP.pageData.currpage = APP.pageData.pagenum;
1402
+                            myblackboard.changepage(APP.pageData.currpage - 1);
1403
+                         
1404
+
1405
+                           
1406
+                                gridPage.Visibility = Visibility.Visible;//页码大于0 显示
1407
+                                #region 插入页码
1408
+                                PageData = new List<PageData>();
1409
+                                for (int i = 1; i <= APP.pageData.pagenum; i++)
1410
+                                {
1411
+                                    PageData pd = new PageData();
1412
+                                    pd.PageName = i.ToString();// + "页";
1413
+                                    pd.PageCode = i;
1414
+                                    PageData.Add(pd);
1415
+                                }
1416
+                                CbxPageList.ItemsSource = PageData;
1417
+                                CbxPageList.SelectedIndex = APP.pageData.currpage - 1;
1418
+                                #endregion
1419
+                         
1420
+
1421
+
1422
+                          
1423
+                        }
1424
+                        if (APP.PageDrawList.Count >= APP.pageData.currpage)
1425
+                        {
1426
+                            APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath = APP.ImgPath;//zxycs
1427
+                            APP.PageDrawList[APP.pageData.currpage - 1].PdfImagePath = APP.ImgPath;
1428
+                        }
1429
+                        else
1430
+                        {
1431
+                            Model_DrawData model_DrawData = new Model_DrawData
1432
+                            {
1433
+                                PageImagePath = APP.ImgPath,
1434
+                                PdfImagePath = APP.ImgPath
1435
+                            };
1436
+                            APP.PageDrawList.Add(model_DrawData);
1437
+                        }
1438
+                        if (APP.PageDrawList.Count >= APP.pageData.currpage && !string.IsNullOrWhiteSpace(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath))
1439
+                        {
1440
+
1441
+                            imgDocumentation.Source = null;
1442
+                            BitmapImage bitImg = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1443
+                            mouseDown = false;
1444
+                            APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation = new TranslateTransform
1445
+                            {
1446
+                                X = 0.1,
1447
+                                Y = 0.1
1448
+                            };
1449
+                            APP.PageDrawList[APP.pageData.currpage - 1].Type = "截图";
1450
+
1451
+                            APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1452
+                            imgCanvas.Source = bitImg;
1453
+                            imgCanvas.Width = bitImg.Width;
1454
+                            imgCanvas.Height = bitImg.Height;
1455
+                            scroMain.ScrollToVerticalOffset(0);
1456
+                            APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes = new ScaleTransform
1457
+                            {
1458
+                                CenterX = imgCanvas.Width,
1459
+                                CenterY = imgCanvas.Height
1460
+                            };
1461
+
1462
+                     
1463
+                                ImgPrint.Visibility = Visibility.Visible;//截图成功可打印
1464
+                                ImgPrintTwo.Visibility = Visibility.Collapsed;
1465
+                                btnPrint.IsEnabled = true;
1466
+                         
1467
+
1468
+                      
1469
+
1470
+
1471
+                        }
1472
+                               }));
1473
+                    }
1377 1474
                     else//word
1378 1475
                     {
1379 1476
                         try

Loading…
Cancel
Save