Quellcode durchsuchen

zhao:增加TQL铺码SDK,兼容TQL130点阵笔

tags/录制修改前
耀 vor 3 Jahren
Ursprung
Commit
8b20557360
37 geänderte Dateien mit 1869 neuen und 189 gelöschten Zeilen
  1. 1
    0
      Common/Common.csproj
  2. BIN
      Common/dlls/TQLFinalDLL/AcroPDF.dll
  3. BIN
      Common/dlls/TQLFinalDLL/AcroPDFImpl.dll
  4. BIN
      Common/dlls/TQLFinalDLL/AcroPDFImpl64.dll
  5. BIN
      Common/dlls/TQLFinalDLL/AxInterop.AcroPDFLib.dll
  6. BIN
      Common/dlls/TQLFinalDLL/DocumentTools.dll
  7. BIN
      Common/dlls/TQLFinalDLL/DrawToolsLib.dll
  8. BIN
      Common/dlls/TQLFinalDLL/Interop.AFORMAUTLib.dll
  9. BIN
      Common/dlls/TQLFinalDLL/Interop.AcroPDFLib.dll
  10. BIN
      Common/dlls/TQLFinalDLL/Interop.Acrobat.dll
  11. BIN
      Common/dlls/TQLFinalDLL/Interop.LCC11.dll
  12. BIN
      Common/dlls/TQLFinalDLL/Microsoft.Ink.dll
  13. BIN
      Common/dlls/TQLFinalDLL/Microsoft.Office.Interop.Access.Dao.dll
  14. BIN
      Common/dlls/TQLFinalDLL/TmatrixLibrary_OID4.dll
  15. BIN
      Common/dlls/TQLFinalDLL/acropdf64.dll
  16. BIN
      Common/dlls/TQLFinalDLL/itextsharp.dll
  17. BIN
      Common/dlls/TQLFinalDLL/libmupdf.dll
  18. 121
    0
      Common/system/AutoStartHelper.cs
  19. 2
    1
      Common/system/FileToolsCommon.cs
  20. 1
    1
      Common/system/HttpHelper.cs
  21. 200
    0
      XHWK.Model/Model_TmatrixCode.cs
  22. 1
    0
      XHWK.Model/XHWK.Model.csproj
  23. 14
    4
      XHWK.WKTool/App.config
  24. 23
    0
      XHWK.WKTool/App.cs
  25. 278
    0
      XHWK.WKTool/DAL/DAL_TmatrixCode.cs
  26. 1
    0
      XHWK.WKTool/LatticeXML/S0_O000_B0000_P000-255.tmx
  27. 1
    1
      XHWK.WKTool/MessageWindow.xaml.cs
  28. 28
    5
      XHWK.WKTool/PrintWindow.xaml
  29. 330
    161
      XHWK.WKTool/PrintWindow.xaml.cs
  30. 128
    0
      XHWK.WKTool/PrintWindowTStudy.xaml
  31. 632
    0
      XHWK.WKTool/PrintWindowTStudy.xaml.cs
  32. 2
    2
      XHWK.WKTool/Properties/AssemblyInfo.cs
  33. BIN
      XHWK.WKTool/TQLComm.dll
  34. 28
    10
      XHWK.WKTool/TQLPen/PenEvents.cs
  35. 10
    0
      XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs
  36. 65
    3
      XHWK.WKTool/XHWK.WKTool.csproj
  37. 3
    1
      XHWK.WKTool/packages.config

+ 1
- 0
Common/Common.csproj Datei anzeigen

@@ -118,6 +118,7 @@
118 118
   <ItemGroup>
119 119
     <Compile Include="AESHelper.cs" />
120 120
     <Compile Include="Model\DownloadInfoModel.cs" />
121
+    <Compile Include="system\AutoStartHelper.cs" />
121 122
     <Compile Include="system\DataProvider.cs" />
122 123
     <Compile Include="system\KeyboardHookCommon.cs" />
123 124
     <Compile Include="system\LatticeFileHelper.cs" />

BIN
Common/dlls/TQLFinalDLL/AcroPDF.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/AcroPDFImpl.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/AcroPDFImpl64.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/AxInterop.AcroPDFLib.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/DocumentTools.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/DrawToolsLib.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/Interop.AFORMAUTLib.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/Interop.AcroPDFLib.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/Interop.Acrobat.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/Interop.LCC11.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/Microsoft.Ink.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/Microsoft.Office.Interop.Access.Dao.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/TmatrixLibrary_OID4.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/acropdf64.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/itextsharp.dll Datei anzeigen


BIN
Common/dlls/TQLFinalDLL/libmupdf.dll Datei anzeigen


+ 121
- 0
Common/system/AutoStartHelper.cs Datei anzeigen

@@ -0,0 +1,121 @@
1
+using Microsoft.Win32;
2
+
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Linq;
6
+using System.Text;
7
+using System.Threading.Tasks;
8
+
9
+namespace Common.system
10
+{
11
+    /// <summary>
12
+    /// 自启帮助类
13
+    /// </summary>
14
+    public static class AutoStartHelper
15
+    {
16
+        /// <summary>
17
+        /// 开机自启动
18
+        /// </summary>
19
+        /// <param name="strName">需要启动软件的路径</param>
20
+        /// <param name="Message">错误信息</param>
21
+        /// <returns></returns>
22
+        public static bool OpenAutoStart(string strName,out string Message)
23
+        {
24
+
25
+            #region 设置开机自启
26
+            if (!System.IO.File.Exists(strName))//判断要自动运行的应用程序文件是否存在
27
+            {
28
+                Message = "未检测到应用程序启动项。";
29
+                return false;
30
+            }
31
+            string strnewName = strName.Substring(strName.LastIndexOf("\\") + 1);//获取应用程序文件名,不包括路径
32
+            try
33
+            {
34
+                RegistryKey registry = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);//检索指定的子项
35
+                if (registry == null)//若指定的子项不存在
36
+                    registry = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");//则创建指定的子项
37
+                registry.SetValue(strnewName, strName);//设置该子项的新的“键值对”
38
+                Message = "";
39
+                return true;
40
+            }
41
+            catch (Exception ex)
42
+            {
43
+                Message = "设置失败,操作被拒绝:" + ex.Message;
44
+                LogHelper.WriteErrLog(Message, ex);
45
+                return false;
46
+            }
47
+
48
+            //if (MessageBox.Show("设置完毕") == DialogResult.OK)
49
+            //{
50
+            //    RefreshSystem();//刷新系统
51
+            //}
52
+            #endregion
53
+        }
54
+        /// <summary>
55
+        /// 关闭自启
56
+        /// </summary>
57
+        /// <param name="strName">软件名称</param>
58
+        /// <param name="Message">错误消息</param>
59
+        /// <returns></returns>
60
+        public static bool CloseAutoStart(string strName, out string Message)
61
+        {
62
+            #region 取消开机自启
63
+            if (!System.IO.File.Exists(strName))//判断要取消的应用程序文件是否存在
64
+            {
65
+                Message = "未检测到应用程序启动项。";
66
+                return false;
67
+            }
68
+            string strnewName = strName.Substring(strName.LastIndexOf("\\") + 1);///获取应用程序文件名,不包括路径
69
+            try
70
+            {
71
+                RegistryKey registry = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);//读取指定的子项
72
+                if (registry == null)//若指定的子项不存在
73
+                    registry = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");//则创建指定的子项
74
+                registry.DeleteValue(strnewName, false);//删除指定“键名称”的键/值对
75
+                Message = "";
76
+                return true;
77
+            }
78
+            catch (Exception ex)
79
+            {
80
+                Message = "设置失败,操作被拒绝:"+ex.Message;
81
+                LogHelper.WriteErrLog(Message, ex);
82
+                return false;
83
+            }
84
+            //if (MessageBox.Show("设置完毕") == DialogResult.OK)
85
+            //{
86
+            //    RefreshSystem();
87
+            //}
88
+            #endregion
89
+        }
90
+
91
+
92
+        /// <summary>
93
+        /// 开机自启动
94
+        /// </summary>
95
+        /// <param name="strName">程序名称</param>
96
+        /// <param name="Message">错误信息</param>
97
+        /// <returns></returns>
98
+        public static bool OpenAutoStart1(string exeName, out string Message)
99
+        {
100
+
101
+            #region 设置开机自启
102
+            try
103
+            {
104
+                Message = "";
105
+                return true;
106
+            }
107
+            catch (Exception ex)
108
+            {
109
+                Message = "设置失败,操作被拒绝:" + ex.Message;
110
+                LogHelper.WriteErrLog(Message, ex);
111
+                return false;
112
+            }
113
+
114
+            //if (MessageBox.Show("设置完毕") == DialogResult.OK)
115
+            //{
116
+            //    RefreshSystem();//刷新系统
117
+            //}
118
+            #endregion
119
+        }
120
+    }
121
+}

+ 2
- 1
Common/system/FileToolsCommon.cs Datei anzeigen

@@ -347,7 +347,8 @@ namespace Common.system
347 347
         /// <summary>  
348 348
         /// 获取指定目录中所有文件列表  
349 349
         /// </summary>  
350
-        /// <param name="directoryPath">指定目录的绝对路径</param>          
350
+        /// <param name="directoryPath">指定目录的绝对路径</param>     
351
+        /// <param name="files">匹配关键字</param>       
351 352
         public static FileInfo[] GetFileInfos(string directoryPath, string files = null)
