Quellcode durchsuchen

版本号显示调整

样式调整
打印流程修改(使用固定软件打印)
master
张剑 vor 1 Jahr
Ursprung
Commit
9afc2fe1c9

+ 4
- 4
XHWK.WKTool/App.config Datei anzeigen

@@ -5,12 +5,12 @@
5 5
   </startup>
6 6
   <appSettings>
7 7
     <!--0正式 1测试-->
8
-    <add key="IsDebug" value="0" />
8
+    <add key="IsDebug" value="1" />
9 9
     <!--参数是否加密 0不加密 1加密-->
10 10
     <add key="IsParameterEncryption" value="0" />
11 11
     <!--版本号-->
12
-    <add key="VersionCode" value="117" />
13
-    <add key="VersionName" value="3.9.0" />
12
+    <add key="VersionCode" value="118" />
13
+    <add key="VersionName" value="3.9.1" />
14 14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15 15
     <add key="SkinStyle" value="0" />
16 16
     <!--是否输出视频记录日志:0否-->
@@ -69,4 +69,4 @@
69 69
       </dependentAssembly>
70 70
     </assemblyBinding>
71 71
   </runtime>
72
-</configuration>
72
+</configuration>

+ 26
- 186
XHWK.WKTool/MainWindow.xaml Datei anzeigen

@@ -82,125 +82,6 @@
82 82
         <!--  ListBox容器样式  -->
83 83
 
84 84
         <!--  摄像头样式  -->
