Просмотр исходного кода

zhao:1代码优化,2修改录制跳转

tags/录制修改前
耀 3 лет назад
Родитель
Сommit
280cdcbcff

+ 1
- 1
Common/system/FFMpeg.cs Просмотреть файл

@@ -900,7 +900,7 @@ namespace Common.system
900 900
         /// </summary>
901 901
         public void GetMToFFmpeg()
902 902
         {
903
-            return;
903
+            //return;
904 904
             new Thread(new ThreadStart(new Action(() =>
905 905
             {
906 906
                 try

+ 5
- 5
Common/system/ImageHelper.cs Просмотреть файл

@@ -457,7 +457,7 @@ namespace Common.system
457 457
                             Img.Dispose();
458 458
                             bit.Dispose();
459 459
                         }
460
-                        catch (Exception ex)
460
+                        catch (Exception)
461 461
                         {
462 462
                             using (var stream = new FileStream(filePathName, FileMode.Create))
463 463
                             {
@@ -474,7 +474,7 @@ namespace Common.system
474 474
                     }
475 475
                 }))).Start();
476 476
             }
477
-            catch (Exception ex)
477
+            catch (Exception)
478 478
             {
479 479
 
480 480
             }
@@ -620,7 +620,7 @@ namespace Common.system
620 620
                 //Thread myThread = new Thread(SaveImage);
621 621
                 //myThread.Start(saveModel);
622 622
             }
623
-            catch (Exception ex)
623
+            catch (Exception)
624 624
             {
625 625
 
626 626
             }
@@ -677,7 +677,7 @@ namespace Common.system
677 677
                             bit.Dispose();
678 678
                         }))).Start();
679 679
                     }
680
-                    catch (Exception ex)
680
+                    catch (Exception)
681 681
                     {
682 682
 
683 683
                     }
@@ -703,7 +703,7 @@ namespace Common.system
703 703
                     fs.Close();
704 704
                 }
705 705
             }
706
-            catch (Exception ex)
706
+            catch (Exception)
707 707
             {
708 708
 
709 709
             }

+ 2
- 2
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs Просмотреть файл

@@ -45,7 +45,7 @@ namespace XHWK.WKTool
45 45
                             ZipHelper.UnZip(FileToolsCommon.GetFileAbsolutePath("/ffmpegx32.zip"), FileToolsCommon.GetFileAbsolutePath());
46 46
                         }
47 47
                     }
48
-                    catch (Exception ex)
48
+                    catch (Exception)
49 49
                     {
50 50
                         ZipHelper.UnZip(FileToolsCommon.GetFileAbsolutePath("/ffmpegx64.zip"), FileToolsCommon.GetFileAbsolutePath());
51 51
                     }
@@ -57,7 +57,7 @@ namespace XHWK.WKTool
57 57
                 APP.InstallScreenCapturerRecorder();
58 58
             }
59 59
             txbStoragePath.Text = FileToolsCommon.GetConfigValue("VideoSavePath");
60
-            APP.FFmpeg.GetMToFFmpeg();
60
+            //APP.FFmpeg.GetMToFFmpeg();
61 61
         }
62 62
 
63 63
         #region 事件

+ 35
- 21
XHWK.WKTool/XHMicroLessonSystemWindow.xaml Просмотреть файл

@@ -639,8 +639,8 @@
639 639
                     <RadioButton Cursor="Hand" x:Name="rbnCrude" Content=" 粗" Style="{StaticResource radBase}" FontSize="14" Margin="5,4,0,0" Click="RbnCrude_Click"/>
640 640
                 </StackPanel>
641 641
                 <!--页码-->
642
-                <Grid Grid.Row="1" x:Name="gridPage" Visibility="Hidden" MouseLeftButtonDown="Window_MouseLeftButtonDown_1" HorizontalAlignment="Center">
643
-                    <StackPanel Grid.Row="0" Orientation="Horizontal" Background="Transparent" Width="150" HorizontalAlignment="Center" Height="30" Margin="0,0,0,0" Grid.Column="1" VerticalAlignment="Bottom">
642
+                <Grid Grid.Row="1" x:Name="gridPage" Visibility="Visible" MouseLeftButtonDown="Window_MouseLeftButtonDown_1" HorizontalAlignment="Center" Margin="30,0,0,0">
643
+                    <StackPanel Grid.Row="0" Orientation="Horizontal" Background="Transparent" Width="215" HorizontalAlignment="Center" Height="30" Margin="0,0,0,0" Grid.Column="1" VerticalAlignment="Bottom">
644 644
                         <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