352 353
         {
353 354
             //如果目录不存在,则抛出异常  

+ 1
- 1
Common/system/HttpHelper.cs Datei anzeigen

@@ -400,7 +400,7 @@ namespace Common.system
400 400
             for (int i = 0; i < files.Length; i++)
401 401
             {
402 402
                 memStream.Write(boundarybytes, 0, boundarybytes.Length);
403
-                string header = string.Format(headerTemplate, "file", files[i]);
403
+                string header = string.Format(headerTemplate, "fileData", files[i]);
404 404
                 byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
405 405
 
406 406
                 memStream.Write(headerbytes, 0, headerbytes.Length);

+ 200
- 0
XHWK.Model/Model_TmatrixCode.cs Datei anzeigen

@@ -0,0 +1,200 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHWK.Model
8
+{
9
+    #region 铺码模型
10
+    /// <summary>
11
+    /// TQL铺码模型
12
+    /// </summary>
13
+    public class Model_TmatrixCode
14
+    {
15
+        /// <summary>
16
+        /// 返回标志
17
+        /// </summary>
18
+        public string state { get; set; }
19
+        /// <summary>
20
+        /// 返回标志说明
21
+        /// </summary>
22
+        public string message { get; set; }
23
+        /// <summary>
24
+        /// 文件名
25
+        /// </summary>
26
+        public string filename { get; set; }
27
+        /// <summary>
28
+        /// 文件原始宽度
29
+        /// </summary>
30
+        public string width { get; set; }
31
+        /// <summary>
32
+        /// 文件原始高度
33
+        /// </summary>
34
+        public string hight { get; set; }
35
+        /// <summary>
36
+        /// 分配的铺码 ID
37
+        /// </summary>
38
+        public string pageserial { get; set; }
39
+        /// <summary>
40
+        /// 铺码文件使用的 sectionId
41
+        /// </summary>
42
+        public string sectionId { get; set; }
43
+        /// <summary>
44
+        /// 铺码文件使用的 ownerId
45
+        /// </summary>
46
+        public string ownerId { get; set; }
47
+        /// <summary>
48
+        /// 铺码文件使用的 bookId
49
+        /// </summary>
50
+        public string bookId { get; set; }
51
+        /// <summary>
52
+        /// 铺码文件的 page 信息
53
+        /// </summary>
54
+        public List<Model_PageInfoItem> pageInfo { get; set; }
55
+
56
+    }
57
+    /// <summary>
58
+    /// PDF页码对应铺码ID
59
+    /// </summary>
60
+    public class Model_PageInfoItem
61
+    {
62
+        /// <summary>
63
+        /// Pdf 文件页码
64
+        /// </summary>
65
+        public string pagenumber { get; set; }
66
+        /// <summary>
67
+        /// Pdf 文件页码对应使用的铺码pageid
68
+        /// </summary>
69
+        public string pageid { get; set; }
70
+    }
71
+
72
+    #endregion
73
+
74
+    #region 查询进度
75
+    /// <summary>
76
+    /// 进度查询
77
+    /// </summary>
78
+    public class Model_ScheduleQuery
79
+    {
80
+        /// <summary>
81
+        /// 结果
82
+        /// </summary>
83
+        public string state { get; set; }
84
+        /// <summary>
85
+        /// 消息
86
+        /// </summary>
87
+        public string message { get; set; }
88
+        /// <summary>
89
+        /// 进度列表
90
+        /// </summary>
91
+        public List<Model_ScheduleQueryState> list { get; set; }
92
+    }
93
+    /// <summary>
94
+    /// 查询状态
95
+    /// </summary>
96
+    public class Model_ScheduleQueryState
97
+    {
98
+        /// <summary>
99
+        /// 铺码 ID
100
+        /// </summary>
101
+        public string pageserial { get; set; }
102
+        /// <summary>
103
+        /// 返回铺码进度:0-100
104
+        /// </summary>
105
+        public string schedule { get; set; }
106
+        /// <summary>
107
+        /// 状态   0:未铺码 1:正在铺码 2:铺码完成,3:未查到。
108
+        /// </summary>
109
+        public string state { get; set; }
110
+    }
111
+    #endregion
112
+
113
+    #region 历史查询
114
+    /// <summary>
115
+    /// 历史查询模型
116
+    /// </summary>
117
+    public class Model_HistoryQuery
118
+    {
119
+        /// <summary>
120
+        /// 返回标志
121
+        /// </summary>
122
+        public string state { get; set; }
123
+        /// <summary>
124
+        /// 返回标志说明
125
+        /// </summary>
126
+        public string message { get; set; }
127
+        /// <summary>
128
+        /// 历史数据列表数组
129
+        /// </summary>
130
+        public List<Model_HistoryPageList> pageList { get; set; }
131
+    }
132
+    /// <summary>
133
+    /// 历史数据列表
134
+    /// </summary>
135
+    public class Model_HistoryPageList
136
+    {
137
+        /// <summary>
138
+        /// 页码 ID
139
+        /// </summary>
140
+        public string pageIndex { get; set; }
141
+        /// <summary>
142
+        /// 历史数据 pdf 文档详情数组
143
+        /// </summary>
144
+        public List<Model_HistoryListItem> list { get; set; }
145
+    }
146
+    /// <summary>
147
+    /// 历史信息
148
+    /// </summary>
149
+    public class Model_HistoryListItem
150
+    {
151
+        /// <summary>
152
+        /// 铺码 ID
153
+        /// </summary>
154
+        public string pageserial { get; set; }
155
+        /// <summary>
156
+        /// 铺码名称
157
+        /// </summary>
158
+        public string fileName { get; set; }
159
+        /// <summary>
160
+        /// 铺码使用的 sectionId
161
+        /// </summary>
162
+        public string sectionId { get; set; }
163
+        /// <summary>
164
+        /// 铺码使用的 ownerId
165
+        /// </summary>
166
+        public string ownerId { get; set; }
167
+        /// <summary>
168
+        /// 铺码使用的 bookid
169
+        /// </summary>
170
+        public string bookId { get; set; }
171
+        /// <summary>
172
+        /// 铺码使用的开始 pagid
173
+        /// </summary>
174
+        public string beginPagId { get; set; }
175
+        /// <summary>
176
+        /// 铺码使用的结束 pagid
177
+        /// </summary>
178
+        public string endPagId { get; set; }
179
+        /// <summary>
180
+        /// 下载 URL
181
+        /// </summary>
182
+        public string url { get; set; }
183
+    }
184
+    #endregion
185
+    public enum Enum_StatetType
186
+    {
187
+        //1000 操作成功
188
+        //1001 打开数据库失败
189
+        //1002 用户名或密码错误
190
+        //1003 Key 信息错误(过期或已使用完)
191
+        //1004 上传 Pdf 文档无法打开
192
+        //1005 铺码初始化失败
193
+        //1006 铺码错误
194
+        //1007 Json 数据错误
195
+        //1008 接口错误
196
+        //1009 UserID 错误
197
+        //1010 未查到该历史数据
198
+
199
+    }
200
+}

+ 1
- 0
XHWK.Model/XHWK.Model.csproj Datei anzeigen

@@ -60,6 +60,7 @@
60 60
     <Compile Include="Model_ResourceAdd.cs" />
61 61
     <Compile Include="Model_Screenshot.cs" />
62 62
     <Compile Include="Model_Signatures.cs" />
63
+    <Compile Include="Model_TmatrixCode.cs" />
63 64
     <Compile Include="Model_TsubjectbookList.cs" />
64 65
     <Compile Include="Model_UserInfo.cs" />
65 66
     <Compile Include="Model_Video.cs" />

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

@@ -7,9 +7,9 @@
7 7
     <!--0正式 1测试-->
8 8
     <add key="IsDebug" value="1" />
9 9
     <!--是否输出视频记录日志:0否-->
10
-    <add key="OutputVideoLog" value="0"/>
10
+    <add key="OutputVideoLog" value="0" />
11 11
     <!--是否输出其他测试日志-->
12
-    <add key="IsOutputInfoLog" value="1"/>
12
+    <add key="IsOutputInfoLog" value="1" />
13 13
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
14 14
     <add key="VideoSavePath" value="D:\星火微课" />
15 15
     <!--视频格式 1、MP4 2、FlV 3、AVI-->
@@ -30,6 +30,8 @@
30 30
     <add key="SchoolfileRequestAddress" value="http://schoolfile.xhkjedu.com" />
31 31
     <!--认证请求地址-->
32 32
     <add key="CertapiRequestAddress" value="http://certapi.xhkjedu.com" />
33
+    <!--TQL铺码API-->
34
+    <add key="TmatrixCode" value="http://111.231.240.239:8030" />
33 35
     <!--摄像头位置 1.右上 2.左上 3.右下 4.左下-->
34 36
     <add key="CameraPosition" value="1" />
35 37
     <!--上传每片大小 Mb-->
@@ -37,8 +39,8 @@
37 39
     <!--是否隐藏录屏工具栏 1 隐藏 0不隐藏-->
38 40
     <add key="IsHideSRTool" value="1" />
39 41
     <!--版本号-->
40
-    <add key="VersionCode" value="58" />
41
-    <add key="VersionName" value="2.5.8" />
42
+    <add key="VersionCode" value="59" />
43
+    <add key="VersionName" value="2.5.9" />
42 44
     <add key="ClientSettingsProvider.ServiceUri" value="" />
43 45
   </appSettings>
44 46
   <system.web>
@@ -53,4 +55,12 @@
53 55
       </providers>
54 56
     </roleManager>
55 57
   </system.web>
58
+  <runtime>
59
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
60
+      <dependentAssembly>
61
+        <assemblyIdentity name="itextsharp" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
62
+        <bindingRedirect oldVersion="0.0.0.0-5.5.13.2" newVersion="5.5.13.2" />
63
+      </dependentAssembly>
64
+    </assemblyBinding>
65
+  </runtime>
56 66
 </configuration>

+ 23
- 0
XHWK.WKTool/App.cs Datei anzeigen

@@ -15,6 +15,7 @@ using System.Windows.Threading;
15 15
 using TStudyDigitalPen.HID;
16 16
 
17 17
 using XHWK.Model;
18
+using XHWK.WKTool.DAL;
18 19
 using XHWK.WKTool.Helpers;
19 20
 
20 21
 namespace XHWK.WKTool
@@ -51,6 +52,10 @@ namespace XHWK.WKTool
51 52
         /// </summary>
52 53
         public static string certapiUrl = isDebug ? "http://certapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("CertapiRequestAddress");
53 54
         /// <summary>
55
+        /// TQL铺码服务地址
56
+        /// </summary>
57
+        public static string TmatrixCodeURL= FileToolsCommon.GetConfigValue("TmatrixCode");
58
+        /// <summary>
54 59
         /// 数据存放目录
55 60
         /// </summary>
56 61
         public static string dataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\XHMicroLesson\\";
@@ -154,6 +159,10 @@ namespace XHWK.WKTool
154 159
         #endregion
155 160
         #region 腾千里手写笔
156 161
         /// <summary>
162
+        /// 铺码服务请求
163
+        /// </summary>
164
+        public static DAL_TmatrixCode dAL_TmatrixCode;
165
+        /// <summary>
157 166
         /// 腾千里手写笔事件
158 167
         /// </summary>
159 168
         public static PenEvents TQLPenevents;
@@ -161,6 +170,20 @@ namespace XHWK.WKTool
161 170
         /// 腾千里手写笔是否已连接
162 171
         /// </summary>
163 172
         public static bool TQLPenStatus = false;
173
+
174
+        #region 打印
175
+        public static bool gbGenerateBGWithVImage = false;
176
+        public static bool gbGenerateVImage = false;
177
+        public static bool gbGenerateBGWithoutVImage = false;
178
+        public static bool gbGenerateBGWithImage = false;
179
+        public static bool gbGenPageSet = false;
180
+        public static int[] gPointType = new int[4];
181
+        public static int[] gPointDPI = new int[4];
182
+        public static string gTMXElementFileName;
183
+        public static string gNewProjectDirectory;
184
+        public static bool gbElementFileExist { get; set; }
185
+        #endregion
186
+
164 187
         #endregion
165 188
         #region 页面
166 189
         /// <summary>

+ 278
- 0
XHWK.WKTool/DAL/DAL_TmatrixCode.cs Datei anzeigen

@@ -0,0 +1,278 @@
1
+using Common.system;
2
+
3
+using Newtonsoft.Json.Linq;
4
+
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Collections.Specialized;
8
+using System.Linq;
9
+using System.Text;
10
+using System.Threading;
11
+using System.Threading.Tasks;
12
+
13
+using XHWK.Model;
14
+
15
+namespace XHWK.WKTool.DAL
16
+{
17
+   /// <summary>
18
+   /// TQL在线铺码服务-改为SDK  暂无用
19
+   /// </summary>
20
+    public class DAL_TmatrixCode
21
+    {
22
+        /// <summary>
23
+        /// TQL铺码地址
24
+        /// </summary>
25
+        private string TmatrixCodeURL = APP.TmatrixCodeURL;
26
+        /// <summary>
27
+        /// TQL用户名
28
+        /// </summary>
29
+        string TQLUserName = "test122";
30
+        /// <summary>
31
+        /// TQL密码
32
+        /// </summary>
33
+        string TQLPassword = "123456";
34
+        /// <summary>
35
+        /// 用户登陆后的用户ID
36
+        /// </summary>
37
+        string UserID;
38
+        /// <summary>
39
+        /// 分配的铺码 ID
40
+        /// </summary>
41
+        string pageserial;
42
+        //1000 操作成功
43
+        //1001 打开数据库失败
44
+        //1002 用户名或密码错误
45
+        //1003 Key 信息错误(过期或已使用完)
46
+        //1004 上传 Pdf 文档无法打开
47
+        //1005 铺码初始化失败
48
+        //1006 铺码错误
49
+        //1007 Json 数据错误
50
+        //1008 接口错误
51
+        //1009 UserID 错误
52
+        //1010 未查到该历史数据
53
+        /// <summary>
54
+        /// TQL登陆
55
+        /// </summary>
56
+        /// <param name="Message"></param>
57
+        /// <returns></returns>
58
+        public bool TQLUserLogin( out string Message)
59
+        {
60
+            Exception ex = null;
61
+            Message = "";//请求重试5次 共5秒
62
+            for (int num = 0; num < 5; num++)
63
+            {
64
+                try
65
+                {
66
+                    JObject jo = HttpHelper.PostFunction(TmatrixCodeURL + @"/TmatrixCode/User/UserLogin", @"application/x-www-form-urlencoded", @"userName=" + TQLUserName+ "&password=" + TQLPassword, "");
67
+                    if (jo == null)
68
+                    {
69
+                        Message = "无法访问铺码服务器,请检查网络或铺码服务器地址。";
70
+                        return false;
71
+                    }
72
+                    //"state":"1000",
73
+                    //"message":"File upload was succeed!",
74
+                    //" userID ":"1"
75
+                    //1000 操作成功
76
+                    if (jo["state"].ToString() == "1000")
77
+                    {
78
+                        Message = "";
79
+                        //登陆成功后用户ID
80
+                        UserID = jo["userID"].ToString();
81
+                        return true;
82
+                    }
83
+                    else
84
+                    {
85
+                        Message = jo["message"].ToString();
86
+                        return false;
87
+                    }
88
+                }
89
+                catch (Exception e)
90
+                {
91
+                    Message = "无法访问铺码服务器:" + e.Message;
92
+                    ex = e;
93
+                    Thread.Sleep(1000);
94
+                }
95
+            }
96
+            string ErrMessage = "【TQL登陆】(TQLUserLogin):请求失败。" + Message;
97
+            LogHelper.WriteErrLog(ErrMessage, ex);
98
+            return false;
99
+        }
100
+
101
+        /// <summary>
102
+        /// TQL上传文件
103
+        /// </summary>
104
+        /// <param name="filePath">文件路径</param>
105
+        /// <param name="fileName">文件名</param>
106
+        /// <param name="Message"></param>
107
+        /// <returns></returns>
108
+        public bool TQLStartTmatrix(string filePath,string fileName,out string Message)
109
+        {
110
+            Exception ex = null;
111
+            Message = "";//请求重试5次 共5秒
112
+            if(string.IsNullOrWhiteSpace(UserID))
113
+            {
114
+                if(!TQLUserLogin(out Message))
115
+                {
116
+                    return false;
117
+                }
118
+            }
119
+            for (int num = 0; num < 5; num++)
120
+            {
121
+                try
122
+                {
123
+                    //byte[] byteArray = FileToolsCommon.ReadBigFileSpecifyLength(VideoInfo.VideoPath, len, (int)VideoInfo.SliceLen);
124
+                    //userID Y 字符 登录之后分配的 ID
125
+                    //callBack Y 回调 API 该 API 由应用方提供,为 post 请求
126
+                    //createimage Y 字符 是否生成 png 图片(若生 成则会进行文件打包成 zip)0,不生成,1 生 成。
127
+                    //fileName Y 字符 文件名称数组
128
+                    //tmatrixType Y 字符 铺码类型(0.600DPI 打 印、1.1200DPI 打印、 2.印刷
129
+                    //fileData
130
+                    //参数
131
+                    NameValueCollection formFields = new NameValueCollection
132
+                            {
133
+                                { "userID", UserID },
134
+                                { "callBack", ""},
135
+                                { "createimage", "0" },
136
+                                { "fileName", fileName },
137
+                                { "tmatrixType", "1" }
138
+                            };
139
+                    string[] PathList = new string[] { filePath };
140
+                    JObject jo = HttpHelper.UploadFilesToRemoteUrl(TmatrixCodeURL + @"/TmatrixCode/User/startTmatrix", PathList, "", formFields);
141
+                    if (jo == null)
142
+                    {
143
+                        Message = "无法访问铺码服务器,请检查网络或铺码服务器地址。";
144
+                        return false;
145
+                    }
146
+                    Model_TmatrixCode resultObj = JsonHelper.JsonToObj<Model_TmatrixCode>(jo.ToString());
147
+                    
148
+                    //1000 操作成功
149
+                    if (resultObj.state == "1000")
150
+                    {
151
+                        Message = "";
152
+                        pageserial = resultObj.pageserial;
153
+                        return true;
154
+                    }
155
+                    else
156
+                    {
157
+                        Message = resultObj.message;
158
+                        return false;
159
+                    }
160
+                }
161
+                catch (Exception e)
162
+                {
163
+                    Message = "无法访问铺码服务器:" + e.Message;
164
+                    ex = e;
165
+                    Thread.Sleep(1000);
166
+                }
167
+            }
168
+            string ErrMessage = "【TQL上传】(TQLStartTmatrix):请求失败。" + Message;
169
+            LogHelper.WriteErrLog(ErrMessage, ex);
170
+            return false;
171
+        }
172
+
173
+        /// <summary>
174
+        /// 查询进度
175
+        /// </summary>
176
+        /// <param name="Message"></param>
177
+        /// <returns>-1失败 0:未铺码 1:正在铺码 2:铺码完成,3:未查到。</returns>
178
+        public int TQLSchedulequery(out string Message)
179
+        {
180
+            Exception ex = null;
181
+            Message = "";//请求重试5次 共5秒
182
+            for (int num = 0; num < 5; num++)
183
+            {
184
+                try
185
+                {
186
+                    string[] pageserialList = new string[] { pageserial };
187
+                    JObject jo = HttpHelper.PostFunction(TmatrixCodeURL + @"/TmatrixCode/User/schedulequery", @"application/x-www-form-urlencoded", @"userID=" + UserID + "&pageserialList=" + pageserialList, "");
188
+                    if (jo == null)
189
+                    {
190
+                        Message = "无法访问铺码服务器,请检查网络或铺码服务器地址。";
191
+                        return -1;
192
+                    }
193
+                    Model_ScheduleQuery resultObj = JsonHelper.JsonToObj<Model_ScheduleQuery>(jo.ToString());
194
+                    
195
+                    //1000 操作成功
196
+                    if (resultObj.state == "1000")
197
+                    {
198
+                        //state Y 字符 返回标志
199
+                        //message Y 字符 返回标志说明
200
+                        //list Y 字符 进度数组
201
+                        //schedule Y 字符 返回铺码进度:0 - 100
202
+                        //pageserial 铺码 ID 字符 铺码 ID
203
+                        //state Y 数字 0:未铺码 1:正在铺码 2:铺码完成,3:未查到。
204
+                        Message = "";
205
+                        return int.Parse(resultObj.list.Find(x => x.pageserial == pageserial).state);
206
+                    }
207
+                    else
208
+                    {
209
+                        Message = resultObj.message;
210
+                        return -1;
211
+                    }
212
+                }
213
+                catch (Exception e)
214
+                {
215
+                    Message = "无法访问铺码服务器:" + e.Message;
216
+                    ex = e;
217
+                    Thread.Sleep(1000);
218
+                }
219
+            }
220
+            string ErrMessage = "【TQL查询进度】(TQLSchedulequery):请求失败。" + Message;
221
+            LogHelper.WriteErrLog(ErrMessage, ex);
222
+            return -1;
223
+        }
224
+
225
+        /// <summary>
226
+        /// TQL历史查询
227
+        /// </summary>
228
+        /// <param name="Message"></param>
229
+        /// <returns></returns>
230
+        public string TQLHistoryQuery(string fileName,string startPage,string maxPage,out string Message)
231
+        {
232
+            Exception ex = null;
233
+            Message = "";//请求重试5次 共5秒
234
+            for (int num = 0; num < 5; num++)
235
+            {
236
+                try
237
+                {
238
+                    //userID Y 字符 登录之后分配的 ID
239
+                    //fileName N 字符 查询文件名称
240
+                    //pageserial N 字符 铺码 ID(铺码 ID 或文件名必须设置一个)
241
+                    //startPage Y int 开始查询页码,从 1 开 始
242
+                    //maxPage Y int 最大页码数
243
+                    JObject jo = HttpHelper.PostFunction(TmatrixCodeURL + @"/TmatrixCode/User/HistoryQuery", @"application/x-www-form-urlencoded", @"userID=" + UserID + "&fileName=" + fileName + "&pageserial=" + pageserial + "&startPage=" + startPage + "&maxPage=" + maxPage, "");
244
+                    if (jo == null)
245
+                    {
246
+                        Message = "无法访问铺码服务器,请检查网络或铺码服务器地址。";
247
+                        return "";
248
+                    }
249
+
250
+                    Model_HistoryQuery resultObj = JsonHelper.JsonToObj<Model_HistoryQuery>(jo.ToString());
251
+                    //1000 操作成功
252
+                    if (resultObj.state == "1000")
253
+                    {
254
+                        Message = "";
255
+                        Model_HistoryPageList model_HistoryPageList = resultObj.pageList[0];
256
+                        Model_HistoryListItem model_HistoryListItem = model_HistoryPageList.list.Find(x => x.pageserial == pageserial);
257
+                        
258
+                        return model_HistoryListItem.url;
259
+                    }
260
+                    else
261
+                    {
262
+                        Message = resultObj.message;
263
+                        return "";
264
+                    }
265
+                }
266
+                catch (Exception e)
267
+                {
268
+                    Message = "无法访问铺码服务器:" + e.Message;
269
+                    ex = e;
270
+                    Thread.Sleep(1000);
271
+                }
272
+            }
273
+            string ErrMessage = "【TQL查询历史记录】(TQLHistoryQuery):请求失败。" + Message;
274
+            LogHelper.WriteErrLog(ErrMessage, ex);
275
+            return "";
276
+        }
277
+    }
278
+}

+ 1
- 0
XHWK.WKTool/LatticeXML/S0_O000_B0000_P000-255.tmx Datei anzeigen

@@ -0,0 +1 @@
1
+S0,O000,B0000,P000-255,D2021/6/30;CC8FB26BWW8K0LR0COOSWE4KSOKA4K4VQ

+ 1
- 1
XHWK.WKTool/MessageWindow.xaml.cs Datei anzeigen

@@ -4,7 +4,7 @@ using System.Windows.Input;
4 4
 namespace XHWK.WKTool
5 5
 {
6 6
     /// <summary>
7
-    /// MessageWindow.xaml 的交互逻辑
7
+    /// 消息提示框 .show()
8 8
     /// </summary>
9 9
     public partial class MessageWindow : Window
10 10
     {

+ 28
- 5
XHWK.WKTool/PrintWindow.xaml Datei anzeigen

@@ -5,10 +5,10 @@
5 5
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 6
         xmlns:local="clr-namespace:XHWK.WKTool" xmlns:Views="clr-namespace:XHWK.WKTool.Helpers"
7 7
         mc:Ignorable="d"
8
-        Title="PrintWindow" Height="600" Width="900" AllowsTransparency="True"
8
+        Title="PrintWindow" AllowsTransparency="True"
9 9
     ShowInTaskbar="False"
10 10
     WindowStartupLocation="CenterOwner"
11
-    WindowStyle="None"  BorderThickness="7">
11
+    WindowStyle="None"  BorderThickness="7" Width="914" Height="614">
12 12
     <Window.Effect>
13 13
         <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
14 14
     </Window.Effect>
@@ -30,8 +30,9 @@
30 30
             </Setter>
31 31
         </Style>
32 32
     </Window.Resources>
33
+
33 34
     <Viewbox>
34
-        <Grid x:Name="GridContent" Height="600" Width="900">
35
+        <Grid x:Name="GridContent" Width="900" Height="600">
35 36
             <Grid.RowDefinitions>
36 37
                 <RowDefinition Height="120"/>
37 38
                 <RowDefinition Height="*"/>
@@ -57,7 +58,7 @@
57 58
                                 FontSize="14"
58 59
                                 SelectedValuePath="Key"
59 60
                                 />
60
-                    <TextBlock Text="份数:" FontSize="20" Margin="80,0,0,0" Padding="0,5,0,0" HorizontalAlignment="Right"/>
61
+                    <TextBlock Text="份数:" FontSize="20" Margin="50,0,0,0" Padding="0,5,0,0" HorizontalAlignment="Right"/>
61 62
                     <TextBlock x:Name="txbNumberOfCopies" Width="100" Text="1" FontSize="16" Padding="50,10,0,0" Background="White"/>
62 63
                     <Grid>
63 64
                         <Grid.RowDefinitions>
@@ -67,10 +68,32 @@
67 68
                         <Button Cursor="Hand" Grid.Row="0" x:Name="btnAdd"  Content="+" Click="BtnAdd_Click"/>
68 69
                         <Button Cursor="Hand" Grid.Row="1" x:Name="btnLess"  Content="-" Click="BtnLess_Click"/>
69 70
                     </Grid>
71
+
72
+                    <TextBlock  Text="DPI:"  FontSize="20" Padding="50,5,0,0"/>
73
+                    <ComboBox Cursor="Hand" Width="210"
74
+                                x:Name="CbxDpi"
75
+                                Padding="30,0,10,0"
76
+                                VerticalContentAlignment="Center"
77
+                                BorderThickness="0"
78
+                                DisplayMemberPath="Value"
79
+                                FontSize="14"
80
+                                SelectedValuePath="Key"
81
+                                />
70 82
                     <!--<TextBlock Text="点型:" FontSize="20"  Margin="120,10,0,0"/>
71 83
                 <RadioButton x:Name="rbnSquarePoint" Content="方点" FontSize="16"  Margin="0,15,0,0" IsChecked="True"/>
72 84
                 <RadioButton x:Name="rbnDots" Content="圆点" FontSize="16"  Margin="0,15,0,0"/>-->
73 85
                 </StackPanel>
86
+                <TextBlock  Text="类型:"  FontSize="20" Padding="50,5,0,0" Margin="523,0,273,10" Visibility="Hidden" />
87
+                <ComboBox Cursor="Hand"
88
+                    x:Name="CbxType"
89
+                    Padding="30,0,10,0"
90
+                    VerticalContentAlignment="Center"
91
+                    BorderThickness="0"
92
+                    DisplayMemberPath="Value"
93
+                    FontSize="14"
94
+                    SelectedValuePath="Key"
95
+                                Margin="626,0,64,10" Visibility="Hidden"
96
+                                />
74 97
             </Grid>
75 98
 
76 99
             <Views:ZJClippingBorder Grid.Row="0" x:Name="tip_outer" Margin="0" Background="#FFE6EAF0" CornerRadius="4" Visibility="Collapsed">
@@ -100,7 +123,7 @@
100 123
 
101 124
             <Button
102 125
                     x:Name="btnPrint"
103
-                    Grid.Row="8"
126
+                    Grid.Row="2"
104 127
                     Width="115"
105 128
                     Height="46"
106 129
                     Click="BtnPrint_Click"

+ 330
- 161
XHWK.WKTool/PrintWindow.xaml.cs Datei anzeigen

@@ -1,16 +1,23 @@
1 1
 using Common.system;
2 2
 
3
+using Spire.Pdf;
4
+
3 5
 using System;
4 6
 using System.Collections.Generic;
5 7
 using System.Data;
8
+using System.Diagnostics;
6 9
 using System.Drawing;
10
+using System.Drawing.Printing;
7 11
 using System.IO;
8 12
 using System.Threading;
9 13
 using System.Windows;
14
+using System.Windows.Controls;
10 15
 using System.Windows.Input;
11 16
 using System.Windows.Media.Imaging;
12 17
 using System.Windows.Threading;
13 18
 
19
+using TmatrixLibrary;
20
+
14 21
 namespace XHWK.WKTool
15 22
 {
16 23
     /// <summary>
@@ -55,6 +62,19 @@ namespace XHWK.WKTool
55 62
                 cmbClass.ItemsSource = dtComponentsUniqueNo.DefaultView;
56 63
                 cmbClass.SelectedIndex = 0;
57 64
             }
65
+
66
+            Dictionary<int, int> dicItem = new Dictionary<int, int>();
67
+            dicItem.Add(0, 600);
68
+            dicItem.Add(1, 1200);
69
+            CbxDpi.ItemsSource = dicItem;
70
+            CbxDpi.SelectedIndex = 0;
71
+
72
+            Dictionary<int, string> dictypeItem = new Dictionary<int, string>();
73
+            dictypeItem.Add(0, "2x2");
74
+            dictypeItem.Add(1, "3x3");
75
+            dictypeItem.Add(2, "4x4");
76
+            CbxType.ItemsSource = dictypeItem;
77
+            CbxType.SelectedIndex = 0;
58 78
         }
59 79
 
60 80
         private double wit = 0;
@@ -73,7 +93,171 @@ namespace XHWK.WKTool
73 93
             }
74 94
             I = 0;
75 95
             tip_outer.Visibility = Visibility.Collapsed;
96
+            TQLInit();
76 97
         }
98
+
99
+        #region TQL打印
100
+        /// <summary>
101
+        /// 授权文件位置
102
+        /// </summary>
103
+        string TQLAuthorizationPath;
104
+        /// <summary>
105
+        /// 授权码
106
+        /// </summary>
107
+        string gKeyStr;
108
+        TmatrixClass TMC = new TmatrixClass();
109
+        public static string gPrintFileName;
110
+        //string gDirectory = Application.StartupPath;
111
+        //string gFileName = "";
112
+        bool gbInitDone = false;
113
+        //string gUserName = "";
114
+        //string gPassword = "";
115
+        private string gEKeyStr;
116
+
117
+
118
+        iTextSharp.text.Document document;
119
+
120
+        enum TMATRIX_POINT_TYPE
121
+        {
122
+            TmatrixPointType_2x2 = 0,	// 2x2 Point Type
123
+            TmatrixPointType_3x3 = 1,	// 3x3 Point Type
124
+        };
125
+        enum TMATRIX_OBJECT_TYPE
126
+        {
127
+            TMATRIX_OT_ElementCode = 0,	// 此类型对象的Index范围是:75497472~83886079(十六进制为:0x04800000~0x04ffffff)
128
+            TMATRIX_OT_PositionCode,		// 此类型对象没有Index
129
+        };
130
+        /// <summary>
131
+        /// 初始化打印
132
+        /// </summary>
133
+        void TQLInit()
134
+        {
135
+            ///初始化
136
+            if (TMC.TmatrixInitialize() == false)
137
+            {
138
+                //MessageBox.Show(this, "点阵码初始化失败!", "生成点阵码", MessageBoxButtons.OK, MessageBoxIcon.Error);
139
+                //Close();
140
+            }
141
+            else
142
+            {
143
+                gbInitDone = true;
144
+            }
145
+            document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
146
+            try
147
+            {
148
+                TQLAuthorizationPath = FileToolsCommon.GetFileAbsolutePath("/LatticeXML/S0_O000_B0000_P000-255.tmx");
149
+
150
+                StreamReader gsr = new StreamReader(TQLAuthorizationPath);
151
+                gKeyStr = gsr.ReadLine();
152
+                gsr.Close();
153
+                string KeyCheckResult = TMC.TmatrixKeyCheck_OID4(gKeyStr);
154
+
155
+                if (KeyCheckResult.Substring(0, 1) == "1")
156
+                {
157
+                    MessageWindow.Show("打印服务授权过期,请联系厂家更换授权!");
158
+                    LogHelper.WriteErrLog("打印服务授权过期:" + KeyCheckResult, null);
159
+                    gbInitDone = false;
160
+                }
161
+                else if (KeyCheckResult.Substring(0, 1) == "0")
162
+                {
163
+                }
164
+            }
165
+            catch (Exception ex)
166
+            {
167
+                LogHelper.WriteErrLog("打印服务授权失败:" + ex.Message, ex);
168
+                MessageWindow.Show("打印服务授权失败,请联系厂家!");
169
+                gbInitDone = false;
170
+            }
171
+        }
172
+
173
+        /// <summary>
174
+        /// 铺码
175
+        /// </summary>
176
+        private bool GenerateCode(string PDFPath)
177
+        {
178
+            try
179
+            {
180
+                if (gbInitDone == false)
181
+                {
182
+                    MessageWindow.Show("打印功能无法使用,无效授权。");
183
+                    return false;
184
+                }
185
+                try
186
+                {
187
+                    string directoryPath = FileToolsCommon.GetDirectoryName(PDFPath);
188
+                    FileToolsCommon.DeleteDirectory(directoryPath + "Bg with Images/");
189
+                    FileToolsCommon.DeleteDirectory(directoryPath + "Bg with Vector Images/");
190
+                    FileToolsCommon.DeleteDirectory(directoryPath + "Bg without Vector Images/");
191
+                    FileToolsCommon.DeleteDirectory(directoryPath + "Vector Images/");
192
+                }
193
+                catch (Exception)
194
+                {
195
+                }
196
+                int i;
197
+                for (i = 0; i < 4; i++)
198
+                {
199
+                    int DPIValue = 0;
200
+                    int TypeValue = 0;
201
+                    try
202
+                    {
203
+                        DPIValue = CbxDpi.SelectedIndex;
204
+                        //TypeValue = CbxType.SelectedIndex;
205
+
206
+                    }
207
+                    catch (Exception)
208
+                    {
209
+                    }
210
+                    APP.gPointType[i] = TypeValue;
211
+                    APP.gPointDPI[i] = DPIValue;
212
+                }
213
+
214
+                APP.gbGenerateBGWithVImage = false;
215
+                APP.gbGenerateVImage = false;
216
+                APP.gbGenerateBGWithoutVImage = false;
217
+                APP.gbGenerateBGWithImage = true;
218
+
219
+                //初始页
220
+                int SPID = 0;
221
+                //int PointType = (int)(TMATRIX_POINT_TYPE.TmatrixPointType_3x3);
222
+                //string sGenerateResult = TMC.GenerateTmatrixCode(gKeyStr, PDFFileName, SPID, PointType, GlobalClass.gbGenerateBGWithVImage, GlobalClass.gbGenerateVImage, GlobalClass.gbGenerateBGWithoutVImage, GlobalClass.gbGenerateBGWithImage);
223
+                bool[] bPublishImageType = new bool[4];
224
+                bPublishImageType[0] = APP.gbGenerateBGWithVImage;
225
+                bPublishImageType[1] = APP.gbGenerateVImage;
226
+                bPublishImageType[2] = APP.gbGenerateBGWithoutVImage;
227
+                bPublishImageType[3] = APP.gbGenerateBGWithImage;
228
+                PDFPath = PDFPath.Replace("/", "\\");
229
+                string sGenerateResult = TMC.GenerateTmatrixCode_OID4(gKeyStr, PDFPath, SPID, APP.gPointType, bPublishImageType, APP.gPointDPI);
230
+                if (sGenerateResult.Substring(0, 1) == "1")
231
+                {
232
+                    Dispatcher.Invoke(() =>
233
+                    {
234
+                        MessageWindow.Show("打印功能无法使用,无效授权。");
235
+                    });
236
+
237
+                    return false;
238
+                }
239
+                else if (sGenerateResult.Substring(0, 1) == "0")
240
+                {
241
+                    //生成成功
242
+                    //打印
243
+                    //Dispatcher.Invoke(() =>
244
+                    //{
245
+                    //});
246
+                }
247
+                return true;
248
+
249
+            }
250
+            catch (Exception ex)
251
+            {
252
+                Dispatcher.Invoke(() =>
253
+                {
254
+                    MessageWindow.Show("打印失败:" + ex.Message);
255
+                });
256
+                return false;
257
+            }
258
+        }
259
+        #endregion
260
+
77 261
         /// <summary>
78 262
         /// 打印
79 263
         /// </summary>
@@ -83,23 +267,14 @@ namespace XHWK.WKTool
83 267
         {
84 268
             if (string.IsNullOrWhiteSpace(cmbClass.Text))
85 269
             {
86
-                //MessageWindow.Show("打印机不能为空!");
87 270
                 MessageWindow.Show("请设置打印机!");
88 271
                 return;
89 272
             }
90
-            //APP.myloading.Show();
91 273
             btnClose.IsEnabled = false;
92 274
             btnPrint.IsEnabled = false;
93
-            //APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeServering, InvokeServerCompate);
94 275
             Thread myThread = new Thread(StartPrint);
95 276
             List<string> StrList = new List<string>();
96 277
 
97
-            //string imgPath = 
98
-            //FileToolsCommon.CreateFile(imgPath);
99
-            //string pdf = imgPath + "\\101.pdf";
100
-            //PDF位置
101
-            //string SourcePath = FileToolsCommon.GetFileAbsolutePath("/temp/101.pdf");
102
-            //StrList.Add(SourcePath);
103 278
             int ipdf = 102;
104 279
             string imgPath = FileToolsCommon.GetFileAbsolutePath("temp/");
105 280
             string tempImgPath = imgPath;
@@ -154,17 +329,40 @@ namespace XHWK.WKTool
154 329
         /// </summary>
155 330
         private void StartPrint(object obj)
156 331
         {
157
-
158 332
             try
159 333
             {
160
-                iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
334
+                document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0f, 0f, 0f, 0f);
335
+
161 336
                 //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
162 337
                 ////设置纸张横向
163 338
                 //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
164 339
 
165 340
                 List<string> objStr1 = (List<string>)obj;
166 341
                 string SourcePath1 = objStr1[0];
167
-                iTextSharp.text.pdf.PdfWriter.GetInstance(document, new FileStream(SourcePath1, FileMode.Create, FileAccess.ReadWrite));
342
+                try
343
+                {
344
+                    SourcePath1 = SourcePath1.Replace("/", "\\");
345
+                    FileStream fs = new FileStream(SourcePath1, FileMode.Create, FileAccess.ReadWrite);
346
+                    document.AddAuthor("星火微课");//作者
347
+                    document.AddCreationDate();//创建时候
348
+                    document.AddCreator("星火微课");//创建者
349
+                    document.AddSubject("点阵文件");//主题
350
+                    document.AddTitle("PrintTmatrixCode");//标题
351
+                    document.AddKeywords("Print");
352
+
353
+                    document.AddHeader("TmatrixCode", "0");
354
+                    Thread.Sleep(300);
355
+                    //iTextSharp.text.pdf.PdfDocument pdfDocument = new iTextSharp.text.pdf.PdfDocument();
356
+                    //document.AddDocListener(pdfDocument);
357
+                    //iTextSharp.text.pdf.PdfWriter pdfWriter = new iTextSharp.text.pdf.PdfWriter(pdfDocument, fs);
358
+                    //pdfDocument.AddWriter(pdfWriter);
359
+
360
+                    iTextSharp.text.pdf.PdfWriter.GetInstance(document, fs);
361
+                }
362
+                catch (Exception)
363
+                {
364
+
365
+                }
168 366
                 document.Open();
169 367
                 iTextSharp.text.Image image;
170 368
                 for (int i = 0; i < APP.PageDrawList.Count; i++)
@@ -196,12 +394,8 @@ namespace XHWK.WKTool
196 394
                                 Y = (float)APP.PageDrawList[i].ImageLocation.Y
197 395
                             };
198 396
                         });