85
-        <Style x:Key="StlToggleButton" TargetType="ToggleButton">
86
-            <Setter Property="Foreground" Value="White" />
87
-            <Setter Property="Template">
88
-                <Setter.Value>
89
-                    <ControlTemplate>
90
-                        <Border
91
-                            x:Name="Back"
92
-                            Background="#FFFFFFFF"
93
-                            BorderBrush="Transparent"
94
-                            BorderThickness="0">
95
-                            <Path
96
-                                Name="PathFill"
97
-                                Width="8"
98
-                                Height="6"
99
-                                Data="M5,0 L10,10 L0,10 z"
100
-                                Fill="Black"
101
-                                RenderTransformOrigin="0.5,0.5"
102
-                                Stretch="Fill"
103
-                                StrokeThickness="0">
104
-                                <Path.RenderTransform>
105
-                                    <TransformGroup>
106
-                                        <ScaleTransform />
107
-                                        <SkewTransform />
108
-                                        <RotateTransform Angle="180" />
109
-                                        <TranslateTransform />
110
-                                    </TransformGroup>
111
-                                </Path.RenderTransform>
112
-                            </Path>
113
-                        </Border>
114
-                        <ControlTemplate.Triggers>
115
-                            <Trigger Property="IsMouseOver" Value="True">
116
-                                <Setter TargetName="PathFill" Property="Fill" Value="White" />
117
-                                <Setter TargetName="Back" Property="Background" Value="#FFDCDCDC" />
118
-                                <Setter TargetName="Back" Property="BorderBrush" Value="#FFDCDCDC" />
119
-                            </Trigger>
120
-                        </ControlTemplate.Triggers>
121
-                    </ControlTemplate>
122
-                </Setter.Value>
123
-            </Setter>
124
-        </Style>
125
-        <Style x:Key="StlComboBox" TargetType="ComboBox">
126
-            <Setter Property="SnapsToDevicePixels" Value="True" />
127
-            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
128
-            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
129
-            <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
130
-            <Setter Property="HorizontalAlignment" Value="Left" />
131
-            <Setter Property="Foreground" Value="Black" />
132
-            <Setter Property="Height" Value="30" />
133
-            <Setter Property="Margin" Value="0,0,0,0" />
134
-            <Setter Property="Template">
135
-                <Setter.Value>
136
-                    <ControlTemplate TargetType="ComboBox">
137
-                        <Grid Background="#F7FDF7">
138
-                            <Grid.ColumnDefinitions>
139
-                                <ColumnDefinition Width="0.8*" />
140
-                                <ColumnDefinition Width="0.2*" MaxWidth="20" />
141
-                            </Grid.ColumnDefinitions>
142
-                            <TextBox
143
-                                Grid.Column="0"
144
-                                VerticalContentAlignment="Center"
145
-                                IsReadOnly="True"
146
-                                Text="{TemplateBinding Text}" />
147
-                            <Border
148
-                                Grid.Column="0"
149
-                                BorderBrush="#FFDCDCDC"
150
-                                BorderThickness="1,1,1,1"
151
-                                CornerRadius="1,0,0,1" />
152
-                            <Border
153
-                                Grid.Column="1"
154
-                                BorderBrush="#FFDCDCDC"
155
-                                BorderThickness="0,1,1,1"
156
-                                CornerRadius="0,1,1,0">
157
-                                <ToggleButton
158
-                                    ClickMode="Press"
159
-                                    IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
160
-                                    Style="{StaticResource StlToggleButton}" />
161
-                            </Border>
162
-                            <Popup
163
-                                x:Name="Popup"
164
-                                Grid.Column="0"
165
-                                AllowsTransparency="True"
166
-                                Focusable="False"
167
-                                IsOpen="{TemplateBinding IsDropDownOpen}"
168
-                                Placement="Bottom"
169
-                                PopupAnimation="Slide">
170
-                                <Border
171
-                                    x:Name="DropDown"
172
-                                    MinWidth="{TemplateBinding ActualWidth}"
173
-                                    MaxHeight="{TemplateBinding MaxDropDownHeight}"
174
-                                    CornerRadius="1"
175
-                                    SnapsToDevicePixels="True">
176
-                                    <Border.Effect>
177
-                                        <DropShadowEffect
178
-                                            BlurRadius="2"
179
-                                            Opacity="0.5"
180
-                                            ShadowDepth="0"
181
-                                            Color="Black" />
182
-                                    </Border.Effect>
183
-                                    <ScrollViewer
184
-                                        MaxHeight="{TemplateBinding MaxDropDownHeight}"
185
-                                        Margin="4,6,4,6"
186
-                                        CanContentScroll="True"
187
-                                        HorizontalScrollBarVisibility="Auto"
188
-                                        SnapsToDevicePixels="True"
189
-                                        Style="{DynamicResource ScrollViewerStyle}"
190
-                                        VerticalScrollBarVisibility="Auto">
191
-                                        <!--  StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True  -->
192
-                                        <StackPanel
193
-                                            Background="White"
194
-                                            IsItemsHost="True"
195
-                                            KeyboardNavigation.DirectionalNavigation="Contained" />
196
-                                    </ScrollViewer>
197
-                                </Border>
198
-                            </Popup>
199
-                        </Grid>
200
-                    </ControlTemplate>
201
-                </Setter.Value>
202
-            </Setter>
203
-        </Style>
204 85
     </Window.Resources>
205 86
 
206 87
     <Grid>
@@ -414,8 +295,7 @@
414 295
                                     </Grid>
415 296
                                     <ControlTemplate.Triggers>
416 297
                                         <Trigger Property="IsMouseOver" Value="True">
417
-                                            <Setter TargetName="ImgSetUp" Property="Source"
418
-                                                    Value="/SkinImages/TechnologyBlue/HM_Close_MI.png" />
298
+                                            <Setter TargetName="ImgSetUp" Property="Source" Value="/SkinImages/TechnologyBlue/HM_Close_MI.png" />
419 299
                                             <Setter TargetName="Word" Property="Foreground" Value="#FFFFFFFF" />
420 300
                                         </Trigger>
421 301
                                     </ControlTemplate.Triggers>
@@ -617,20 +497,15 @@
617 497
                                         </Grid>
618 498
                                         <ControlTemplate.Triggers>
