Browse Source

版本号显示调整

样式调整
打印流程修改(使用固定软件打印)
master
张剑 1 year ago
parent
commit
9afc2fe1c9

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

5
   </startup>
5
   </startup>
6
   <appSettings>
6
   <appSettings>
7
     <!--0正式 1测试-->
7
     <!--0正式 1测试-->
8
-    <add key="IsDebug" value="0" />
8
+    <add key="IsDebug" value="1" />
9
     <!--参数是否加密 0不加密 1加密-->
9
     <!--参数是否加密 0不加密 1加密-->
10
     <add key="IsParameterEncryption" value="0" />
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
     <!--皮肤样式 0白 1蓝 2黑色 -->
14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15
     <add key="SkinStyle" value="0" />
15
     <add key="SkinStyle" value="0" />
16
     <!--是否输出视频记录日志:0否-->
16
     <!--是否输出视频记录日志:0否-->
69
       </dependentAssembly>
69
       </dependentAssembly>
70
     </assemblyBinding>
70
     </assemblyBinding>
71
   </runtime>
71
   </runtime>
72
-</configuration>
72
+</configuration>

+ 26
- 186
XHWK.WKTool/MainWindow.xaml View File

82
         <!--  ListBox容器样式  -->
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
     </Window.Resources>
85
     </Window.Resources>
205
 
86
 
206
     <Grid>
87
     <Grid>
414
                                     </Grid>
295
                                     </Grid>
415
                                     <ControlTemplate.Triggers>
296
                                     <ControlTemplate.Triggers>
416
                                         <Trigger Property="IsMouseOver" Value="True">
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
                                             <Setter TargetName="Word" Property="Foreground" Value="#FFFFFFFF" />
299
                                             <Setter TargetName="Word" Property="Foreground" Value="#FFFFFFFF" />
420
                                         </Trigger>
300
                                         </Trigger>
421
                                     </ControlTemplate.Triggers>
301
                                     </ControlTemplate.Triggers>
617
                                         </Grid>
497
                                         </Grid>
618
                                         <ControlTemplate.Triggers>
498
                                         <ControlTemplate.Triggers>
619
                                             <Trigger Property="IsMouseOver" Value="True">
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
                                             </Trigger>
501
                                             </Trigger>
623
                                             <Trigger Property="IsPressed" Value="True">
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
                                             </Trigger>
505
                                             </Trigger>
629
                                             <Trigger Property="IsEnabled" Value="False">
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
                                             </Trigger>
509
                                             </Trigger>
635
                                         </ControlTemplate.Triggers>
510
                                         </ControlTemplate.Triggers>
636
                                     </ControlTemplate>
511
                                     </ControlTemplate>
1200
                                                 <Button.Template>
1075
                                                 <Button.Template>
1201
                                                     <ControlTemplate TargetType="{x:Type Button}">
1076
                                                     <ControlTemplate TargetType="{x:Type Button}">
1202
                                                         <StackPanel>
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
                                                         </StackPanel>
1079
                                                         </StackPanel>
1206
                                                         <ControlTemplate.Triggers>
1080
                                                         <ControlTemplate.Triggers>
1207
                                                             <Trigger Property="IsMouseOver" Value="True">
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
                                                             </Trigger>
1083
                                                             </Trigger>
1211
                                                         </ControlTemplate.Triggers>
1084
                                                         </ControlTemplate.Triggers>
1212
                                                     </ControlTemplate>
1085
                                                     </ControlTemplate>
1232
                                                 <Button.Template>
1105
                                                 <Button.Template>
1233
                                                     <ControlTemplate TargetType="{x:Type Button}">
1106
                                                     <ControlTemplate TargetType="{x:Type Button}">
1234
                                                         <StackPanel>
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
                                                         </StackPanel>
1109
                                                         </StackPanel>
1238
                                                         <ControlTemplate.Triggers>
1110
                                                         <ControlTemplate.Triggers>
1239
                                                             <Trigger Property="IsMouseOver" Value="True">
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
                                                             </Trigger>
1113
                                                             </Trigger>
1243
                                                         </ControlTemplate.Triggers>
1114
                                                         </ControlTemplate.Triggers>
1244
                                                     </ControlTemplate>
1115
                                                     </ControlTemplate>
1739
         <Border
1610
         <Border
1740
             x:Name="GridPrintingTitle"
1611
             x:Name="GridPrintingTitle"
1741
             Width="446"
1612
             Width="446"
1742
-            Height="188"
1613
+            Height="108"
1743
             BorderBrush="#eeeeee"
1614
             BorderBrush="#eeeeee"
1744
             BorderThickness="1"
1615
             BorderThickness="1"
1745
             Visibility="Collapsed">
1616
             Visibility="Collapsed">