645 645
                     x:Name="last_button"
646 646
                     Width="28" Height="20"
@@ -650,27 +650,12 @@
650 650
                                 <Image Width="16" Height="12" Source=".\Images\class_p1.png" />
651 651
                             </StackPanel>
652 652
                         </Button>
653
-                        <Grid Width="95"  Background="Transparent" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
653
+                        <Grid Width="60"  Background="Transparent" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
654 654
                             <StackPanel HorizontalAlignment="Center" Orientation="Horizontal"  Background="Transparent">
655
-                                <TextBlock x:Name="txbCurrpage" Text="{Binding currpage}" TextAlignment="Center" FontSize="15" MouseLeftButtonDown="txbCurrpage_MouseLeftButtonDown" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" ToolTip="双击跳转"/>
656
-                                <TextBlock Text="/" TextAlignment="Center" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="txbCurrpage_MouseLeftButtonDown" ToolTip="双击跳转"/>
657
-                                <TextBlock x:Name="txbTotalpage" Text="{Binding pagenum}" TextAlignment="Center" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="txbCurrpage_MouseLeftButtonDown" ToolTip="双击跳转"/>
655
+                                <TextBlock x:Name="txbCurrpage" Text="{Binding currpage}" TextAlignment="Center" FontSize="15" MouseLeftButtonDown="txbCurrpage_MouseLeftButtonDown" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"/>
656
+                                <TextBlock Text="/" TextAlignment="Center" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="txbCurrpage_MouseLeftButtonDown"/>
657
+                                <TextBlock x:Name="txbTotalpage" Text="{Binding pagenum}" TextAlignment="Center" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="txbCurrpage_MouseLeftButtonDown"/>
658 658
                             </StackPanel>
659
-                            <TextBox x:Name="txtJump" Text="123" Height="17" Width="25" Visibility="Hidden" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0"  input:InputMethod.IsInputMethodEnabled="False" PreviewTextInput="txtJump_PreviewTextInput" KeyDown="txtJump_KeyDown"/>
660
-                            <Button Cursor="Hand" Visibility="Hidden" x:Name="BtnJumpPage" HorizontalAlignment="Left"  VerticalAlignment="Center" Width="17" Height="17" Background="White" BorderBrush="#FFABADB3" Margin="24,0,0,0" Click="BtnJumpPage_Click">
661
-                                <Button.Resources>
662
-                                    <Style TargetType="{x:Type Border}">
663
-                                        <Setter Property="CornerRadius" Value="0"/>
664
-                                        <Setter Property="BorderBrush" Value="#3492F4"/>
665
-                                    </Style>
666
-                                </Button.Resources>
667
-                                <Image Source="/星火微课;component/Images/VideoList_OK.png" Margin="2,2,2,2"></Image>
668
-                            </Button>
669
-                            <!--<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0"  Background="Transparent">
670
-                                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal"  Background="Transparent">
671
-                                   
672
-                                </StackPanel>
673
-                            </StackPanel>-->
674 659
                         </Grid>
675 660
                         <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
676 661
                     x:Name="next_btn"  Background="Transparent"
@@ -680,6 +665,35 @@
680 665
                                 <Image Width="16" Height="12" Source=".\Images\class_p2.png" />
681 666
                             </StackPanel>
682 667
                         </Button>