619 499
                                             <Trigger Property="IsMouseOver" Value="True">
620
-                                                <Setter TargetName="ImgScreenRecording" Property="Source"
621
-                                                        Value="/SkinImages/White/Toolbar_LP_MI.png" />
500
+                                                <Setter TargetName="ImgScreenRecording" Property="Source" Value="/SkinImages/White/Toolbar_LP_MI.png" />
622 501
                                             </Trigger>
623 502
                                             <Trigger Property="IsPressed" Value="True">
624
-                                                <Setter TargetName="ImgScreenRecording" Property="Source"
625
-                                                        Value="/SkinImages/White/Toolbar_LP_CL.png" />
626
-                                                <Setter TargetName="WordScreenRecording" Property="Foreground"
627
-                                                        Value="#FFFFFFFF" />
503
+                                                <Setter TargetName="ImgScreenRecording" Property="Source" Value="/SkinImages/White/Toolbar_LP_CL.png" />
504
+                                                <Setter TargetName="WordScreenRecording" Property="Foreground" Value="#FFFFFFFF" />
628 505
                                             </Trigger>
629 506
                                             <Trigger Property="IsEnabled" Value="False">
630
-                                                <Setter TargetName="ImgScreenRecording" Property="Source"
631
-                                                        Value="/SkinImages/White/Toolbar_LP_N.png" />
632
-                                                <Setter TargetName="WordScreenRecording" Property="Foreground"
633
-                                                        Value="#FFC3C3C3" />
507
+                                                <Setter TargetName="ImgScreenRecording" Property="Source" Value="/SkinImages/White/Toolbar_LP_N.png" />
508
+                                                <Setter TargetName="WordScreenRecording" Property="Foreground" Value="#FFC3C3C3" />
634 509
                                             </Trigger>
635 510
                                         </ControlTemplate.Triggers>
636 511
                                     </ControlTemplate>
@@ -1200,13 +1075,11 @@
1200 1075
                                                 <Button.Template>
1201 1076
                                                     <ControlTemplate TargetType="{x:Type Button}">
1202 1077
                                                         <StackPanel>
1203
-                                                            <Image x:Name="ImgRecord"
1204
-                                                                   Source="/SkinImages/Skin/Skin_White.png" />
1078
+                                                            <Image x:Name="ImgRecord" Source="/SkinImages/Skin/Skin_White.png" />
1205 1079
                                                         </StackPanel>
1206 1080
                                                         <ControlTemplate.Triggers>
1207 1081
                                                             <Trigger Property="IsMouseOver" Value="True">
1208
-                                                                <Setter TargetName="ImgRecord" Property="Source"
1209
-                                                                        Value="/SkinImages/Skin/Skin_White_MI.png" />
1082
+                                                                <Setter TargetName="ImgRecord" Property="Source" Value="/SkinImages/Skin/Skin_White_MI.png" />
1210 1083
                                                             </Trigger>
1211 1084
                                                         </ControlTemplate.Triggers>
1212 1085
                                                     </ControlTemplate>
@@ -1232,13 +1105,11 @@
1232 1105
                                                 <Button.Template>
1233 1106
                                                     <ControlTemplate TargetType="{x:Type Button}">
1234 1107
                                                         <StackPanel>
1235
-                                                            <Image x:Name="ImgRecord"
1236
-                                                                   Source="/SkinImages/Skin/Skin_TechnologyBlue.png" />
1108
+                                                            <Image x:Name="ImgRecord" Source="/SkinImages/Skin/Skin_TechnologyBlue.png" />
1237 1109
                                                         </StackPanel>
1238 1110
                                                         <ControlTemplate.Triggers>
1239 1111
                                                             <Trigger Property="IsMouseOver" Value="True">