1746
             <Grid Background="#ffffff">
1617
             <Grid Background="#ffffff">
1747
                 <Grid.RowDefinitions>
1618
                 <Grid.RowDefinitions>
1748
-                    <RowDefinition Height="42" />
1749
-                    <RowDefinition Height="*" />
1619
+                    <RowDefinition Height="40" />
1750
                     <RowDefinition Height="64" />
1620
                     <RowDefinition Height="64" />
1751
                 </Grid.RowDefinitions>
1621
                 </Grid.RowDefinitions>
1752
                 <Grid Grid.Row="0" Background="#3F6FFF">
1622
                 <Grid Grid.Row="0" Background="#3F6FFF">
1755
                         VerticalAlignment="Center"
1625
                         VerticalAlignment="Center"
1756
                         FontSize="16"
1626
                         FontSize="16"
1757
                         Foreground="White"
1627
                         Foreground="White"
1758
-                        Text="打印" />
1628
+                        Text="打印" />
1759
 
1629
 
1760
                     <Button
1630
                     <Button
1761
                         Grid.Row="0"
1631
                         Grid.Row="0"
1762
                         Width="46"
1632
                         Width="46"
1633
+                        Margin="0,-2,0,0"
1763
                         HorizontalAlignment="Right"
1634
                         HorizontalAlignment="Right"
1764
-                        VerticalAlignment="Stretch"
1635
+                        VerticalContentAlignment="Center"
1765
                         Click="BtnPrintCloseClick"
1636
                         Click="BtnPrintCloseClick"
1766
                         Content="×"
1637
                         Content="×"
1767
                         Cursor="Hand"
1638
                         Cursor="Hand"
1768
                         FontSize="30"
1639
                         FontSize="30"
1769
                         Foreground="White" />
1640
                         Foreground="White" />
1770
                 </Grid>
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
                     <Grid.ColumnDefinitions>
1644
                     <Grid.ColumnDefinitions>
1805
                         <ColumnDefinition Width="30" />
1645
                         <ColumnDefinition Width="30" />
1806
                         <ColumnDefinition Width="Auto" />
1646
                         <ColumnDefinition Width="Auto" />
1807
                         <ColumnDefinition Width="*" />
1647
                         <ColumnDefinition Width="*" />
1808
-                        <ColumnDefinition Width="86" />
1809
-                        <ColumnDefinition Width="86" />
1648
+                        <ColumnDefinition Width="Auto" />
1649
+                        <ColumnDefinition Width="Auto" />
1810
                     </Grid.ColumnDefinitions>
1650
                     </Grid.ColumnDefinitions>
1811
 
1651
 
1812
                     <Image
1652
                     <Image
1827
                         Click="btnPrintExplain_Click"
1667
                         Click="btnPrintExplain_Click"
1828
                         Content="打印说明"
1668
                         Content="打印说明"
1829
                         Cursor="Hand"
1669
                         Cursor="Hand"
1830
-                        FontSize="14"
1670
+                        FontSize="16"
1831
                         Foreground="#3F6FFF"
1671
                         Foreground="#3F6FFF"
1832
                         IsDefault="True" />
1672
                         IsDefault="True" />
1833
 
1673
 
1834
                     <Button
1674
                     <Button
1835
                         Grid.Column="3"
1675
                         Grid.Column="3"
1836
-                        Width="76"
1837
-                        Height="30"
1676
+                        Width="100"
1677
+                        Height="36"
1838
                         Margin="0,0,10,0"
1678
                         Margin="0,0,10,0"
1839
                         HorizontalAlignment="Stretch"
1679
                         HorizontalAlignment="Stretch"
1840
-                        VerticalAlignment="Stretch"
1680
+                        VerticalAlignment="Center"
1841
                         Background="#3F6FFF"
1681
                         Background="#3F6FFF"
1842
                         Click="Print_No_Code_Click"
1682
                         Click="Print_No_Code_Click"
1843
                         Content="普通打印"
1683
                         Content="普通打印"
1844
                         Cursor="Hand"
1684
                         Cursor="Hand"
1845
-                        FontSize="12"
1685
+                        FontSize="16"
1846
                         Foreground="White"
1686
                         Foreground="White"
1847
                         IsDefault="True" />
1687
                         IsDefault="True" />
1848
 
1688
 
1849
                     <Button
1689
                     <Button
1850
                         x:Name="BtnPrintPrint"
1690
                         x:Name="BtnPrintPrint"
1851
                         Grid.Column="4"
1691
                         Grid.Column="4"
1852
-                        Width="76"
1853
-                        Height="30"
1692
+                        Width="100"
1693
+                        Height="36"
1854
                         Margin="0,0,10,0"
1694
                         Margin="0,0,10,0"