668
+
669
+                        <TextBlock Text="跳转" Height="18" Margin="0,5,3,0"></TextBlock>
670
+                        <!--<TextBox x:Name="txtJump" Text="123" Height="17" Width="25" Visibility="Visible" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0"  input:InputMethod.IsInputMethodEnabled="False" PreviewTextInput="txtJump_PreviewTextInput" KeyDown="txtJump_KeyDown"/>-->
671
+                        <!--<Button Cursor="Hand" Visibility="Visible" x:Name="BtnJumpPage" HorizontalAlignment="Left"  VerticalAlignment="Center" Width="17" Height="17" Background="White" BorderBrush="#FFABADB3" Margin="24,0,0,0" Click="BtnJumpPage_Click">
672
+                            <Button.Resources>
673
+                                <Style TargetType="{x:Type Border}">
674
+                                    <Setter Property="CornerRadius" Value="0"/>
675
+                                    <Setter Property="BorderBrush" Value="#3492F4"/>
676
+                                </Style>
677
+                            </Button.Resources>
678
+                            <Image Source="/星火微课;component/Images/VideoList_OK.png" Margin="2,2,2,2"></Image>
679
+                        </Button>-->
680
+
681
+                        <ComboBox Cursor="Hand" Width="50" Height="20"
682
+                                x:Name="CbxPageList"
683
+                                VerticalContentAlignment="Center"
684
+                                BorderThickness="1"
685
+                                FontSize="13" SelectedIndex="-1"
686
+                                  DisplayMemberPath="PageName" SelectedValuePath="PageCode" SelectionChanged="CbxPageList_SelectionChanged"
687
+                                >
688
+                            <ComboBox.Background>
689
+                                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
690
+                                    <GradientStop Color="#FFF0F0F0" Offset="0"/>
691
+                                    <GradientStop Color="#FFE5E5E5" Offset="1"/>
692
+                                </LinearGradientBrush>
693
+                            </ComboBox.Background>
694
+                        </ComboBox>
695
+                        <TextBlock Text="页" Height="18" Margin="3,5,0,0"></TextBlock>
696
+
683 697
                     </StackPanel>
684 698
                 </Grid>
685 699
 

+ 125
- 25
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Просмотреть файл

@@ -40,6 +40,10 @@ namespace XHWK.WKTool
40 40
     public partial class XHMicroLessonSystemWindow : Window
41 41
     {
42 42
         #region 字段
43
+        /// <summary>
44
+        /// 页码下拉列表
45
+        /// </summary>
46
+        List<PageData> PageData =null;
43 47
         private FolderBrowserDialog Ofd;
44 48
         private DialogResult Result;
45 49
         public BlackboardNew myblackboard;
@@ -960,6 +964,19 @@ namespace XHWK.WKTool
960 964
                         APP.pageData.currpage = APP.pageData.pagenum;
961 965
                         myblackboard.changepage(APP.pageData.currpage - 1);
962 966
                         gridPage.Visibility = Visibility.Visible;//页码大于0 显示
967
+
968
+                        #region 插入页码
969
+                        PageData = new List<PageData>();
970
+                        for (int i = 1; i <= APP.pageData.pagenum; i++)
971
+                        {
972
+                            PageData pd = new PageData();
973
+                            pd.PageName = i.ToString();// + "页";
974
+                            pd.PageCode = i;
975
+                            PageData.Add(pd);
976
+                        }
977
+                        CbxPageList.ItemsSource = PageData;
978
+                        CbxPageList.SelectedIndex = APP.pageData.currpage - 1;
979
+                        #endregion
963 980
                     }
964 981
                     if (APP.PageDrawList.Count >= APP.pageData.currpage)
965 982
                     {
@@ -1095,7 +1112,6 @@ namespace XHWK.WKTool
1095 1112
                         APP.myloading.Show();
1096 1113
                         myblackboard.changepage(APP.pageData.pagenum);
1097 1114
                     }));
1098
-                    #region PPT转PDF
1099 1115
                     string filepath = ofd.FileName;
1100 1116
                     string path = ofd.SafeFileName.Replace(".ppt", "").Replace(".pptx", "").Trim();
1101 1117
                     string type = ofd.SafeFileName.Replace(".ppt", "typezsygppt").Replace(".pptx", "typezsygppt").Replace(".pdf", "typepdf").Trim();
@@ -1103,6 +1119,7 @@ namespace XHWK.WKTool
1103 1119
                     {
1104 1120
                         try
1105 1121
                         {
1122
+                            #region PPT转PDF
1106 1123
                             string pathTemp = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
1107 1124
                             path = pathTemp + path + ".pdf";
1108 1125
                             FileToolsCommon.CreateDirectory(pathTemp);
@@ -1435,6 +1452,22 @@ namespace XHWK.WKTool
1435 1452
                             LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(OpenDialog 导入文档)" + ex.Message, ex);
1436 1453
                         }
1437 1454
                     }