1240
-                                                                <Setter TargetName="ImgRecord" Property="Source"
1241
-                                                                        Value="/SkinImages/Skin/Skin_TechnologyBlue_MI.png" />
1112
+                                                                <Setter TargetName="ImgRecord" Property="Source" Value="/SkinImages/Skin/Skin_TechnologyBlue_MI.png" />
1242 1113
                                                             </Trigger>
1243 1114
                                                         </ControlTemplate.Triggers>
1244 1115
                                                     </ControlTemplate>
@@ -1739,14 +1610,13 @@
1739 1610
         <Border
1740 1611
             x:Name="GridPrintingTitle"
1741 1612
             Width="446"
1742
-            Height="188"
1613
+            Height="108"
1743 1614
             BorderBrush="#eeeeee"
1744 1615
             BorderThickness="1"
1745 1616
             Visibility="Collapsed">
1746 1617
             <Grid Background="#ffffff">
1747 1618
                 <Grid.RowDefinitions>
1748
-                    <RowDefinition Height="42" />
1749
-                    <RowDefinition Height="*" />
1619
+                    <RowDefinition Height="40" />
1750 1620
                     <RowDefinition Height="64" />
1751 1621
                 </Grid.RowDefinitions>
1752 1622
                 <Grid Grid.Row="0" Background="#3F6FFF">
@@ -1755,58 +1625,28 @@
1755 1625
                         VerticalAlignment="Center"
1756 1626
                         FontSize="16"
1757 1627
                         Foreground="White"
1758
-                        Text="打印" />
1628
+                        Text="打印" />
1759 1629
 
1760 1630
                     <Button
1761 1631
                         Grid.Row="0"
1762 1632
                         Width="46"
1633
+                        Margin="0,-2,0,0"
1763 1634
                         HorizontalAlignment="Right"
1764
-                        VerticalAlignment="Stretch"
1635
+                        VerticalContentAlignment="Center"
1765 1636
                         Click="BtnPrintCloseClick"
1766 1637
                         Content="×"
1767 1638
                         Cursor="Hand"
1768 1639
                         FontSize="30"
1769 1640
                         Foreground="White" />
1770 1641
                 </Grid>
1771
-                <Grid Grid.Row="1" Height="46">
1772
-                    <Grid.ColumnDefinitions>
1773
-                        <ColumnDefinition Width="Auto" />
1774
-                        <ColumnDefinition Width="*" />
1775
-                    </Grid.ColumnDefinitions>
1776
-                    <TextBlock
1777
-                        Grid.Column="0"
1778
-                        Margin="10,0,0,0"
1779
-                        HorizontalAlignment="Left"
1780
-                        VerticalAlignment="Center"
1781
-                        FontSize="16"
1782
-                        Style="{DynamicResource TxbMesColor}"
1783
-                        Text="打印机" />
1784
-
1785
-                    <ComboBox
1786
-                        x:Name="CmbClass"
1787
-                        Grid.Column="1"
1788
-                        Height="36"
1789
-                        Margin="10,0,10,0"
1790
-                        HorizontalAlignment="Stretch"
1791
-                        HorizontalContentAlignment="Left"
1792
-                        VerticalContentAlignment="Center"
1793
-                        Background="White"
1794
-                        BorderThickness="0"
1795
-                        Cursor="Hand"
1796
-                        DisplayMemberPath="Value"
1797
-                        FontSize="16"
1798
-                        SelectedValuePath="Key"
1799
-                        Style="{StaticResource StlComboBox}"
1800
-                        Text="请选择" />
1801
-                </Grid>
1802 1642
 
1803
-                <Grid Grid.Row="2">
1643
+                <Grid Grid.Row="1">
1804 1644
                     <Grid.ColumnDefinitions>
1805 1645
                         <ColumnDefinition Width="30" />
1806 1646
                         <ColumnDefinition Width="Auto" />
1807 1647
                         <ColumnDefinition Width="*" />