199
-
200
-
201
-
202 397
                         string msgs = string.Empty;
203 398
 
204
-
205 399
                         bool isImg = MergerImg(APP.PageDrawList[i].PageImagePath, filePathOutPut, rectangleF, out msgs);
206 400
                         if (isImg)
207 401
                         {
@@ -230,7 +424,7 @@ namespace XHWK.WKTool
230 424
                     //p1.Leading = 150;      //行间距
231 425
                     //document.Add(p1);
232 426
                 }
233
-                Console.WriteLine("转换成功!");
427
+                //Console.WriteLine("转换成功!");
234 428
                 document.Close();
235 429
             }
236 430
             catch (Exception ex)
@@ -250,28 +444,38 @@ namespace XHWK.WKTool
250 444
 
251 445
 
252 446
             List<string> objStr = (List<string>)obj;
447
+            //PDF位置
253 448
             string SourcePath = objStr[0];
254 449
             int PrinterNum = int.Parse(objStr[1]);
255 450
             string PrinterName = objStr[2];
256
-            //TPF文件位置
257
-            string TPFPath = FileToolsCommon.GetFileAbsolutePath("temp/");
258
-            FileToolsCommon.CreateDirectory(TPFPath);
259
-            TPFPath += "101.TPF";
260
-            //生成点阵文件
261
-            LatticeFileHelper.GeneratingPDF(SourcePath, TPFPath, out int pr, out string msg, out string outPut/*, pyte*/);
262
-            while (!FileToolsCommon.IsExistFile(TPFPath))
263
-            {
264
-                Thread.Sleep(100);
265
-            }
266
-            while (string.IsNullOrWhiteSpace(pr.ToString()))
267
-            {
268
-                Thread.Sleep(100);
269
-            }
270
-            Thread.Sleep(1000);
271
-            //打印
272
-            LatticeFileHelper.PrinterTPFFile(TPFPath, PrinterNum, PrinterName, out int printResult, out string standardError, out string standardOutput);
273
-            if (printResult == 0)
451
+
452
+            Thread.Sleep(500);
453
+            //腾千里生成点阵文件
454
+            if (GenerateCode(SourcePath))
274 455
             {
456
+                //打印机名称
457
+                string directoryPath = FileToolsCommon.GetDirectoryName(SourcePath) + "Bg with Images/";
458
+                string[] strs = FileToolsCommon.GetFileNames(directoryPath);
459
+
460
+                try
461
+                {
462
+                    foreach (string fileName in strs)
463
+                    {
464
+                        Print(fileName, PrinterName, (short)PrinterNum);
465
+                    }
466
+                }
467
+                catch (Exception ex)
468
+                {
469
+                    Dispatcher.Invoke(() =>
470
+                    {
471
+                        MessageWindow.Show("打印失败:"+ex.Message);
472
+                        btnClose.IsEnabled = true;
473
+                        btnPrint.IsEnabled = true;
474
+                        times.Stop();
475
+                        tip_outer.Visibility = Visibility.Collapsed;
476
+                        return;
477
+                    });
478
+                }
275 479
                 Dispatcher.Invoke(() =>
276 480
                 {
277 481
                     btnClose.IsEnabled = true;
@@ -280,8 +484,20 @@ namespace XHWK.WKTool
280 484
                     times.Stop();
281 485
                     pgbProcess.Value = 100;
282 486
                     lbProcess.Content = "100%";
283
-                    MessageWindow.Show("打印成功!");
284 487
                     tip_outer.Visibility = Visibility.Collapsed;
488
+                    MessageWindow.Show("已加入打印机队列,打印中。");
489
+
490
+
491
+                    ////打印机名称
492
+                    //string directoryPath = FileToolsCommon.GetDirectoryName(SourcePath) + "Bg with Images/";
493
+                    //string[] strs = FileToolsCommon.GetFileNames(directoryPath);
494
+                    //foreach (string fileName in strs)
495
+                    //{
496
+                    //    pdfPrint(directoryPath, PrinterName);
497
+                    //}
498
+                    //MessageWindow.Show("生成点阵文件成功!");
499
+                    //string TPFPath = FileToolsCommon.GetFileAbsolutePath("temp/");
500
+                    //FileToolsCommon.CreateDirectory(TPFPath);
285 501
                 });
286 502
             }