1455
+                    #region 插入页码
1456
+
1457
+                    Dispatcher.Invoke(new Action(() =>
1458
+                    {
1459
+                        PageData = new List<PageData>();
1460
+                        for (int i = 1; i <= APP.pageData.pagenum; i++)
1461
+                        {
1462
+                            PageData pd = new PageData();
1463
+                            pd.PageName = i.ToString();//+ "页";
1464
+                            pd.PageCode = i;
1465
+                            PageData.Add(pd);
1466
+                        }
1467
+                        CbxPageList.ItemsSource = PageData;
1468
+                        CbxPageList.SelectedIndex = APP.pageData.currpage - 1;
1469
+                    }));
1470
+                    #endregion
1438 1471
                 }
1439 1472
             }
1440 1473
             //OpenDialog();
@@ -3543,6 +3576,19 @@ namespace XHWK.WKTool
3543 3576
                 ImgScreenshotTwo.Visibility = Visibility.Collapsed;
3544 3577
                 btnScreenshot.IsEnabled = true;
3545 3578
             }
3579
+
3580
+            #region 插入页码
3581
+            PageData = new List<PageData>();
3582
+            for (int i = 1; i <= APP.pageData.pagenum; i++)
3583
+            {
3584
+                PageData pd = new PageData();
3585
+                pd.PageName = i.ToString();// + "页";
3586
+                pd.PageCode = i;
3587
+                PageData.Add(pd);
3588
+            }
3589
+            CbxPageList.ItemsSource = PageData;
3590
+            CbxPageList.SelectedIndex = APP.pageData.currpage - 1;
3591
+            #endregion
3546 3592
         }
3547 3593
         /// <summary>
3548 3594
         /// 打印事件
@@ -3683,9 +3729,10 @@ namespace XHWK.WKTool
3683 3729
                 HideAngleBorder();
3684 3730
 
3685 3731
                 //隐藏跳转
3686
-                txbCurrpage.Visibility = Visibility.Visible;
3687
-                txtJump.Visibility = Visibility.Hidden;
3688
-                BtnJumpPage.Visibility = Visibility.Hidden;
3732
+                //txbCurrpage.Visibility = Visibility.Visible;
3733
+                //txtJump.Visibility = Visibility.Hidden;
3734
+                //BtnJumpPage.Visibility = Visibility.Hidden;
3735
+
3689 3736
                 //if(!APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation)
3690 3737
                 //{
3691 3738
                 //    ImgWG();
@@ -3778,6 +3825,9 @@ namespace XHWK.WKTool
3778 3825
                     imgCanvas.Source = null;
3779 3826
                     imgDocumentation.Source = null;
3780 3827
                 }
3828
+                #region 修改跳转页码
3829
+                CbxPageList.SelectedIndex = APP.pageData.currpage - 1;
3830
+                #endregion
3781 3831
             }
3782 3832
         }
3783 3833
         private void ImgXY()
@@ -3816,9 +3866,9 @@ namespace XHWK.WKTool
3816 3866
                 HideAngleBorder();
3817 3867
 
3818 3868
                 //隐藏跳转
3819
-                txbCurrpage.Visibility = Visibility.Visible;
3820
-                txtJump.Visibility = Visibility.Hidden;
3821
-                BtnJumpPage.Visibility = Visibility.Hidden;
3869
+                //txbCurrpage.Visibility = Visibility.Visible;
3870
+                //txtJump.Visibility = Visibility.Hidden;
3871
+                //BtnJumpPage.Visibility = Visibility.Hidden;
3822 3872
 
3823 3873
                 //if (!APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation)
3824 3874
                 //{
@@ -4965,6 +5015,8 @@ namespace XHWK.WKTool
4965 5015
             double proportion = 210.0 / 297.0;
4966 5016
             gridM.Height = gridM.ActualWidth / proportion;
4967 5017
         }
5018
+
5019
+        #region 原跳转
4968 5020
         /// <summary>
4969 5021
         /// 跳转页
4970 5022
         /// </summary>