1808
-                        <ColumnDefinition Width="86" />
1809
-                        <ColumnDefinition Width="86" />
1648
+                        <ColumnDefinition Width="Auto" />
1649
+                        <ColumnDefinition Width="Auto" />
1810 1650
                     </Grid.ColumnDefinitions>
1811 1651
 
1812 1652
                     <Image
@@ -1827,30 +1667,30 @@
1827 1667
                         Click="btnPrintExplain_Click"
1828 1668
                         Content="打印说明"
1829 1669
                         Cursor="Hand"
1830
-                        FontSize="14"
1670
+                        FontSize="16"
1831 1671
                         Foreground="#3F6FFF"
1832 1672
                         IsDefault="True" />
1833 1673
 
1834 1674
                     <Button
1835 1675
                         Grid.Column="3"
1836
-                        Width="76"
1837
-                        Height="30"
1676
+                        Width="100"
1677
+                        Height="36"
1838 1678
                         Margin="0,0,10,0"
1839 1679
                         HorizontalAlignment="Stretch"
1840
-                        VerticalAlignment="Stretch"
1680
+                        VerticalAlignment="Center"
1841 1681
                         Background="#3F6FFF"
1842 1682
                         Click="Print_No_Code_Click"
1843 1683
                         Content="普通打印"
1844 1684
                         Cursor="Hand"
1845
-                        FontSize="12"
1685
+                        FontSize="16"
1846 1686
                         Foreground="White"
1847 1687
                         IsDefault="True" />
1848 1688
 
1849 1689
                     <Button
1850 1690
                         x:Name="BtnPrintPrint"
1851 1691
                         Grid.Column="4"
1852
-                        Width="76"
1853
-                        Height="30"
1692
+                        Width="100"
1693
+                        Height="36"
1854 1694
                         Margin="0,0,10,0"
1855 1695
                         HorizontalAlignment="Stretch"
1856 1696
                         VerticalAlignment="Stretch"
@@ -1858,7 +1698,7 @@
1858 1698
                         Click="BtnPrint_Print_Click"
1859 1699
                         Content="铺码打印"
1860 1700
                         Cursor="Hand"
1861
-                        FontSize="12"
1701
+                        FontSize="16"
1862 1702
                         Foreground="White"
1863 1703
                         IsDefault="True" />
1864 1704
                 </Grid>

+ 15
- 42
XHWK.WKTool/MainWindow.xaml.cs Datei anzeigen

@@ -6,7 +6,6 @@ using NAudio.Wave;
6 6
 using NReco.VideoConverter;
7 7
 using System;
8 8
 using System.Collections.Generic;
9
-using System.Data;
10 9
 using System.Diagnostics;
11 10
 using System.Drawing;
12 11
 using System.IO;
@@ -120,7 +119,7 @@ namespace XHWK.WKTool
120 119
             APP.PageDrawList = new List<Model_DrawData>();
121 120
             Model_DrawData modelDrawData = new Model_DrawData { PageNum = APP.PageContextData.currpage };
122 121
             APP.PageDrawList.Add(modelDrawData);
123
-            Txbv.Text = APP.isDebug ? "测试版" : "正式版" + " v" + FileToolsCommon.GetConfigValue("VersionName");
122
+            Txbv.Text = (APP.isDebug ? "测试版" : "正式版") + " v" + FileToolsCommon.GetConfigValue("VersionName");
124 123
             TxbStoragePath.Content = FileToolsCommon.GetConfigValue("VideoType");
125 124
             TxbStoragePath.Content = FileToolsCommon.GetConfigValue("VideoSavePath");
126 125
             Initialize();
@@ -864,9 +863,18 @@ namespace XHWK.WKTool
864 863
 
865 864
         private void Print()