287 503
             else
@@ -292,9 +508,85 @@ namespace XHWK.WKTool
292 508
                     btnPrint.IsEnabled = true;
293 509
                     times.Stop();
294 510
                     tip_outer.Visibility = Visibility.Collapsed;
295
-                    MessageWindow.Show(standardError);
511
+                    return;
296 512
                 });
297 513
             }
514
+
515
+            #region 拓思德生成点阵文件
516
+            ////TPF文件位置
517
+            //string TPFPath = FileToolsCommon.GetFileAbsolutePath("temp/");
518
+            //FileToolsCommon.CreateDirectory(TPFPath);
519
+            //TPFPath += "101.TPF";
520
+            ////生成点阵文件
521
+            //LatticeFileHelper.GeneratingPDF(SourcePath, TPFPath, out int pr, out string msg, out string outPut/*, pyte*/);
522
+            //while (!FileToolsCommon.IsExistFile(TPFPath))
523
+            //{
524
+            //    Thread.Sleep(100);
525
+            //}
526
+            //while (string.IsNullOrWhiteSpace(pr.ToString()))
527
+            //{
528
+            //    Thread.Sleep(100);
529
+            //}
530
+            //Thread.Sleep(1000);
531
+            #endregion
532
+
533
+            #region 拓思德打印
534
+            ////打印
535
+            //LatticeFileHelper.PrinterTPFFile(TPFPath, PrinterNum, PrinterName, out int printResult, out string standardError, out string standardOutput);
536
+            //if (printResult == 0)
537
+            //{
538
+            //    Dispatcher.Invoke(() =>
539
+            //    {
540
+            //        btnClose.IsEnabled = true;
541
+            //        btnPrint.IsEnabled = true;
542
+            //        num = 99;
543
+            //        times.Stop();
544
+            //        pgbProcess.Value = 100;
545
+            //        lbProcess.Content = "100%";
546
+            //        MessageWindow.Show("打印成功!");
547
+            //        tip_outer.Visibility = Visibility.Collapsed;
548
+            //    });
549
+            //}
550
+            //else
551
+            //{
552
+            //    Dispatcher.Invoke(() =>
553
+            //    {
554
+            //        btnClose.IsEnabled = true;
555
+            //        btnPrint.IsEnabled = true;
556
+            //        times.Stop();
557
+            //        tip_outer.Visibility = Visibility.Collapsed;
558
+            //        MessageWindow.Show(standardError);
559
+            //    });
560
+            //}
561
+            #endregion
562
+        }
563
+        /// <summary>
564
+        /// 调用打印机打印
565
+        /// </summary>
566
+        /// <param name="PDFPath">PDF文件路径</param>
567
+        /// <param name="PrinterName">打印机名称</param>
568
+        void Print(string PDFPath,string PrinterName,short PrinterNum=1)
569
+        {
570
+            //加载PDF文档
571
+            PdfDocument doc = new PdfDocument();
572
+            doc.LoadFromFile(PDFPath);
573
+
574
+            //指定打印机
575
+            doc.PrintSettings.PrinterName = PrinterName;
576
+
577
+            //静默打印PDF文档
578
+            doc.PrintSettings.PrintController = new StandardPrintController();
579
+
580
+            ////设置文档打印页码范围
581
+            //doc.PrintSettings.SelectPageRange(1, 5);
582
+
583
+            //打印不连续的页面
584
+            //doc.PrintSettings.SelectSomePages(new int[] { 1, 3, 5, 7 });
585
+
586
+            //设置打印份数为2份
587
+            doc.PrintSettings.Copies = PrinterNum;
588
+            //打印PDF文档
589
+            doc.Print();
298 590
         }