1855
                         HorizontalAlignment="Stretch"
1695
                         HorizontalAlignment="Stretch"
1856
                         VerticalAlignment="Stretch"
1696
                         VerticalAlignment="Stretch"
1858
                         Click="BtnPrint_Print_Click"
1698
                         Click="BtnPrint_Print_Click"
1859
                         Content="铺码打印"
1699
                         Content="铺码打印"
1860
                         Cursor="Hand"
1700
                         Cursor="Hand"
1861
-                        FontSize="12"
1701
+                        FontSize="16"
1862
                         Foreground="White"
1702
                         Foreground="White"
1863
                         IsDefault="True" />
1703
                         IsDefault="True" />
1864
                 </Grid>
1704
                 </Grid>

+ 15
- 42
XHWK.WKTool/MainWindow.xaml.cs View File

6
 using NReco.VideoConverter;
6
 using NReco.VideoConverter;
7
 using System;
7
 using System;
8
 using System.Collections.Generic;
8
 using System.Collections.Generic;
9
-using System.Data;
10
 using System.Diagnostics;
9
 using System.Diagnostics;
11
 using System.Drawing;
10
 using System.Drawing;
12
 using System.IO;
11
 using System.IO;
120
             APP.PageDrawList = new List<Model_DrawData>();
119
             APP.PageDrawList = new List<Model_DrawData>();
121
             Model_DrawData modelDrawData = new Model_DrawData { PageNum = APP.PageContextData.currpage };
120
             Model_DrawData modelDrawData = new Model_DrawData { PageNum = APP.PageContextData.currpage };
122
             APP.PageDrawList.Add(modelDrawData);
121
             APP.PageDrawList.Add(modelDrawData);
123
-            Txbv.Text = APP.isDebug ? "测试版" : "正式版" + " v" + FileToolsCommon.GetConfigValue("VersionName");
122
+            Txbv.Text = (APP.isDebug ? "测试版" : "正式版") + " v" + FileToolsCommon.GetConfigValue("VersionName");
124
             TxbStoragePath.Content = FileToolsCommon.GetConfigValue("VideoType");
123
             TxbStoragePath.Content = FileToolsCommon.GetConfigValue("VideoType");
125
             TxbStoragePath.Content = FileToolsCommon.GetConfigValue("VideoSavePath");
124
             TxbStoragePath.Content = FileToolsCommon.GetConfigValue("VideoSavePath");
126
             Initialize();
125
             Initialize();
864
 
863
 
865
         private void Print()
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
                 return;
878
                 return;
871
             }
879
             }
872
             BtnPrint.IsEnabled = false;
880
             BtnPrint.IsEnabled = false;
876
             printmodel.filepath = imgPath;
884
             printmodel.filepath = imgPath;
877
             //打印数量
885
             //打印数量
878
             printmodel.num = 1;
886
             printmodel.num = 1;
879
-            //打印机名称
880
-            string printerName = CmbClass.Text;
881
-            printmodel.printname = printerName;
882
             _printMsg = "准备中";
887
             _printMsg = "准备中";
883
             _msgnum = 0;
888
             _msgnum = 0;
884
             _num = 0;
889
             _num = 0;
3544
 
3549
 
3545
         #region 打印界面
3550
         #region 打印界面
3546
 
3551
 
3547
-        /// <summary>
3548
-        /// 下拉框数据源
3549
-        /// </summary>
3550
-        public DataTable printlist = new DataTable();
3551
-
3552
-        private DataTable _dtComponentsUniqueNo;
3553
-
3554
         private double _hei;
3552
         private double _hei;
3555
 
3553
 
3556
         private int _msgnum;
3554
         private int _msgnum;
3606
         /// <summary>
3604
         /// <summary>
3607
         /// 打印初始化
3605
         /// 打印初始化
3608
         /// </summary>
3606
         /// </summary>
3609
-        public async void InitPrint()
3607
+        public void InitPrint()
3610
         {
3608
         {
3611
             ResizeMode = ResizeMode.NoResize;
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
             TqlPrintInit();
3610
             TqlPrintInit();
3637
         }
3611
         }
3638
 
3612
 
3850
             }
3824
             }
3851
             //PDF位置
3825
             //PDF位置
3852
             string sourcePath = printModel.filepath;
3826
             string sourcePath = printModel.filepath;
3853
-            string printerName = printModel.printname;
3854
             if (_isHasCode)
3827
             if (_isHasCode)
3855
             {
3828
             {
3856
                 _printMsg = "铺码中";
3829
                 _printMsg = "铺码中";
3877
                             string fileName = strs[i];
3850
                             string fileName = strs[i];
3878
 
3851
 
3879
                             //打印文件
3852
                             //打印文件
3880
-                            ZPrintUtils.Print(fileName, printerName);
3853
+                            ZPrintUtils.Print2(fileName);
3881
                         }
3854
                         }