866 865
         {
867
-            if (string.IsNullOrWhiteSpace(CmbClass.Text))
866
+            if (!ZPrintUtils.IsExistAcroRd32())
868 867
             {
869
-                MessageWindow.Show("请设置打印机!");
868
+                MessageBoxResult dr = MessageWindow.Show
869
+                (
870
+                    "需要安装PDF阅读器,是否下载安装?",
871
+                    "提示",
872
+                    MessageBoxButton.OKCancel
873
+                );
874
+                if (dr == MessageBoxResult.OK)
875
+                {
876
+                    ZPrintUtils.InstallAcroRd32ByUser();
877
+                }
870 878
                 return;
871 879
             }
872 880
             BtnPrint.IsEnabled = false;
@@ -876,9 +884,6 @@ namespace XHWK.WKTool
876 884
             printmodel.filepath = imgPath;
877 885
             //打印数量
878 886
             printmodel.num = 1;
879
-            //打印机名称
880
-            string printerName = CmbClass.Text;
881
-            printmodel.printname = printerName;
882 887
             _printMsg = "准备中";
883 888
             _msgnum = 0;
884 889
             _num = 0;
@@ -3544,13 +3549,6 @@ namespace XHWK.WKTool
3544 3549
 
3545 3550
         #region 打印界面
3546 3551
 
3547
-        /// <summary>
3548
-        /// 下拉框数据源
3549
-        /// </summary>
3550
-        public DataTable printlist = new DataTable();
3551
-
3552
-        private DataTable _dtComponentsUniqueNo;
3553
-
3554 3552
         private double _hei;
3555 3553
 
3556 3554
         private int _msgnum;
@@ -3606,33 +3604,9 @@ namespace XHWK.WKTool
3606 3604
         /// <summary>
3607 3605
         /// 打印初始化
3608 3606
         /// </summary>
3609
-        public async void InitPrint()
3607
+        public void InitPrint()
3610 3608
         {
3611 3609
             ResizeMode = ResizeMode.NoResize;
3612
-            await Task.Run
3613
-            (
3614
-                () =>
3615
-                {
3616
-                    List<string> defaList = ZPrintUtils.GetLocalPrinters();
3617
-                    if (defaList.Count > 0)
3618
-                    {
3619
-                        printlist.Columns.Add("Value");
3620
-                        printlist.Columns.Add("Key");
3621
-                        for (int i = 0; i < defaList.Count; i++)
3622
-                        {
3623
-                            //创建一行
3624
-                            DataRow row = printlist.NewRow();
3625
-                            //将此行添加到table中
3626
-                            printlist.Rows.Add(row);
3627
-                            printlist.Rows[i]["Value"] = defaList[i];
3628
-                            printlist.Rows[i]["Key"] = i.ToString();
3629
-                        }
3630
-                        _dtComponentsUniqueNo = printlist.DefaultView.ToTable();
3631
-                    }
3632
-                }
3633
-            );
3634
-            CmbClass.ItemsSource = _dtComponentsUniqueNo.DefaultView;
3635
-            CmbClass.SelectedIndex = 0;
3636 3610
             TqlPrintInit();
3637 3611
         }
3638 3612
 
@@ -3850,7 +3824,6 @@ namespace XHWK.WKTool
3850 3824
             }
3851 3825
             //PDF位置
3852 3826
             string sourcePath = printModel.filepath;
3853
-            string printerName = printModel.printname;
3854 3827
             if (_isHasCode)
3855 3828
             {
3856 3829
                 _printMsg = "铺码中";
@@ -3877,7 +3850,7 @@ namespace XHWK.WKTool
3877 3850
                             string fileName = strs[i];
3878 3851
 
3879 3852
                             //打印文件
3880
-                            ZPrintUtils.Print(fileName, printerName);
3853
+                            ZPrintUtils.Print2(fileName);
3881 3854
                         }
3882 3855
                         Dispatcher.Invoke