299 591
         /// <summary>
300 592
         /// 返回一个时间戳到毫秒
@@ -359,128 +651,8 @@ namespace XHWK.WKTool
359 651
             }
360 652
 
361 653
         }
362
-        /// <summary>
363
-        /// 打印-开始
364
-        /// </summary>
365
-        /// <returns></returns>
366
-        private object InvokeServering()
367
-        {
368
-            Dispatcher.Invoke(() =>
369
-             {
370
-                 I = 1;
371
-                 pgbProcess.Value = I * 100 / 100;
372
-                 lbProcess.Content = I.ToString() + "%";
373
-                 tip_outer.Visibility = Visibility.Visible;
374
-                 //I = 0;
375
-             });
376
-            Thread.Sleep(2000);
377
-
378
-            string imgPath = FileToolsCommon.GetFileAbsolutePath("temp");
379
-            FileToolsCommon.CreateFile(imgPath);
380
-            string pdf = imgPath + "\\101.pdf";
381
-            string tpf = imgPath + "\\102.TPF";
382
-            string msg = string.Empty;
383
-            string outPut = string.Empty;
384
-            //if(rbnSquarePoint.IsChecked==false)
385
-            //{
386
-            //    pyte = 1;
387
-            //}
388
-            LatticeFileHelper.GeneratingPDF(pdf, tpf, out int pr, out msg, out outPut/*, pyte*/);
389
-            if (pr == 0)
390
-            {
391
-                //outPut = outPut.Replace("[", "").Replace("]", "").Replace("\"", "").Trim();
392
-                //APP.OutPut = outPut.Split(',');
393
-                //string []page= outPut.Split(',');
394
-                //for(int i=0;i<page.Length;i++) //增加页码编号
395
-                //{
396
-                //    APP.PageDrawList[i].PageCode = page[i];
397
-                //}
398
-
399
-                //string defa = string.Empty;
400
-                //List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
401
-
402
-                string standardError = string.Empty;
403
-                string standardOutput = string.Empty;
404
-                int frequency = 1;
405
-                //Dispatcher.Invoke(() =>
406
-                //{
407
-                frequency = Convert.ToInt32(txbNumberOfCopies.Text);
408
-                LatticeFileHelper.PrinterTPFFile(tpf, frequency, cmbClass.Text, out int printResult, out standardError, out standardOutput);
409
-                if (printResult == 0)// 0为成功
410
-                {
411
-                    new Thread(new ThreadStart(new Action(() =>
412
-                    {
413
-                        Dispatcher.Invoke(() =>
414
-                        {
415
-                            I = 100;
416
-                            pgbProcess.Value = I * 100 / 100;
417
-                            lbProcess.Content = I.ToString() + "%";
418
-                            APP.myloading.Hide();
419
-                            I = 0;
420
-                        });
421
-                        Thread.Sleep(3000);
422
-                        Dispatcher.Invoke(() =>
423
-                        {
424
-                            tip_outer.Visibility = Visibility.Collapsed;
425
-                            //tip_outer.Visibility = Visibility.Collapsed;
426
-                            MessageWindow.Show("打印成功");
427
-                        });
428
-                    }))).Start();
429
-                }
430
-                else
431
-                {
432
-                    Dispatcher.Invoke(() =>
433
-                    {
434
-                        APP.myloading.Hide();
435
-                        MessageWindow.Show(standardError);
436
-                    });
437
-                }
438
-                //});
439
-
440
-            }
441
-            else
442
-            {
443
-                APP.myloading.Hide();
444
-                MessageWindow.Show(msg);
445
-            }
446
-            return "";
447
-        }
448
-        /// <summary>
449
-        /// 打印-结束
450
-        /// </summary>
451
-        /// <returns></returns>
452
-        public void InvokeServerCompate(object obj)
453
-        {
454
-            try
455
-            {
456
-                GC.Collect();
457
-                APP.myloading.Hide();
458
-            }
459
-            catch (Exception)
460
-            {
461
-            }
462
-        }
463 654
 
464 655
         private int I = 0;
465
-        private void Times_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
466
-        {
467
-            Dispatcher.Invoke(() =>
468
-            {
469
-                if (I <= 90)
470
-                {
471
-                    try
472
-                    {
473
-                        pgbProcess.Value = I * 100 / 100;
474
-                        lbProcess.Content = I.ToString() + "%";
475
-                        I++;
476
-                    }
477
-                    catch (Exception ex)
478
-                    {
479
-                        LogHelper.WriteErrLog("【摄像】(Times_Elapsed)生成图片错误:" + ex.Message, ex);
480
-                    }
481
-                }
482
-            });
483
-        }
484 656
         /// <summary>
485 657
         /// 窗口移动
486 658
         /// </summary>
@@ -498,6 +670,7 @@ namespace XHWK.WKTool
498 670
         private void BtnClose_Click(object sender, RoutedEventArgs e)
499 671
         {
500 672
             Hide();
673
+            TMC.TmatrixUninitialize();
501 674
         }
502 675
         /// <summary>
503 676
         /// 减
@@ -528,9 +701,5 @@ namespace XHWK.WKTool
528 701
             }
529 702
         }
530 703
 
531
-        private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
532
-        {
533
-
534
-        }
535 704
     }
536 705
 }

+ 128
- 0
XHWK.WKTool/PrintWindowTStudy.xaml Datei anzeigen