3882
                         Dispatcher.Invoke
3855
                         Dispatcher.Invoke
3883
                         (
3856
                         (
3924
             else
3897
             else
3925
             {
3898
             {
3926
                 //打印文件
3899
                 //打印文件
3927
-                ZPrintUtils.Print(sourcePath, printerName);
3900
+                ZPrintUtils.Print2(sourcePath);
3928
                 Dispatcher.Invoke
3901
                 Dispatcher.Invoke
3929
                 (
3902
                 (
3930
                     () =>
3903
                     () =>

+ 6
- 8
XHWK.WKTool/MessageWindow.xaml View File

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

+ 51
- 13
XHWK.WKTool/Utils/ZPrintUtils.cs View File

1
 using Common.system;
1
 using Common.system;
2
-
2
+using Microsoft.Win32;
3
 using System.Collections.Generic;
3
 using System.Collections.Generic;
4
+using System.Diagnostics;
4
 using System.Drawing.Printing;
5
 using System.Drawing.Printing;
5
 using System.Runtime.InteropServices;
6
 using System.Runtime.InteropServices;
6
 
7
 
8
 {
9
 {
9
     internal class ZPrintUtils
10
     internal class ZPrintUtils
10
     {
11
     {
11
-        private static PrintDocument fPrintDocument = new PrintDocument();
12
+        private static readonly PrintDocument FPrintDocument = new PrintDocument();
12
 
13
 
13
         /// <summary>
14
         /// <summary>
14
         /// 获取本机默认打印机名称
15
         /// 获取本机默认打印机名称
16
         /// <returns></returns>
17
         /// <returns></returns>
17
         public static string DefaultPrinter()
18
         public static string DefaultPrinter()
18
         {
19
         {
19
-            return fPrintDocument.PrinterSettings.PrinterName;
20
+            return FPrintDocument.PrinterSettings.PrinterName;
20
         }
21
         }
21
 
22
 
22
         /// <summary>
23
         /// <summary>
55
         /// <summary>
56
         /// <summary>
56
         /// 调用win api将指定名称的打印机设置为默认打印机
57
         /// 调用win api将指定名称的打印机设置为默认打印机
57
         /// </summary>
58
         /// </summary>
58
-        /// <param name="Name"></param>
59
+        /// <param name="name"></param>
59
         /// <returns></returns>
60
         /// <returns></returns>
60
         [DllImport("winspool.drv")]
61
         [DllImport("winspool.drv")]
61
-        public static extern bool SetDefaultPrinter(string Name);
62
+        public static extern bool SetDefaultPrinter(string name);
62
 
63
 
63
         /// <summary>
64
         /// <summary>
64
         /// 打印
65
         /// 打印
65
         /// </summary>
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
             p.StartInfo.ErrorDialog = true;
75
             p.StartInfo.ErrorDialog = true;
75
             //不显示调用程序窗口,但是对于某些应用无效
76
             //不显示调用程序窗口,但是对于某些应用无效
76
             p.StartInfo.CreateNoWindow = true;
77
             p.StartInfo.CreateNoWindow = true;
77
-            p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
78
+            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
78
             //采用操作系统自动识别的模式
79
             //采用操作系统自动识别的模式
79
             p.StartInfo.UseShellExecute = true;
80
             p.StartInfo.UseShellExecute = true;
80
             //要打印的文件路径
81
             //要打印的文件路径
81
-            p.StartInfo.FileName = PDFPath;
82
+            p.StartInfo.FileName = pdfPath;
82
             //指定执行的动作,是打印,即print,打开是 open
83
             //指定执行的动作,是打印,即print,打开是 open
83
             p.StartInfo.Verb = "print";
84
             p.StartInfo.Verb = "print";
84
             //开始打印
85
             //开始打印
86
             //等待15秒
87
             //等待15秒
87
             p.WaitForExit(15000);
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 View File

3
 
3
 
4
 #define MyAppName "星火微课测试版"  
4
 #define MyAppName "星火微课测试版"  
5
 #define MyAppDir "xhwk_test"
5
 #define MyAppDir "xhwk_test"
6
-#define MyAppVersion "3.2.7"
6
+#define MyAppVersion "3.9.1"
7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8
 #define MyAppURL "http://www.xhkjedu.com/"
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
 #define MyAppExeName "星火微课.exe"
10
 #define MyAppExeName "星火微课.exe"
11
 #define MyIcoName "256.ico"
11
 #define MyIcoName "256.ico"
12
 #define MyTargetPath "D:\程序打包\星火微课-测试\"
12
 #define MyTargetPath "D:\程序打包\星火微课-测试\"

Loading…
Cancel
Save