3883 3856
                         (
@@ -3924,7 +3897,7 @@ namespace XHWK.WKTool
3924 3897
             else
3925 3898
             {
3926 3899
                 //打印文件
3927
-                ZPrintUtils.Print(sourcePath, printerName);
3900
+                ZPrintUtils.Print2(sourcePath);
3928 3901
                 Dispatcher.Invoke
3929 3902
                 (
3930 3903
                     () =>

+ 6
- 8
XHWK.WKTool/MessageWindow.xaml Datei anzeigen

@@ -6,9 +6,8 @@
6 6
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7 7
     Title="星火微课"
8 8
     Width="446"
9
-    Height="188"
9
+    Height="148"
10 10
     d:DesignHeight="250"
11
-    AllowsTransparency="False"
12 11
     MouseMove="Window_MouseMove"
13 12
     ResizeMode="NoResize"
14 13
     ShowInTaskbar="False"
@@ -38,7 +37,7 @@
38 37
                     HorizontalContentAlignment="Stretch"
39 38
                     VerticalContentAlignment="Stretch"
40 39
                     Content="提示"
41
-                    FontSize="16"
40
+                    FontSize="18"
42 41
                     Foreground="White" />
43 42
 
44 43
                 <Button
@@ -56,7 +55,7 @@
56 55
             <Grid Grid.Row="1">
57 56
                 <TextBlock
58 57
                     x:Name="TbkContent"
59
-                    Margin="20,0,20,0"
58
+                    Margin="20,20,20,0"
60 59
                     HorizontalAlignment="Center"
61 60
                     VerticalAlignment="Center"
62 61
                     FontSize="16"
@@ -65,7 +64,6 @@
65 64
                     TextWrapping="Wrap" />
66 65
             </Grid>
67 66
             <Grid Grid.Row="2" Margin="0,0,0,0">
68
-
69 67
                 <Border
70 68
                     x:Name="BorOk"
71 69
                     Margin="0,0,10,0"
@@ -75,14 +73,14 @@
75 73
                     CornerRadius="6">
76 74
                     <Button
77 75
                         x:Name="BtnOk"
78
-                        Width="76"
79
-                        Height="30"
76
+                        Width="100"
77
+                        Height="36"
80 78
                         Background="#00000000"
81 79
                         BorderBrush="{x:Null}"
82 80
                         Click="BtnOK_Click"
83 81
                         Content="确定"
84 82
                         Cursor="Hand"
85
-                        FontSize="14"
83
+                        FontSize="16"
86 84
                         Foreground="White"
87 85
                         IsDefault="True" />
88 86
                 </Border>

+ 51
- 13
XHWK.WKTool/Utils/ZPrintUtils.cs Datei anzeigen

@@ -1,6 +1,7 @@
1 1
 using Common.system;
2
-
2
+using Microsoft.Win32;
3 3
 using System.Collections.Generic;
4
+using System.Diagnostics;
4 5
 using System.Drawing.Printing;
5 6
 using System.Runtime.InteropServices;
6 7
 
@@ -8,7 +9,7 @@ namespace XHWK.WKTool.Utils
8 9
 {
9 10
     internal class ZPrintUtils
10 11
     {
11
-        private static PrintDocument fPrintDocument = new PrintDocument();
12
+        private static readonly PrintDocument FPrintDocument = new PrintDocument();
12 13
 
13 14
         /// <summary>
14 15
         /// 获取本机默认打印机名称
@@ -16,7 +17,7 @@ namespace XHWK.WKTool.Utils
16 17
         /// <returns></returns>
17 18
         public static string DefaultPrinter()
18 19
         {
19
-            return fPrintDocument.PrinterSettings.PrinterName;
20
+            return FPrintDocument.PrinterSettings.PrinterName;
20 21
         }
21 22
 
22 23
         /// <summary>
@@ -55,30 +56,30 @@ namespace XHWK.WKTool.Utils
55 56
         /// <summary>
56 57
         /// 调用win api将指定名称的打印机设置为默认打印机
57 58
         /// </summary>
58
-        /// <param name="Name"></param>
59
+        /// <param name="name"></param>
59 60
         /// <returns></returns>
60 61
         [DllImport("winspool.drv")]
61
-        public static extern bool SetDefaultPrinter(string Name);
62
+        public static extern bool SetDefaultPrinter(string name);
62 63
 
63 64
         /// <summary>
64 65
         /// 打印
65 66
         /// </summary>
66
-        /// <param name="PDFPath">打印文件的路径</param>
67
-        /// <param name="PrinterName">打印机的名称</param>
68
-        public static void Print(string PDFPath, string PrinterName)
67
+        /// <param name="pdfPath">打印文件的路径</param>
68
+        /// <param name="printerName">打印机的名称</param>
69
+        public static void Print(string pdfPath, string printerName)
69 70
         {
70 71
             //设置默认打印机
71
-            SetDefaultPrinter(PrinterName);
72
-            System.Diagnostics.Process p = new System.Diagnostics.Process();
72
+            SetDefaultPrinter(printerName);
73
+            Process p = new Process();
73 74
             //不能启动进程是否显示错误弹窗,如果文件没有打开方式会提示选择文件的打开方式
74 75
             p.StartInfo.ErrorDialog = true;
75 76
             //不显示调用程序窗口,但是对于某些应用无效
76 77
             p.StartInfo.CreateNoWindow = true;
77
-            p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
78
+            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
78 79
             //采用操作系统自动识别的模式
79 80
             p.StartInfo.UseShellExecute = true;
80 81
             //要打印的文件路径
81
-            p.StartInfo.FileName = PDFPath;
82
+            p.StartInfo.FileName = pdfPath;
82 83
             //指定执行的动作,是打印,即print,打开是 open
83 84
             p.StartInfo.Verb = "print";
84 85
             //开始打印
@@ -86,5 +87,42 @@ namespace XHWK.WKTool.Utils
86 87
             //等待15秒
87 88
             p.WaitForExit(15000);
88 89
         }
90
+
91
+        /// <summary>
92
+        /// 是否安装AcroRd32
93
+        /// </summary>
94
+        /// <returns></returns>
95
+        public static bool IsExistAcroRd32()
96
+        {
97
+            RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe");
98
+            return key != null;
99
+        }
100
+
101
+        public static bool Print2(string pdfPath)
102
+        {
103
+            try
104
+            {
105
+                RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe");
106
+                if (key != null)
107
+                {
108
+                    string acroRd32Path = key.GetValue("").ToString();
109
+                    string args = $"/P \"{pdfPath}\"";
110
+                    Process.Start(acroRd32Path, args);
111
+                    return true;
112
+                }
113
+                return false;
114
+            }
115
+            catch
116
+            {
117
+                // ignored
118
+            }
119
+            return false;
120
+        }
121
+
122
+        public static void InstallAcroRd32ByUser()
123
+        {
124
+            string downloadUrl = "https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/AcroRdrDC1900820071_zh_CN.exe";
125
+            Process.Start(downloadUrl);
126
+        }
89 127
     }
90
-}
128
+}

+ 2
- 2
星火微课/星火微课-测试.iss Datei anzeigen

@@ -3,10 +3,10 @@
3 3
 
4 4
 #define MyAppName "星火微课测试版"  
5 5
 #define MyAppDir "xhwk_test"
6
-#define MyAppVersion "3.2.7"
6
+#define MyAppVersion "3.9.1"
7 7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8 8
 #define MyAppURL "http://www.xhkjedu.com/"
9
-#define MySourcePath "D:\Project\CSharp\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
9
+#define MySourcePath "D:\Project\CSharp\xh-wkclient\XHWK.WKTool\bin\x86\Debug\"
10 10
 #define MyAppExeName "星火微课.exe"
11 11
 #define MyIcoName "256.ico"
12 12
 #define MyTargetPath "D:\程序打包\星火微课-测试\"

Laden…
Abbrechen
Speichern