@@ -0,0 +1,128 @@
1
+<Window x:Class="XHWK.WKTool.PrintWindowTStudy"
2
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6
+        xmlns:local="clr-namespace:XHWK.WKTool" xmlns:Views="clr-namespace:XHWK.WKTool.Helpers"
7
+        mc:Ignorable="d"
8
+        Title="PrintWindowTStudy" Height="600" Width="900" AllowsTransparency="True"
9
+    ShowInTaskbar="False"
10
+    WindowStartupLocation="CenterOwner"
11
+    WindowStyle="None"  BorderThickness="7">
12
+    <Window.Effect>
13
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
14
+    </Window.Effect>
15
+    <Window.Resources>
16
+        <Style x:Key="NoMouseOverButtonStyle" TargetType="{x:Type Button}">
17
+            <Setter Property="BorderThickness" Value="1"/>
18
+            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
19
+            <Setter Property="HorizontalContentAlignment" Value="Center"/>
20
+            <Setter Property="VerticalContentAlignment" Value="Center"/>
21
+            <Setter Property="Padding" Value="1"/>
22
+            <Setter Property="Template">
23
+                <Setter.Value>
24
+                    <ControlTemplate TargetType="{x:Type Button}">
25
+                        <Border x:Name="Chrome" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
26
+                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
27
+                        </Border>
28
+                    </ControlTemplate>
29
+                </Setter.Value>
30
+            </Setter>
31
+        </Style>
32
+    </Window.Resources>
33
+    <Grid x:Name="GridContent" Height="600">
34
+        <Grid.RowDefinitions>
35
+            <RowDefinition Height="120"/>
36
+            <RowDefinition Height="*"/>
37
+            <RowDefinition Height="80"/>
38
+        </Grid.RowDefinitions>
39
+        <Grid Grid.Row="0" Background="#E6EAF0" MouseLeftButtonDown="Window_MouseLeftButtonDown">
40
+            <Grid.RowDefinitions>
41
+                <RowDefinition Height="50"/>
42
+                <RowDefinition Height="50"/>
43
+                <RowDefinition Height="*"/>
44
+            </Grid.RowDefinitions>
45
+            <Button Cursor="Hand" Grid.Row="0" x:Name="btnClose" Background="#CC4848" Foreground="#FFFFFF" Content="×" FontSize="20" Width="30" Height="30" HorizontalAlignment="Right" Margin="0,0,10,0" Click="BtnClose_Click" Style="{StaticResource NoMouseOverButtonStyle}">
46
+
47
+            </Button>
48
+            <StackPanel Grid.Row="1" HorizontalAlignment="Left" Orientation="Horizontal" Margin="10,2,0,0" Height="40">
49
+                <TextBlock  Text="打印机:"  FontSize="20" Padding="0,5,0,0"/>
50
+                <ComboBox Cursor="Hand" Width="210"
51
+                                x:Name="cmbClass"
52
+                                Padding="30,0,10,0"
53
+                                VerticalContentAlignment="Center"
54
+                                BorderThickness="0"
55
+                                DisplayMemberPath="Value"
56
+                                FontSize="14"
57
+                                SelectedValuePath="Key"
58
+                                />
59
+                <TextBlock Text="份数:" FontSize="20" Margin="80,0,0,0" Padding="0,5,0,0" HorizontalAlignment="Right"/>
60
+                <TextBlock x:Name="txbNumberOfCopies" Width="100" Text="1" FontSize="16" Padding="50,10,0,0" Background="White"/>
61
+                <Grid>
62
+                    <Grid.RowDefinitions>
63
+                        <RowDefinition Height="auto"/>
64
+                        <RowDefinition Height="auto"/>
65
+                    </Grid.RowDefinitions>
66
+                    <Button Cursor="Hand" Grid.Row="0" x:Name="btnAdd"  Content="+" Click="BtnAdd_Click"/>
67
+                    <Button Cursor="Hand" Grid.Row="1" x:Name="btnLess"  Content="-" Click="BtnLess_Click"/>
68
+                </Grid>
69
+                <!--<TextBlock Text="点型:" FontSize="20"  Margin="120,10,0,0"/>
70
+                <RadioButton x:Name="rbnSquarePoint" Content="方点" FontSize="16"  Margin="0,15,0,0" IsChecked="True"/>
71
+                <RadioButton x:Name="rbnDots" Content="圆点" FontSize="16"  Margin="0,15,0,0"/>-->
72
+            </StackPanel>
73
+        </Grid>
74
+
75
+        <Views:ZJClippingBorder Grid.Row="0" x:Name="tip_outer" Margin="0" Background="#FFE6EAF0" CornerRadius="4" Visibility="Collapsed">
76
+            <Grid>
77
+                <Label Content="打印中..." HorizontalAlignment="Center" Margin="0,20,0,0" Height="35" VerticalAlignment="Top" FontSize="20"></Label>
78
+                <ProgressBar BorderBrush="#4597FF"
79
+                             Foreground="#4597FF"
80
+                    Grid.Row="0"
81
+                    x:Name="pgbProcess"
82
+                    Height="20"
83
+                    Margin="50,20,50,0"
84
+                    Visibility="Visible" />
85
+                <Label Grid.Row="0"
86
+                    HorizontalAlignment="Center" Width="60"
87
+                    x:Name="lbProcess"
88
+                    Height="30"
89
+                    Margin="0,20,0,0"
90
+                       FontSize="16"
91
+                    Content=""
92
+                       Foreground="White"
93
+                    Visibility="Visible" />
94
+            </Grid>
95
+        </Views:ZJClippingBorder>
96
+        <Grid Grid.Row="1">
97
+            <Image x:Name="imgPri"/>
98
+        </Grid>
99
+
100
+        <Button
101
+                    x:Name="btnPrint"
102
+                    Grid.Row="2"
103
+                    Width="115"
104
+                    Height="46"
105
+                    Click="BtnPrint_Click"
106
+                    Content="打印"
107
+            Foreground="White"
108
+                    FontSize="17"
109
+                    IsDefault="True"
110
+                    Cursor="Hand"
111
+                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
112
+            <Button.Template>
113
+                <ControlTemplate TargetType="{x:Type Button}">
114
+                    <Border
115
+                                BorderBrush="{TemplateBinding Control.BorderBrush}"
116
+                                BorderThickness="1"
117
+                                CornerRadius="7">
118
+                        <Border.Background>#2E8CF0</Border.Background>
119
+                        <ContentPresenter
120
+                                    HorizontalAlignment="Center"
121
+                                    VerticalAlignment="Center"
122
+                                    Content="{TemplateBinding ContentControl.Content}" />
123
+                    </Border>
124
+                </ControlTemplate>
125
+            </Button.Template>
126
+        </Button>
127
+    </Grid>
128
+</Window>

+ 632
- 0
XHWK.WKTool/PrintWindowTStudy.xaml.cs Datei anzeigen

