Bladeren bron

代码优化

master
张剑 10 maanden geleden
bovenliggende
commit
8227fa021d
3 gewijzigde bestanden met toevoegingen van 12 en 42 verwijderingen
  1. 1
    1
      XHWK.WKTool/DAL/DalUpload.cs
  2. 3
    2
      XHWK.WKTool/MainWindow.xaml
  3. 8
    39
      XHWK.WKTool/MainWindow.xaml.cs

+ 1
- 1
XHWK.WKTool/DAL/DalUpload.cs Bestand weergeven

@@ -135,7 +135,7 @@ namespace XHWK.WKTool.DAL
135 135
         /// </returns>
136 136
         public bool UploadVideo(string videoGuid, out string errMessage)
137 137
         {
138
-            errMessage = "";
138
+            errMessage = "上传视频失败";
139 139
             try
140 140
             {
141 141
                 ModelVideo videoInfo = null;

+ 3
- 2
XHWK.WKTool/MainWindow.xaml Bestand weergeven

@@ -1500,11 +1500,12 @@
1500 1500
                         <Label
1501 1501
                             x:Name="LblVideoMess"
1502 1502
                             Grid.Row="0"
1503
-                            Margin="0,0,0,100"
1503
+                            Margin="0,0,0,0"
1504 1504
                             HorizontalAlignment="Center"
1505 1505
                             VerticalAlignment="Center"
1506
-                            Content="暂无微课录制信息,请录制并等待保存完成后重试!"
1506
+                            Content="暂无微课录制"
1507 1507
                             FontSize="20"
1508
+                            Foreground="#999"
1508 1509
                             Visibility="Hidden" />
1509 1510
                         <Button
1510 1511
                             x:Name="BtnVideoUpPage"

+ 8
- 39
XHWK.WKTool/MainWindow.xaml.cs Bestand weergeven

@@ -15,7 +15,6 @@ using System.Collections.Generic;
15 15
 using System.Diagnostics;
16 16
 using System.Drawing;
17 17
 using System.IO;
18
-using System.Linq;
19 18
 using System.Threading;
20 19
 using System.Threading.Tasks;
21 20
 using System.Windows;
@@ -351,14 +350,7 @@ namespace XHWK.WKTool
351 350
             if (App.IsLoginType)
352 351
             {
353 352
                 string headpicPath = FileToolsCommon.GetFileAbsolutePath("/Data/" + App.UserInfo.Username + ".png");
354
-                if (FileToolsCommon.IsExistFile(headpicPath))
355
-                {
356
-                    ImgHead.ImageSource = new BitmapImage(new Uri(headpicPath));
357
-                }
358
-                else
359
-                {
360
-                    ImgHead.ImageSource = new BitmapImage(new Uri("pack://application:,,,/BlackImages/HM_HeadImg.png"));
361
-                }
353
+                ImgHead.ImageSource = FileToolsCommon.IsExistFile(headpicPath) ? new BitmapImage(new Uri(headpicPath)) : new BitmapImage(new Uri("pack://application:,,,/BlackImages/HM_HeadImg.png"));
362 354
                 TxbLoginType.Text = App.UserInfo.Username;
363 355
                 ImgHeadImgN.Visibility = Visibility.Collapsed;
364 356
                 ImgHeadImg.Visibility = Visibility.Visible;
@@ -1968,9 +1960,8 @@ namespace XHWK.WKTool
1968 1960
                 }
1969 1961
                 else if (!string.IsNullOrEmpty(childName))
1970 1962
                 {
1971
-                    FrameworkElement frameworkElement = child as FrameworkElement;
1972 1963
                     // 如果控件名称符合参数条件
1973
-                    if (frameworkElement != null && frameworkElement.Name == childName)
1964
+                    if (child is FrameworkElement frameworkElement && frameworkElement.Name == childName)
1974 1965
                     {
1975 1966
                         list.Add((T)child);
1976 1967
                     }
@@ -2857,14 +2848,7 @@ namespace XHWK.WKTool
2857 2848
                     () =>
2858 2849
                     {
2859 2850
                         _srTime = _srTime.AddMilliseconds(200);
2860
-                        if (_srTime.Hour > 0)
2861
-                        {
2862
-                            TxbTime.Text = _srTime.ToString("HH:mm:ss");
2863
-                        }
2864
-                        else
2865
-                        {
2866
-                            TxbTime.Text = _srTime.ToString("mm:ss");
2867
-                        }
2851
+                        TxbTime.Text = _srTime.ToString(_srTime.Hour > 0 ? "HH:mm:ss" : "mm:ss");
2868 2852
                     }
2869 2853
                 );
2870 2854
                 ThreadPool.QueueUserWorkItem(
@@ -3495,14 +3479,7 @@ namespace XHWK.WKTool
3495 3479
         {
3496 3480
             _wit = wit;
3497 3481
             _hei = hei;
3498
-            if (!string.IsNullOrWhiteSpace(imgPath))
3499
-            {
3500
-                ImgPri.Source = new BitmapImage(new Uri(imgPath));
3501
-            }
3502
-            else
3503
-            {
3504
-                ImgPri.Source = null;
3505
-            }
3482
+            ImgPri.Source = !string.IsNullOrWhiteSpace(imgPath) ? new BitmapImage(new Uri(imgPath)) : null;
3506 3483
             GridPrintMask.Visibility = Visibility.Collapsed;
3507 3484
         }
3508 3485
 
@@ -3626,7 +3603,6 @@ namespace XHWK.WKTool
3626 3603
                     // ignored
3627 3604
                 }
3628 3605
                 _document.Open();
3629
-                iTextSharp.text.Image image;
3630 3606
                 for (int i = 0; i < App.PageDrawList.Count; i++)
3631 3607
                 {
3632 3608
                     long ii = Timestamp();
@@ -3645,7 +3621,7 @@ namespace XHWK.WKTool
3645 3621
                         filePathOutPut,
3646 3622
                         rectangleFs
3647 3623
                     );
3648
-                    image = iTextSharp.text.Image.GetInstance(filePathOutPut);
3624
+                    iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(filePathOutPut);
3649 3625
                     if (string.IsNullOrEmpty(App.PageDrawList[i].PageImagePath)) //没有图片
3650 3626
                     { }
3651 3627
                     else if (App.PageDrawList[i].ImgDocumentation && !App.PageDrawList[i].Type.Equals("ppt"))
@@ -3678,14 +3654,7 @@ namespace XHWK.WKTool
3678 3654
                             filePathOutPut,
3679 3655
                             rectangleF
3680 3656
                         );
3681
-                        if (isImg)
3682
-                        {
3683
-                            image = iTextSharp.text.Image.GetInstance(filePathOutPut);
3684
-                        }
3685
-                        else
3686
-                        {
3687
-                            image = iTextSharp.text.Image.GetInstance(App.PageDrawList[i].PageImagePath);
3688
-                        }
3657
+                        image = iTextSharp.text.Image.GetInstance(isImg ? filePathOutPut : App.PageDrawList[i].PageImagePath);
3689 3658
                     }
3690 3659
                     if (image.Height > iTextSharp.text.PageSize.A4.Height)
3691 3660
                     {
@@ -3732,10 +3701,10 @@ namespace XHWK.WKTool
3732 3701
                     try
3733 3702
                     {
3734 3703
                         // 腾千里会根据原PDF的页数生成多个PDF文件
3735
-                        for (int i = 0; i < strs.Count(); i++)
3704
+                        for (int i = 0; i < strs.Length; i++)
3736 3705
                         {
3737 3706
                             _timesPrint.Stop();
3738
-                            _printMsg = "正在打印第" + (i + 1) + "/" + strs.Count() + "页中";
3707
+                            _printMsg = "正在打印第" + (i + 1) + "/" + strs.Length + "页中";
3739 3708
                             _msgnum = 0;
3740 3709
                             _num = 0;
3741 3710
                             _timesPrint.Interval = 100;

Laden…
Annuleren
Opslaan