@@ -4978,12 +5030,12 @@ namespace XHWK.WKTool
4978 5030
                 {
4979 5031
                     if (int.Parse(txbCurrpage.Text) > 0)
4980 5032
                     {
4981
-                        txtJump.Text = txbCurrpage.Text;
4982
-                        txbCurrpage.Visibility = Visibility.Hidden;
4983
-                        txtJump.Visibility = Visibility.Visible;
4984
-                        BtnJumpPage.Visibility = Visibility.Visible;
4985
-                        txtJump.Focus();
4986
-                        txtJump.SelectAll();
5033
+                        //txtJump.Text = txbCurrpage.Text;
5034
+                        //txbCurrpage.Visibility = Visibility.Hidden;
5035
+                        //txtJump.Visibility = Visibility.Visible;
5036
+                        //BtnJumpPage.Visibility = Visibility.Visible;
5037
+                        //txtJump.Focus();
5038
+                        //txtJump.SelectAll();
4987 5039
                     }
4988 5040
                 }
4989 5041
                 catch (Exception)
@@ -4999,15 +5051,15 @@ namespace XHWK.WKTool
4999 5051
         private void BtnJumpPage_Click(object sender, RoutedEventArgs e)
5000 5052
         {
5001 5053
             int JumpPage = 0;
5002
-            try
5003
-            {
5004
-                JumpPage = int.Parse(txtJump.Text);
5005
-            }
5006
-            catch (Exception ex)
5007
-            {
5008
-                MessageWindow.Show("操作有误!请输入有效的页码!");
5009
-                return;
5010
-            }
5054
+            //try
5055
+            //{
5056
+            //    JumpPage = int.Parse(txtJump.Text);
5057
+            //}
5058
+            //catch (Exception ex)
5059
+            //{
5060
+            //    MessageWindow.Show("操作有误!请输入有效的页码!");
5061
+            //    return;
5062
+            //}
5011 5063
             if (JumpPage < 1)
5012 5064
             {
5013 5065
                 JumpPage = 1;
@@ -5021,9 +5073,9 @@ namespace XHWK.WKTool
5021 5073
             JumpPageClick();
5022 5074
             #endregion
5023 5075
 
5024
-            txbCurrpage.Visibility = Visibility.Visible;
5025
-            txtJump.Visibility = Visibility.Hidden;
5026
-            BtnJumpPage.Visibility = Visibility.Hidden;
5076
+            //txbCurrpage.Visibility = Visibility.Visible;
5077
+            //txtJump.Visibility = Visibility.Hidden;
5078
+            //BtnJumpPage.Visibility = Visibility.Hidden;
5027 5079
         }
5028 5080
         /// <summary>
5029 5081
         /// 只允许输入数字
@@ -5043,5 +5095,53 @@ namespace XHWK.WKTool
5043 5095
                 BtnJumpPage_Click(null, null);
5044 5096
             }
5045 5097
         }
5098
+        #endregion
5099
+        #region 跳转
5100
+        /// <summary>
5101
+        /// 跳转
5102
+        /// </summary>
5103
+        /// <param name="sender"></param>
5104
+        /// <param name="e"></param>
5105
+        private void CbxPageList_SelectionChanged(object sender, SelectionChangedEventArgs e)
5106
+        {
5107
+            #region 安全
5108
+            if(CbxPageList.SelectedValue==null)
5109
+            {
5110
+                return;
5111
+            }
5112
+            if (APP.pageData.currpage == int.Parse(CbxPageList.SelectedValue.ToString()))
5113
+            {
5114
+                return;
5115
+            }
5116
+            #endregion
5117
+            int JumpPage = 0;
5118
+            try
5119
+            {
5120
+                JumpPage = int.Parse(CbxPageList.SelectedValue.ToString());
5121
+            }
5122
+            catch (Exception ex)
5123
+            {
5124
+                MessageWindow.Show("操作有误!请输入有效的页码!");
5125
+                return;
5126
+            }
5127
+            if (JumpPage < 1)
5128
+            {
5129
+                JumpPage = 1;
5130
+            }
5131
+            if (JumpPage > int.Parse(txbTotalpage.Text))
5132
+            {
5133
+                JumpPage = int.Parse(txbTotalpage.Text);
5134
+            }
5135
+            #region 跳转
5136
+            APP.pageData.currpage = JumpPage;
5137
+            JumpPageClick();
5138
+            #endregion
5139
+        }
5140
+        #endregion
5141
+    }
5142
+    public class PageData
5143
+    {
5144
+        public int PageCode { get; set; }
5145
+        public string PageName { get; set; }
5046 5146
     }
5047 5147
 }

Загрузка…
Отмена
Сохранить