@@ -0,0 +1,632 @@
1
+using Common.system;
2
+
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.IO;
8
+using System.Threading;
9
+using System.Windows;
10
+using System.Windows.Input;
11
+using System.Windows.Media.Imaging;
12
+using System.Windows.Threading;
13
+
14
+using TmatrixLibrary;
15
+
16
+namespace XHWK.WKTool
17
+{
18
+    /// <summary>
19
+    /// 打印
20
+    /// </summary>
21
+    public partial class PrintWindowTStudy : Window
22
+    {
23
+        /// <summary>
24
+        /// 下拉框数据源
25
+        /// </summary>
26
+        public DataTable data = new DataTable();
27
+        private DataTable dtComponentsUniqueNo;
28
+
29
+        private System.Timers.Timer times;
30
+        public PrintWindowTStudy()
31
+        {
32
+            InitializeComponent();
33
+            double proportion = 1036.0 / 1290.0;
34
+            double Widths = (PrimaryScreen.ScaleWorkingAreaSize.Height) / proportion - (BorderThickness.Left + BorderThickness.Right);
35
+            double Heights = PrimaryScreen.ScaleWorkingAreaSize.Height - (BorderThickness.Top + BorderThickness.Bottom);
36
+            Width = Widths / 1.42;
37
+            Height = Heights / 1.71;
38
+            GridContent.Width = Width + 5;
39
+            GridContent.Height = Height;
40
+            ResizeMode = ResizeMode.NoResize;
41
+            string defa = string.Empty;
42
+            List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
43
+            if (defaList.Count > 0)
44
+            {
45
+                data.Columns.Add("Value");
46
+                data.Columns.Add("Key");
47
+                for (int i = 0; i < defaList.Count; i++)
48
+                {
49
+                    //创建一行
50
+                    DataRow row = data.NewRow();
51
+                    //将此行添加到table中
52
+                    data.Rows.Add(row);
53
+                    data.Rows[i]["Value"] = defaList[i];
54
+                    data.Rows[i]["Key"] = i.ToString();
55
+                }
56
+                dtComponentsUniqueNo = data.DefaultView.ToTable();
57
+                cmbClass.ItemsSource = dtComponentsUniqueNo.DefaultView;
58
+                cmbClass.SelectedIndex = 0;
59
+            }
60
+        }
61
+
62
+        private double wit = 0;
63
+        private double hei = 0;
64
+        public void Initialize(string _imgPath, double _wit, double _hei)
65
+        {
66
+            wit = _wit;
67
+            hei = _hei;
68
+            if (!string.IsNullOrWhiteSpace(_imgPath))
69
+            {
70
+                imgPri.Source = new BitmapImage(new Uri(_imgPath));
71
+            }
72
+            else
73
+            {
74
+                imgPri.Source = null;
75
+            }
76
+            I = 0;
77
+            tip_outer.Visibility = Visibility.Collapsed;
78
+        }
79
+
80
+        /// <summary>
81
+        /// 打印
82
+        /// </summary>
83
+        /// <param name="sender"></param>
84
+        /// <param name="e"></param>
85
+        private void BtnPrint_Click(object sender, RoutedEventArgs e)
86
+        {
87
+            if (string.IsNullOrWhiteSpace(cmbClass.Text))
88
+            {
89
+                //MessageWindow.Show("打印机不能为空!");
90
+                MessageWindow.Show("请设置打印机!");
91
+                return;
92
+            }
93
+            //APP.myloading.Show();
94
+            btnClose.IsEnabled = false;
95
+            btnPrint.IsEnabled = false;
96
+            //APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeServering, InvokeServerCompate);
97
+            Thread myThread = new Thread(StartPrint);
98
+            List<string> StrList = new List<string>();
99
+
100
+            //string imgPath = 
101
+            //FileToolsCommon.CreateFile(imgPath);
102
+            //string pdf = imgPath + "\\101.pdf";
103
+            //PDF位置
104
+            //string SourcePath = FileToolsCommon.GetFileAbsolutePath("/temp/101.pdf");
105
+            //StrList.Add(SourcePath);
106
+            int ipdf = 102;
107
+            string imgPath = FileToolsCommon.GetFileAbsolutePath("temp/");
108
+            string tempImgPath = imgPath;
109
+            imgPath += "101.pdf";
110
+            while (File.Exists(imgPath))
111
+            {
112
+                imgPath = tempImgPath + ipdf.ToString() + ".pdf";
113
+                ipdf++;
114
+            }
115
+            StrList.Add(imgPath);
116
+            //打印数量
117
+            int PrinterNum = Convert.ToInt32(txbNumberOfCopies.Text);
118
+            StrList.Add(PrinterNum.ToString());
119
+            //打印机名称
120
+            string PrinterName = cmbClass.Text;
121
+            StrList.Add(PrinterName);
122
+
123
+            num = 0;
124
+            tip_outer.Visibility = Visibility.Visible;
125
+            myThread.Start(StrList);
126
+            times = new System.Timers.Timer(100);
127
+            times.Elapsed += Times_ElapsedClick;
128
+            times.Start();
129
+        }
130
+
131
+        private int num = 0;
132
+        /// <summary>
133
+        /// 计时器
134
+        /// </summary>
135
+        /// <param name="sender"></param>
136
+        /// <param name="e"></param>
137
+        private void Times_ElapsedClick(object sender, System.Timers.ElapsedEventArgs e)
138
+        {
139
+            Dispatcher.Invoke(() =>
140
+            {
141
+                pgbProcess.Value = num;
142
+                lbProcess.Content = num.ToString() + "%";
143
+                if (num < 99)
144
+                {
145
+                    num++;
146
+                    times.Interval += (num / 2);
147
+                }
148
+                else
149
+                {
150
+                    times.Stop();
151
+                }
152
+            });
153
+        }
154
+
155
+        /// <summary>
156
+        /// 开始打印
157
+        /// </summary>
158
+        private void StartPrint(object obj)
159
+        {
160
+            try
161
+            {
162
+                iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
163
+                //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
164
+                ////设置纸张横向
165
+                //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
166
+
167
+                List<string> objStr1 = (List<string>)obj;
168
+                string SourcePath1 = objStr1[0];
169
+                iTextSharp.text.pdf.PdfWriter.GetInstance(document, new FileStream(SourcePath1, FileMode.Create, FileAccess.ReadWrite));
170
+                document.Open();
171
+                iTextSharp.text.Image image;
172
+                for (int i = 0; i < APP.PageDrawList.Count; i++)
173
+                {
174
+                    long ii = Timestamp();
175
+                    string directoryPath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
176
+                    string filePathOutPut = Path.Combine(directoryPath, string.Format("print{0}{1}.jpg", ii, i));
177
+                    RectangleF rectangleFs = new RectangleF();
178
+                    MergerImg("", filePathOutPut, rectangleFs, out string errmsg);
179
+                    image = iTextSharp.text.Image.GetInstance(filePathOutPut);
180
+                    if (string.IsNullOrEmpty(APP.PageDrawList[i].PageImagePath))//没有图片
181
+                    {
182
+
183
+                    }
184
+                    else if (APP.PageDrawList[i].ImgDocumentation == true && !APP.PageDrawList[i].Type.Equals("ppt"))
185
+                    {
186
+                        image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
187
+                    }
188
+                    else
189
+                    {
190
+                        RectangleF rectangleF = new RectangleF(0, 0, 0, 0);
191
+                        Dispatcher.Invoke(() =>
192
+                        {
193
+                            rectangleF = new RectangleF
194
+                            {
195
+                                Width = (float)APP.PageDrawList[i].ImageSizes.CenterX,
196
+                                Height = (float)APP.PageDrawList[i].ImageSizes.CenterY,
197
+                                X = (float)APP.PageDrawList[i].ImageLocation.X,
198
+                                Y = (float)APP.PageDrawList[i].ImageLocation.Y
199
+                            };
200
+                        });
201
+
202
+
203
+
204
+                        string msgs = string.Empty;
205
+
206
+
207
+                        bool isImg = MergerImg(APP.PageDrawList[i].PageImagePath, filePathOutPut, rectangleF, out msgs);
208
+                        if (isImg)
209
+                        {
210
+                            image = iTextSharp.text.Image.GetInstance(filePathOutPut);
211
+                        }
212
+                        else
213
+                        {
214
+                            image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
215
+                        }
216
+
217
+
218
+                    }
219
+                    if (image.Height > iTextSharp.text.PageSize.A4.Height)
220
+                    {
221
+                        image.ScaleToFit(iTextSharp.text.PageSize.A4.Width, iTextSharp.text.PageSize.A4.Height);
222
+                    }
223
+                    else if (image.Width > iTextSharp.text.PageSize.A4.Width)
224
+                    {
225
+                        image.ScaleToFit(iTextSharp.text.PageSize.A4.Width, iTextSharp.text.PageSize.A4.Height);
226
+                    }
227
+                    image.Alignment = iTextSharp.text.Image.ALIGN_MIDDLE;
228
+                    document.NewPage();
229
+                    document.Add(image);
230
+                    //iTextSharp.text.Chunk c1 = new iTextSharp.text.Chunk("Hello World");
231
+                    //iTextSharp.text.Phrase p1 = new iTextSharp.text.Phrase();
232
+                    //p1.Leading = 150;      //行间距
233
+                    //document.Add(p1);
234
+                }
235
+                Console.WriteLine("转换成功!");
236
+                document.Close();
237
+            }
238
+            catch (Exception ex)
239
+            {
240
+                Dispatcher.Invoke(() =>
241
+                {
242
+                    btnClose.IsEnabled = true;
243
+                    btnPrint.IsEnabled = true;
244
+                    times.Stop();
245
+                    tip_outer.Visibility = Visibility.Collapsed;
246
+                    MessageWindow.Show(ex.Message);
247
+                    return;
248
+                });
249
+                LogHelper.WriteErrLog("打印转换PDF失败,原因:" + ex.Message, ex);
250
+            }
251
+
252
+
253
+
254
+            List<string> objStr = (List<string>)obj;
255
+            string SourcePath = objStr[0];
256
+            int PrinterNum = int.Parse(objStr[1]);
257
+            string PrinterName = objStr[2];
258
+            //TPF文件位置
259
+            string TPFPath = FileToolsCommon.GetFileAbsolutePath("temp/");
260
+            FileToolsCommon.CreateDirectory(TPFPath);
261
+            TPFPath += "101.TPF";
262
+
263
+            #region 腾千里服务打印
264
+            //if (APP.dAL_TmatrixCode == null)
265
+            //{
266
+            //    APP.dAL_TmatrixCode = new DAL.DAL_TmatrixCode();
267
+            //}
268
+            //string ErrMessage;
269
+            //if(APP.dAL_TmatrixCode.TQLUserLogin(out ErrMessage))
270
+            //{
271
+            //    if(APP.dAL_TmatrixCode.TQLStartTmatrix(TPFPath, "101.TPF", out ErrMessage))
272
+            //    {
273
+            //        while(true)
274
+            //        {
275
+            //            //-1失败 0:未铺码 1:正在铺码 2:铺码完成,3:未查到。
276
+            //            int TmatrixType = APP.dAL_TmatrixCode.TQLSchedulequery(out ErrMessage);
277
+            //            if(TmatrixType==0)
278
+            //            {
279
+            //                //未铺码
280
+            //                Thread.Sleep(3000);
281
+            //            }
282
+            //            else if(TmatrixType==1)
283
+            //            {
284
+            //                //正在铺码
285
+            //                Thread.Sleep(1000);
286
+            //            }
287
+            //            else if (TmatrixType == 2)
288
+            //            {
289
+            //                //铺码完成
290
+            //                Dispatcher.Invoke(() =>
291
+            //                {
292
+            //                    btnClose.IsEnabled = true;
293
+            //                    btnPrint.IsEnabled = true;
294
+            //                    num = 99;
295
+            //                    times.Stop();
296
+            //                    pgbProcess.Value = 100;
297
+            //                    lbProcess.Content = "100%";
298
+            //                    MessageWindow.Show("打印成功!");
299
+            //                    tip_outer.Visibility = Visibility.Collapsed;
300
+            //                });
301
+
302
+            //            }
303
+            //            else if (TmatrixType == 3)
304
+            //            {
305
+            //                //未查到
306
+            //                Dispatcher.Invoke(() =>
307
+            //                {
308
+            //                    btnClose.IsEnabled = true;
309
+            //                    btnPrint.IsEnabled = true;
310
+            //                    times.Stop();
311
+            //                    tip_outer.Visibility = Visibility.Collapsed;
312
+            //                    MessageWindow.Show("文件铺码失败," + ErrMessage);
313
+            //                });
314
+            //                break;
315
+            //            }
316
+            //            else //if (TmatrixType == -1)
317
+            //            {
318
+            //                Dispatcher.Invoke(() =>
319
+            //                {
320
+            //                    btnClose.IsEnabled = true;
321
+            //                    btnPrint.IsEnabled = true;
322
+            //                    times.Stop();
323
+            //                    tip_outer.Visibility = Visibility.Collapsed;
324
+            //                    MessageWindow.Show("文件铺码失败," + ErrMessage);
325
+            //                });
326
+            //                break;
327
+            //            }
328
+            //        }
329
+            //    }
330
+            //    else
331
+            //    {
332
+            //        Dispatcher.Invoke(() =>
333
+            //        {
334
+            //            btnClose.IsEnabled = true;
335
+            //            btnPrint.IsEnabled = true;
336
+            //            times.Stop();
337
+            //            tip_outer.Visibility = Visibility.Collapsed;
338
+            //            MessageWindow.Show("文件铺码失败,"+ErrMessage);
339
+            //        });
340
+            //    }
341
+            //}
342
+            //else
343
+            //{
344
+            //    Dispatcher.Invoke(() =>
345
+            //    {
346
+            //        btnClose.IsEnabled = true;
347
+            //        btnPrint.IsEnabled = true;
348
+            //        times.Stop();
349
+            //        tip_outer.Visibility = Visibility.Collapsed;
350
+            //        MessageWindow.Show("登录铺码服务器失败,"+ErrMessage);
351
+            //    });
352
+            //}
353
+            #endregion
354
+
355
+            #region 拓思德生成点阵文件
356
+            //生成点阵文件
357
+            LatticeFileHelper.GeneratingPDF(SourcePath, TPFPath, out int pr, out string msg, out string outPut/*, pyte*/);
358
+            while (!FileToolsCommon.IsExistFile(TPFPath))
359
+            {
360
+                Thread.Sleep(100);
361
+            }
362
+            while (string.IsNullOrWhiteSpace(pr.ToString()))
363
+            {
364
+                Thread.Sleep(100);
365
+            }
366
+            Thread.Sleep(1000);
367
+            #endregion
368
+
369
+            #region 拓思德打印
370
+            //打印
371
+            LatticeFileHelper.PrinterTPFFile(TPFPath, PrinterNum, PrinterName, out int printResult, out string standardError, out string standardOutput);
372
+            if (printResult == 0)
373
+            {
374
+                Dispatcher.Invoke(() =>
375
+                {
376
+                    btnClose.IsEnabled = true;
377
+                    btnPrint.IsEnabled = true;
378
+                    num = 99;
379
+                    times.Stop();
380
+                    pgbProcess.Value = 100;
381
+                    lbProcess.Content = "100%";
382
+                    MessageWindow.Show("打印成功!");
383
+                    tip_outer.Visibility = Visibility.Collapsed;
384
+                });
385
+            }
386
+            else
387
+            {
388
+                Dispatcher.Invoke(() =>
389
+                {
390
+                    btnClose.IsEnabled = true;
391
+                    btnPrint.IsEnabled = true;
392
+                    times.Stop();
393
+                    tip_outer.Visibility = Visibility.Collapsed;
394
+                    MessageWindow.Show(standardError);
395
+                });
396
+            }
397
+            #endregion
398
+        }
399
+        /// <summary>
400
+        /// 返回一个时间戳到毫秒
401
+        /// </summary>
402
+        /// <returns></returns>
403
+        public static long Timestamp()
404
+        {
405
+            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
406
+            long timestr = Convert.ToInt64(ts.TotalMilliseconds);
407
+            return timestr;
408
+        }
409
+        /// <summary>
410
+        /// 生成图片
411
+        /// </summary>
412
+        /// <param name="_path">图片地址</param>
413
+        /// <param name="_saveimg">保存位置</param>
414
+        /// <param name="_rectangle">图片位置</param>
415
+        /// <param name="errmsg">错误消息</param>
416
+        /// <returns></returns>
417
+        private bool MergerImg(string _path, string _saveimg, RectangleF _rectangle, out string errmsg)
418
+        {
419
+            errmsg = null;
420
+            try
421
+            {
422
+                Bitmap bitmap = null;
423
+
424
+                //创建要显示的图片对象,根据参数的个数设置宽度
425
+                Bitmap backgroudImg = new Bitmap((int)/*gridM.ActualWidth*/wit, (int)/*gridM.ActualHeight*/hei);
426
+                Graphics g = Graphics.FromImage(backgroudImg);
427
+                //清除画布,背景设置为白色
428
+                g.Clear(System.Drawing.Color.White);
429
+
430
+                if (!string.IsNullOrWhiteSpace(_path))
431
+                {
432
+                    bitmap = ImageHelper.ReadBitmapFile(_path);
433
+                    g.DrawImage(bitmap, _rectangle);
434
+                }
435
+                #region 添加箭头
436
+                string Str = "↑";
437
+                SolidBrush mybrush = new SolidBrush(Color.Black);  //设置默认画刷颜色
438
+                Font myfont = new Font("黑体", 14);         //设置默认字体格式
439
+                g.DrawString(Str, myfont, mybrush, new Rectangle((int)wit - 50, 20, 50, 50));
440
+
441
+                #endregion
442
+                backgroudImg.Save(_saveimg);
443
+
444
+                g.Dispose();
445
+                backgroudImg.Dispose();
446
+                if (bitmap != null)
447
+                {
448
+                    bitmap.Dispose();
449
+                }
450
+
451
+                GC.Collect();
452
+                return true;
453
+            }
454
+            catch (Exception ex)
455
+            {
456
+                errmsg = ex.Message;
457
+                LogHelper.WriteErrLog("【截图合成】(MergerImg)图片合成失败:" + ex.Message, ex);
458
+                return false;
459
+            }
460
+
461
+        }
462
+        /// <summary>
463
+        /// 打印-开始
464
+        /// </summary>
465
+        /// <returns></returns>
466
+        private object InvokeServering()
467
+        {
468
+            Dispatcher.Invoke(() =>
469
+             {
470
+                 I = 1;
471
+                 pgbProcess.Value = I * 100 / 100;
472
+                 lbProcess.Content = I.ToString() + "%";
473
+                 tip_outer.Visibility = Visibility.Visible;
474
+                 //I = 0;
475
+             });
476
+            Thread.Sleep(2000);
477
+
478
+            string imgPath = FileToolsCommon.GetFileAbsolutePath("temp");
479
+            FileToolsCommon.CreateFile(imgPath);
480
+            string pdf = imgPath + "\\101.pdf";
481
+            string tpf = imgPath + "\\102.TPF";
482
+            string msg = string.Empty;
483
+            string outPut = string.Empty;
484
+            //if(rbnSquarePoint.IsChecked==false)
485
+            //{
486
+            //    pyte = 1;
487
+            //}
488
+            LatticeFileHelper.GeneratingPDF(pdf, tpf, out int pr, out msg, out outPut/*, pyte*/);
489
+            if (pr == 0)
490
+            {
491
+                //outPut = outPut.Replace("[", "").Replace("]", "").Replace("\"", "").Trim();
492
+                //APP.OutPut = outPut.Split(',');
493
+                //string []page= outPut.Split(',');
494
+                //for(int i=0;i<page.Length;i++) //增加页码编号
495
+                //{
496
+                //    APP.PageDrawList[i].PageCode = page[i];
497
+                //}
498
+
499
+                //string defa = string.Empty;
500
+                //List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
501
+
502
+                string standardError = string.Empty;
503
+                string standardOutput = string.Empty;
504
+                int frequency = 1;
505
+                //Dispatcher.Invoke(() =>
506
+                //{
507
+                frequency = Convert.ToInt32(txbNumberOfCopies.Text);
508
+                LatticeFileHelper.PrinterTPFFile(tpf, frequency, cmbClass.Text, out int printResult, out standardError, out standardOutput);
509
+                if (printResult == 0)// 0为成功
510
+                {
511
+                    new Thread(new ThreadStart(new Action(() =>
512
+                    {
513
+                        Dispatcher.Invoke(() =>
514
+                        {
515
+                            I = 100;
516
+                            pgbProcess.Value = I * 100 / 100;
517
+                            lbProcess.Content = I.ToString() + "%";
518
+                            APP.myloading.Hide();
519
+                            I = 0;
520
+                        });
521
+                        Thread.Sleep(3000);
522
+                        Dispatcher.Invoke(() =>
523
+                        {
524
+                            tip_outer.Visibility = Visibility.Collapsed;
525
+                            //tip_outer.Visibility = Visibility.Collapsed;
526
+                            MessageWindow.Show("打印成功");
527
+                        });
528
+                    }))).Start();
529
+                }
530
+                else
531
+                {
532
+                    Dispatcher.Invoke(() =>
533
+                    {
534
+                        APP.myloading.Hide();
535
+                        MessageWindow.Show(standardError);
536
+                    });
537
+                }
538
+                //});
539
+
540
+            }
541
+            else
542
+            {
543
+                APP.myloading.Hide();
544
+                MessageWindow.Show(msg);
545
+            }
546
+            return "";
547
+        }
548
+        /// <summary>
549
+        /// 打印-结束
550
+        /// </summary>
551
+        /// <returns></returns>
552
+        public void InvokeServerCompate(object obj)
553
+        {
554
+            try
555
+            {
556
+                GC.Collect();
557
+                APP.myloading.Hide();
558
+            }
559
+            catch (Exception)
560
+            {
561
+            }
562
+        }
563
+
564
+        private int I = 0;
565
+        private void Times_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
566
+        {
567
+            Dispatcher.Invoke(() =>
568
+            {
569
+                if (I <= 90)
570
+                {
571
+                    try
572
+                    {
573
+                        pgbProcess.Value = I * 100 / 100;
574
+                        lbProcess.Content = I.ToString() + "%";
575
+                        I++;
576
+                    }
577
+                    catch (Exception ex)
578
+                    {
579
+                        LogHelper.WriteErrLog("【摄像】(Times_Elapsed)生成图片错误:" + ex.Message, ex);
580
+                    }
581
+                }
582
+            });
583
+        }
584
+        /// <summary>
585
+        /// 窗口移动
586
+        /// </summary>
587
+        /// <param name="sender"></param>
588
+        /// <param name="e"></param>
589
+        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
590
+        {
591
+            DragMove();
592
+        }
593
+        /// <summary>
594
+        /// 关闭
595
+        /// </summary>
596
+        /// <param name="sender"></param>
597
+        /// <param name="e"></param>
598
+        private void BtnClose_Click(object sender, RoutedEventArgs e)
599
+        {
600
+            Hide();
601
+        }
602
+        /// <summary>
603
+        /// 减
604
+        /// </summary>
605
+        /// <param name="sender"></param>
606
+        /// <param name="e"></param>
607
+        private void BtnLess_Click(object sender, RoutedEventArgs e)
608
+        {
609
+            int num = Convert.ToInt32(txbNumberOfCopies.Text);
610
+            if (num > 1)
611
+            {
612
+                num = num - 1;
613
+                txbNumberOfCopies.Text = num.ToString();
614
+            }
615
+        }
616
+        /// <summary>
617
+        /// 新增
618
+        /// </summary>
619
+        /// <param name="sender"></param>
620
+        /// <param name="e"></param>
621
+        private void BtnAdd_Click(object sender, RoutedEventArgs e)
622
+        {
623
+            int num = Convert.ToInt32(txbNumberOfCopies.Text);
624
+            if (num > 0)
625
+            {
626
+                num = num + 1;
627
+                txbNumberOfCopies.Text = num.ToString();
628
+            }
629
+        }
630
+
631
+    }
632
+}

+ 2
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs Datei anzeigen

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

BIN
XHWK.WKTool/TQLComm.dll Datei anzeigen


+ 28
- 10
XHWK.WKTool/TQLPen/PenEvents.cs Datei anzeigen

@@ -38,6 +38,17 @@ namespace XHWK.WKTool
38 38
             //this.form = form;
39 39
             Manager = new PenCommManager(this);
40 40
             Manager.Init();
41
+
42
+            ////获取离线数据量
43
+            //Manager.GetOfflineDataNo();
44
+            ////开始下载离线数据
45
+            //Manager.StartDownloadOfflineData();
46
+            ////继续
47
+            //Manager.ContinueDownloadOfflineData();
48
+            ////暂停下载
49
+            //Manager.PauseDownloadOfflineData();
50
+            //删除离线数据
51
+            Manager.RemoveOfflineData();
41 52
         }
42 53
 
43 54
 
@@ -111,18 +122,19 @@ namespace XHWK.WKTool
111 122
         {
112 123
             if (bEnd)
113 124
             {
114
-                //if (form.StartDownload) form.StartDownload = false;
115
-                //form.StartOrStop(form.StartDownload);
116
-                //form.DrawOffType = -1;
117
-
118
-                //form.AddLog("下载离线数据成功!");
119
-
120
-                //form.SetProGress(100);
125
+                ////继续
126
+                //Manager.ContinueDownloadOfflineData();
127
+                ////暂停下载
128
+                //Manager.PauseDownloadOfflineData();
129
+                //下载离线数据成功!
130
+                //删除离线数据
131
+                Manager.RemoveOfflineData();
121 132
             }
122 133
             else
123 134
             {
124
-                //if (!form.StartDownload) form.StartDownload = true;
125
-                //form.AddLog("下载离线数据失败!");
135
+                //下载离线数据失败!
136
+                //删除离线数据
137
+                Manager.RemoveOfflineData();
126 138
             }
127 139
         }
128 140
 
@@ -189,7 +201,13 @@ namespace XHWK.WKTool
189 201
 
190 202
         public void onGetOfflineDataNo(int Data)
191 203
         {
192
-            //ConnectPen = true;
204
+            ConnectPen = true;
205
+
206
+            if (Data > 0)
207
+            {
208
+                //开始下载离线数据
209
+                Manager.StartDownloadOfflineData();
210
+            }
193 211
             //form.AddLog("当前离线数据量:" + Data.ToString() + "!");
194 212
             //if (Data == 0 && form.StartDownload == true)
195 213
             //{

+ 10
- 0
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Datei anzeigen

@@ -131,6 +131,16 @@ namespace XHWK.WKTool
131 131
             new Aspose.Pdf.License().SetLicense(new MemoryStream(Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRlMzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2eGtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWndOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=")));
132 132
             new Aspose.Slides.License().SetLicense(new MemoryStream(Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRlMzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2eGtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWndOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=")));
133 133
             InitializeComponent();
134
+            //string StrMessage = "";
135
+            //if (AutoStartHelper.OpenAutoStart(FileToolsCommon.GetFileAbsolutePath("/星火微课.exe"), out StrMessage))
136
+            //{
137
+            //    MessageWindow.Show("自启成功!");
138
+            //}
139
+            //else
140
+            //{
141
+
142
+            //    MessageWindow.Show(StrMessage);
143
+            //}
134 144
 
135 145
             float WorkW = PrimaryScreen.ScaleWorkingAreaSize.Width;
136 146
             float WorkH = PrimaryScreen.ScaleWorkingAreaSize.Height;

+ 65
- 3
XHWK.WKTool/XHWK.WKTool.csproj Datei anzeigen

@@ -14,6 +14,21 @@
14 14
     <WarningLevel>4</WarningLevel>
15 15
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16 16
     <Deterministic>true</Deterministic>
17
+    <PublishUrl>publish\</PublishUrl>
18
+    <Install>true</Install>
19
+    <InstallFrom>Disk</InstallFrom>
20
+    <UpdateEnabled>false</UpdateEnabled>
21
+    <UpdateMode>Foreground</UpdateMode>
22
+    <UpdateInterval>7</UpdateInterval>
23
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
24
+    <UpdatePeriodically>false</UpdatePeriodically>
25
+    <UpdateRequired>false</UpdateRequired>
26
+    <MapFileExtensions>true</MapFileExtensions>
27
+    <ApplicationRevision>0</ApplicationRevision>
28
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
29
+    <IsWebBootstrapper>false</IsWebBootstrapper>
30
+    <UseApplicationTrust>false</UseApplicationTrust>
31
+    <BootstrapperEnabled>true</BootstrapperEnabled>
17 32
   </PropertyGroup>
18 33
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19 34
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -75,8 +90,24 @@
75 90
     <Reference Include="Aspose.Words, Version=19.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
76 91
       <HintPath>..\packages\Aspose.Words.19.1.0\lib\net40\Aspose.Words.dll</HintPath>
77 92
     </Reference>
78
-    <Reference Include="itextsharp, Version=5.5.13.1, Culture=neutral, PublicKeyToken=8354ae6d2174ddca, processorArchitecture=MSIL">
79
-      <HintPath>..\packages\iTextSharp.5.5.13.1\lib\itextsharp.dll</HintPath>
93
+    <Reference Include="AxInterop.AcroPDFLib">
94
+      <HintPath>..\Common\dlls\TQLFinalDLL\AxInterop.AcroPDFLib.dll</HintPath>
95
+    </Reference>
96
+    <Reference Include="BouncyCastle.Crypto, Version=1.8.6.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
97
+      <HintPath>..\packages\BouncyCastle.1.8.6.1\lib\BouncyCastle.Crypto.dll</HintPath>
98
+    </Reference>
99
+    <Reference Include="DocumentTools">
100
+      <HintPath>..\Common\dlls\TQLFinalDLL\DocumentTools.dll</HintPath>
101
+    </Reference>
102
+    <Reference Include="DrawToolsLib">
103
+      <HintPath>..\Common\dlls\TQLFinalDLL\DrawToolsLib.dll</HintPath>
104
+    </Reference>
105
+    <Reference Include="Interop.AcroPDFLib">
106
+      <HintPath>..\Common\dlls\TQLFinalDLL\Interop.AcroPDFLib.dll</HintPath>
107
+      <EmbedInteropTypes>True</EmbedInteropTypes>
108
+    </Reference>
109
+    <Reference Include="itextsharp, Version=5.5.13.2, Culture=neutral, PublicKeyToken=8354ae6d2174ddca, processorArchitecture=MSIL">
110
+      <HintPath>..\packages\iTextSharp.5.5.13.2\lib\itextsharp.dll</HintPath>
80 111
     </Reference>
81 112
     <Reference Include="log4net">
82 113
       <HintPath>..\Common\dlls\log4net.dll</HintPath>
@@ -89,6 +120,12 @@
89 120
       <SpecificVersion>False</SpecificVersion>
90 121
       <HintPath>..\Common\dlls\RobotpenGateway.dll</HintPath>
91 122
     </Reference>
123
+    <Reference Include="Spire.License, Version=1.3.8.40, Culture=neutral, PublicKeyToken=b1144360237c8b3f, processorArchitecture=MSIL">
124
+      <HintPath>..\packages\FreeSpire.PDF.7.2.0\lib\net40\Spire.License.dll</HintPath>
125
+    </Reference>
126
+    <Reference Include="Spire.Pdf, Version=7.2.6.0, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
127
+      <HintPath>..\packages\FreeSpire.PDF.7.2.0\lib\net40\Spire.Pdf.dll</HintPath>
128
+    </Reference>
92 129
     <Reference Include="System" />
93 130
     <Reference Include="System.Configuration" />
94 131
     <Reference Include="System.Data" />
@@ -105,6 +142,9 @@
105 142
     <Reference Include="System.Xaml">
106 143
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
107 144
     </Reference>
145
+    <Reference Include="TmatrixLibrary_OID4">
146
+      <HintPath>..\Common\dlls\TQLFinalDLL\TmatrixLibrary_OID4.dll</HintPath>
147
+    </Reference>
108 148
     <Reference Include="TQLComm, Version=3.0.6.0, Culture=neutral, processorArchitecture=x86">
109 149
       <SpecificVersion>False</SpecificVersion>
110 150
       <HintPath>..\Common\dlls\TQLComm.dll</HintPath>
@@ -143,6 +183,7 @@
143 183
     <Compile Include="CountdownWindow.xaml.cs">
144 184
       <DependentUpon>CountdownWindow.xaml</DependentUpon>
145 185
     </Compile>
186
+    <Compile Include="DAL\DAL_TmatrixCode.cs" />
146 187
     <Compile Include="DAL\DAL_Upload.cs" />
147 188
     <Compile Include="DAL\Interface.cs" />
148 189
     <Compile Include="DAL\ResultVo.cs" />
@@ -181,6 +222,9 @@
181 222
     <Compile Include="PracticeWindow.xaml.cs">
182 223
       <DependentUpon>PracticeWindow.xaml</DependentUpon>
183 224
     </Compile>
225
+    <Compile Include="PrintWindowTStudy.xaml.cs">
226
+      <DependentUpon>PrintWindowTStudy.xaml</DependentUpon>
227
+    </Compile>
184 228
     <Compile Include="PrintWindow.xaml.cs">
185 229
       <DependentUpon>PrintWindow.xaml</DependentUpon>
186 230
     </Compile>
@@ -245,6 +289,10 @@
245 289
       <SubType>Designer</SubType>
246 290
       <Generator>MSBuild:Compile</Generator>
247 291
     </Page>
292
+    <Page Include="PrintWindowTStudy.xaml">
293
+      <Generator>MSBuild:Compile</Generator>
294
+      <SubType>Designer</SubType>
295
+    </Page>
248 296
     <Page Include="PrintWindow.xaml">
249 297
       <SubType>Designer</SubType>
250 298
       <Generator>MSBuild:Compile</Generator>
@@ -310,6 +358,9 @@
310 358
     <EmbeddedResource Include="ffmpegx64.zip">
311 359
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
312 360
     </EmbeddedResource>
361
+    <EmbeddedResource Include="LatticeXML\S0_O000_B0000_P000-255.tmx">
362
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
363
+    </EmbeddedResource>
313 364
     <None Include="packages.config" />
314 365
     <EmbeddedResource Include="PrintTool\data\compress\compress.ps">
315 366
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -1637,7 +1688,18 @@
1637 1688
     <Resource Include="Images\countdown1_6.png" />
1638 1689
     <Resource Include="Images\countdown1_7.png" />
1639 1690
   </ItemGroup>
1640
-  <ItemGroup />
1691
+  <ItemGroup>
1692
+    <BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
1693
+      <Visible>False</Visible>
1694
+      <ProductName>Microsoft .NET Framework 4.5.2 %28x86 和 x64%29</ProductName>
1695
+      <Install>true</Install>
1696
+    </BootstrapperPackage>
1697
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
1698
+      <Visible>False</Visible>
1699
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
1700
+      <Install>false</Install>
1701
+    </BootstrapperPackage>
1702
+  </ItemGroup>
1641 1703
   <ItemGroup>
1642 1704
     <EmbeddedResource Include="SSCR\Setup Screen Capturer Recorder v0.12.10.exe">
1643 1705
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 3
- 1
XHWK.WKTool/packages.config Datei anzeigen

@@ -9,7 +9,9 @@
9 9
   <package id="Aspose.PDF" version="19.1.0" targetFramework="net452" />
10 10
   <package id="Aspose.Slides.NET" version="19.10.0" targetFramework="net452" />
11 11
   <package id="Aspose.Words" version="19.1.0" targetFramework="net452" />
12
-  <package id="iTextSharp" version="5.5.13.1" targetFramework="net452" />
12
+  <package id="BouncyCastle" version="1.8.6.1" targetFramework="net452" />
13
+  <package id="FreeSpire.PDF" version="7.2.0" targetFramework="net452" />
14
+  <package id="iTextSharp" version="5.5.13.2" targetFramework="net452" />
13 15
   <package id="System.Management" version="4.7.0" targetFramework="net452" />
14 16
   <package id="WpfAnimatedGif" version="2.0.0" targetFramework="net452" />
15 17
 </packages>

Laden…
Abbrechen
Speichern