├── PrintTools ├── PrintTools │ ├── Install │ │ └── SoftDetails.txt │ ├── Images │ │ ├── icon.ico │ │ └── logo.jpg │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── App.xaml │ ├── App.xaml.cs │ ├── PrintPreWindow.xaml │ ├── packages.config │ ├── App.config │ ├── xml │ │ └── MenuRemarkName.xml │ ├── Entity │ │ ├── DepartMentInfo.cs │ │ └── PrintTxtValue.cs │ ├── PrintTool │ │ └── IDocumentRender.cs │ ├── Common │ │ ├── Common.cs │ │ ├── ApiDateTime.cs │ │ └── NetworkDateTime.cs │ ├── PrintPreWindow.xaml.cs │ ├── ReadXML │ │ └── ReadXml.cs │ ├── MainWindow.xaml.cs │ ├── PrintTools.csproj │ ├── PrintTemplete │ │ ├── GoWorkPrintTemplate.xaml │ │ └── LeavePrintTemplate.xaml │ └── MainWindow.xaml ├── packages │ ├── Microsoft.Net.Http.2.0.20710.0 │ │ ├── lib │ │ │ ├── net45 │ │ │ │ └── _._ │ │ │ └── net40 │ │ │ │ ├── System.Net.Http.dll │ │ │ │ ├── System.Net.Http.WebRequest.dll │ │ │ │ └── System.Net.Http.WebRequest.xml │ │ ├── Microsoft.Net.Http.2.0.20710.0.nupkg │ │ └── Microsoft.Net.Http.2.0.20710.0.nuspec │ ├── repositories.config │ ├── Newtonsoft.Json.4.5.11 │ │ ├── Newtonsoft.Json.4.5.11.nupkg │ │ ├── lib │ │ │ ├── net20 │ │ │ │ └── Newtonsoft.Json.dll │ │ │ ├── net35 │ │ │ │ └── Newtonsoft.Json.dll │ │ │ ├── net40 │ │ │ │ └── Newtonsoft.Json.dll │ │ │ ├── sl4 │ │ │ │ └── Newtonsoft.Json.dll │ │ │ ├── sl3-wp │ │ │ │ └── Newtonsoft.Json.dll │ │ │ ├── winrt45 │ │ │ │ └── Newtonsoft.Json.dll │ │ │ ├── sl4-windowsphone71 │ │ │ │ └── Newtonsoft.Json.dll │ │ │ └── portable-net40+sl4+wp7+win8 │ │ │ │ └── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.4.5.11.nuspec │ ├── Microsoft.AspNet.WebApi.Client.4.0.30506.0 │ │ ├── lib │ │ │ └── net40 │ │ │ │ └── System.Net.Http.Formatting.dll │ │ ├── Microsoft.AspNet.WebApi.Client.4.0.30506.0.nupkg │ │ └── Microsoft.AspNet.WebApi.Client.4.0.30506.0.nuspec │ └── WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0 │ │ ├── WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0.nupkg │ │ ├── lib │ │ └── net40 │ │ │ └── WebApiContrib.Formatting.JavaScriptSerializer.dll │ │ └── WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0.nuspec └── PrintTools.sln ├── .gitignore └── README.md /PrintTools/PrintTools/Install/SoftDetails.txt: -------------------------------------------------------------------------------- 1 | 1.打印小工具说明 2 | (1): -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/lib/net45/_._: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/Images/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/PrintTools/Images/icon.ico -------------------------------------------------------------------------------- /PrintTools/PrintTools/Images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/PrintTools/Images/logo.jpg -------------------------------------------------------------------------------- /PrintTools/packages/repositories.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nupkg -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/lib/net40/System.Net.Http.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/lib/net40/System.Net.Http.dll -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/Microsoft.Net.Http.2.0.20710.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/Microsoft.Net.Http.2.0.20710.0.nupkg -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/lib/net40/System.Net.Http.WebRequest.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/lib/net40/System.Net.Http.WebRequest.dll -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.AspNet.WebApi.Client.4.0.30506.0/lib/net40/System.Net.Http.Formatting.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Microsoft.AspNet.WebApi.Client.4.0.30506.0/lib/net40/System.Net.Http.Formatting.dll -------------------------------------------------------------------------------- /PrintTools/PrintTools/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.AspNet.WebApi.Client.4.0.30506.0/Microsoft.AspNet.WebApi.Client.4.0.30506.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/Microsoft.AspNet.WebApi.Client.4.0.30506.0/Microsoft.AspNet.WebApi.Client.4.0.30506.0.nupkg -------------------------------------------------------------------------------- /PrintTools/packages/WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0/WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0/WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0.nupkg -------------------------------------------------------------------------------- /PrintTools/packages/WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0/lib/net40/WebApiContrib.Formatting.JavaScriptSerializer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kencery/PrintTools/HEAD/PrintTools/packages/WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0/lib/net40/WebApiContrib.Formatting.JavaScriptSerializer.dll -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Thumbs.db 2 | *.obj 3 | *.exe 4 | *.pdb 5 | *.user 6 | *.aps 7 | *.pch 8 | *.vspscc 9 | *_i.c 10 | *_p.c 11 | *.ncb 12 | *.suo 13 | *.sln.docstates 14 | *.tlb 15 | *.tlh 16 | *.bak 17 | *.cache 18 | *.ilk 19 | *.log 20 | [Bb]in 21 | [Dd]ebug*/ 22 | *.lib 23 | *.sbr 24 | obj/ 25 | [Rr]elease*/ 26 | _ReSharper*/ 27 | [Tt]est[Rr]esult* 28 | *.suo 29 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 打印小工具的简单说明 2 | 1. 基于VS2013开发,打印基于XPS开发 3 | 2. WinXP/7/8/10安装环境基于.NET FrameWork V4.0,也就是打印小工具系统需要运行必须安装.NET FrameWork V4.0 4 | 3. 软件安装包在项目根目录下面的Install文件夹中,说明文件(SoftDetails.txt)也在此文件夹下 5 | 4. 开源说明:本项目开源,大家可以下载二次开发或者使用 6 | 5. 版权所有:该软件归开发者本人(Kencery 韩迎龙)所有,如需二次开发或者使用请备注开发者说明 7 | 6. 吃水不忘挖井人 8 | 7. 作者联系方式:18658152123,QQ技术群:159227188,QQ号:934532778,邮箱:hyl934532778@live.cn 9 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace PrintTools 10 | { 11 | /// 12 | /// App.xaml 的交互逻辑 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/PrintPreWindow.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/xml/MenuRemarkName.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 打印小工具 4 | 请假条 5 | 出工单 6 | 甘肃联众建筑设计有限责任公司 7 | 建筑室,结构室,设备室,后勤 8 | 备注:1.请假人员交送请假条时应监督办公室填写接收时间。 9 | 2.事假、丧假领导签字日期可在请假截止日期之后,但相差不得超过2个工作日,否则视为无效。 10 | 3.请假批准日期与接收时间相差不得超过3个工作日,否则视为无效。 11 | 4.请相关人员完整填写请假条,签字请并注明详细时间。 12 | 13 | 备注:1.出工人员交送出工单时应监督办公室填写接收时间。 14 | 2.派遣人签字日期与出工截止时间不得相差2个工作日,否则视为无效。 15 | 3.接收时间与派遣人签字时间不得相差3个工作日,否则视为无效。 16 | 4.请相关人员详细填写出工单,并注明详细时间。 17 | 18 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/Entity/DepartMentInfo.cs: -------------------------------------------------------------------------------- 1 | // 源文件头信息: 2 | // 3 | // Copyright(c)2014-2034 Kencery.All rights reserved. 4 | // 个人博客:http://www.cnblogs.com/hanyinglong 5 | // 创建人:韩迎龙(kencery) 6 | // 创建时间:2015-7-28 7 | // 8 | namespace PrintTools 9 | { 10 | /// 11 | /// 功能:返回部门所用值 12 | /// 修改记录:时间 内容 姓名 13 | /// 14 | public class DepartMentInfo 15 | { 16 | /// 17 | /// 部门Id 18 | /// 19 | public int Id { get; set; } 20 | 21 | /// 22 | /// 部门名称 23 | /// 24 | public string Name { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /PrintTools/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Newtonsoft.Json 5 | 4.5.11 6 | Json.NET 7 | James Newton-King 8 | James Newton-King 9 | http://json.codeplex.com/license 10 | http://james.newtonking.com/projects/json-net.aspx 11 | false 12 | Json.NET is a popular high-performance JSON framework for .NET 13 | en-US 14 | json 15 | 16 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/PrintTool/IDocumentRender.cs: -------------------------------------------------------------------------------- 1 | // 源文件头信息: 2 | // 3 | // Copyright(c)2014-2034 Kencery.All rights reserved. 4 | // 个人博客:http://www.cnblogs.com/hanyinglong 5 | // 创建人:韩迎龙(kencery) 6 | // 创建时间:2015/05/08 7 | // 8 | 9 | using System; 10 | using System.Windows.Documents; 11 | 12 | namespace PrintTools 13 | { 14 | /// 15 | /// 功能:声明接口,定义接口初始化 16 | /// 修改记录:时间 内容 姓名 17 | /// 1. 18 | /// 19 | public interface IDocumentRender 20 | { 21 | /// 22 | /// 调用方法 23 | /// 24 | /// 承载流内容和设置流内容格式 25 | /// 传递需要转换流文件的信息 26 | void Render(FlowDocument flowDocument, Object data); 27 | } 28 | } -------------------------------------------------------------------------------- /PrintTools/PrintTools.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintTools", "PrintTools\PrintTools.csproj", "{20FC05BF-D9B4-4232-BD92-56499DBB0208}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {20FC05BF-D9B4-4232-BD92-56499DBB0208}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {20FC05BF-D9B4-4232-BD92-56499DBB0208}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {20FC05BF-D9B4-4232-BD92-56499DBB0208}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {20FC05BF-D9B4-4232-BD92-56499DBB0208}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/Common/Common.cs: -------------------------------------------------------------------------------- 1 | // 源文件头信息: 2 | // 3 | // Copyright(c)2014-2034 Kencery.All rights reserved. 4 | // 个人博客:http://www.cnblogs.com/hanyinglong 5 | // 创建人:韩迎龙(kencery) 6 | // 创建时间:2015-7-28 7 | // 8 | 9 | using System; 10 | using System.Collections.Generic; 11 | 12 | namespace PrintTools 13 | { 14 | /// 15 | /// 功能:页面填写之后进行返回需要用到的值 16 | /// 修改记录:时间 内容 姓名 17 | /// 18 | public static class Common 19 | { 20 | /// 21 | /// 将按照split分割的字符串转换成List数组 22 | /// 23 | public static List ToListInfo(this string str, char split, Converter converHandler) 24 | { 25 | if (string.IsNullOrEmpty(str)) 26 | { 27 | return new List(); 28 | } 29 | //进行转换 30 | string[] arrStr = str.Split(split); 31 | //将一种类型的数组转换为另一种类型的数组。 32 | T[] tarrStr = Array.ConvertAll(arrStr, converHandler); 33 | return new List(tarrStr); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.AspNet.WebApi.Client.4.0.30506.0/Microsoft.AspNet.WebApi.Client.4.0.30506.0.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.AspNet.WebApi.Client 5 | 4.0.30506.0 6 | Microsoft ASP.NET Web API Client Libraries 7 | Microsoft 8 | Microsoft 9 | http://www.microsoft.com/web/webpi/eula/mvc_4_eula_enu.htm 10 | http://www.asp.net/web-api 11 | true 12 | This package adds support for formatting and content negotiation to System.Net.Http. It includes support for JSON, XML, and form URL encoded data. 13 | en-US 14 | Microsoft AspNet WebApi AspNetWebApi HttpClient 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/Microsoft.Net.Http.2.0.20710.0.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.Net.Http 5 | 2.0.20710.0 6 | Microsoft .NET Framework 4 HTTP Client Libraries 7 | Microsoft 8 | Microsoft 9 | http://www.microsoft.com/web/webpi/eula/MVC_4_eula_ENU.htm 10 | http://www.asp.net/web-api 11 | true 12 | This package provides a programming interface for modern HTTP applications. This package includes HttpClient for sending requests over HTTP, as well as HttpRequestMessage and HttpResponseMessage for processing HTTP messages. 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace PrintTools.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /PrintTools/packages/WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0/WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WebApiContrib.Formatting.JavaScriptSerializer 5 | 0.9.4.0 6 | WebApiContrib.Formatting.JavaScriptSerializer 7 | WebApiContrib Contributors 8 | WebApiContrib Contributors 9 | https://raw.github.com/WebApiContrib/WebApiContrib.Formatting.JavaScriptSerializer/master/LICENSE.txt 10 | https://github.com/WebApiContrib/WebApiContrib.Formatting.JavaScriptSerializer 11 | https://2.gravatar.com/avatar/f1ad1241dfb26dcb97abfeb8375a5971?s=128 12 | false 13 | Description 14 | Copyright © WebApiContrib 2012 - 2013 15 | webapi webapicontrib javascriptserializer 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // 有关程序集的常规信息通过以下 8 | // 特性集控制。更改这些特性值可修改 9 | // 与程序集关联的信息。 10 | [assembly: AssemblyTitle("PrintTools")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("PrintTools")] 15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // 将 ComVisible 设置为 false 使此程序集中的类型 20 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 21 | // 则将该类型上的 ComVisible 特性设置为 true。 22 | [assembly: ComVisible(false)] 23 | 24 | //若要开始生成可本地化的应用程序,请在 25 | // 中的 .csproj 文件中 26 | //设置 CultureYouAreCodingWith。 例如,如果您在源文件中 27 | //使用的是美国英语,请将 设置为 en-US。 然后取消 28 | //对以下 NeutralResourceLanguage 特性的注释。 更新 29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置 36 | //(在页面或应用程序资源词典中 37 | // 未找到某个资源的情况下使用) 38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 39 | //(在页面、应用程序或任何主题特定资源词典中 40 | // 未找到某个资源的情况下使用) 41 | )] 42 | 43 | 44 | // 程序集的版本信息由下面四个值组成: 45 | // 46 | // 主版本 47 | // 次版本 48 | // 生成号 49 | // 修订号 50 | // 51 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 52 | // 方法是按如下所示使用“*”: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/Common/ApiDateTime.cs: -------------------------------------------------------------------------------- 1 | // 源文件头信息: 2 | // 3 | // Copyright(c)2014-2034 Kencery.All rights reserved. 4 | // 个人博客:http://www.cnblogs.com/hanyinglong 5 | // 创建人:韩迎龙(kencery) 6 | // 创建时间:2015/06/03 7 | // 8 | 9 | 10 | namespace PrintTools 11 | { 12 | /// 13 | /// 进行转换API中读取到的Json信息 14 | /// 15 | public class ApiDateTime 16 | { 17 | /// 18 | /// 调用API返回是否成功的标志 19 | /// 20 | public string success { get; set; } 21 | 22 | /// 23 | /// 时间详细信息 24 | /// 25 | public DetailInfo result { get; set; } 26 | } 27 | 28 | /// 29 | /// 读取调用API之后返回的所有的详细信息 30 | /// 31 | public class DetailInfo 32 | { 33 | /// 34 | /// 时间签 35 | /// 36 | public string timestamp { get; set; } 37 | 38 | /// 39 | /// 时间,格式:2015-06-03 22:25:51 40 | /// 41 | public string datetime_1 { get; set; } 42 | 43 | /// 44 | /// 时间,格式:2015年06月03日 22时25分51秒 45 | /// 46 | public string datetime_2 { get; set; } 47 | 48 | /// 49 | /// 星期,格式:3 50 | /// 51 | public string week_1 { get; set; } 52 | 53 | /// 54 | /// 星期,格式:星期三 55 | /// 56 | public string week_2 { get; set; } 57 | 58 | /// 59 | /// 星期,格式:周三 60 | /// 61 | public string week_3 { get; set; } 62 | 63 | /// 64 | /// 星期,格式:Tuesday 65 | /// 66 | public string week_4 { get; set; } 67 | } 68 | } -------------------------------------------------------------------------------- /PrintTools/PrintTools/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本: 4.0.30319.18408 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace PrintTools.Properties 12 | { 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// 返回此类使用的、缓存的 ResourceManager 实例。 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrintTools.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// 为所有资源查找重写当前线程的 CurrentUICulture 属性, 56 | /// 方法是使用此强类型资源类。 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/Entity/PrintTxtValue.cs: -------------------------------------------------------------------------------- 1 | // 源文件头信息: 2 | // 3 | // Copyright(c)2014-2034 Kencery.All rights reserved. 4 | // 个人博客:http://www.cnblogs.com/hanyinglong 5 | // 创建人:韩迎龙(kencery) 6 | // 创建时间:2015/05/08 7 | // 8 | 9 | namespace PrintTools 10 | { 11 | /// 12 | /// 功能:页面填写之后进行返回需要用到的值 13 | /// 修改记录:时间 内容 姓名 14 | /// 15 | public class PrintTxtValue 16 | { 17 | /// 18 | /// 请假人名称 19 | /// 20 | public string UserName { get; set; } 21 | 22 | /// 23 | /// 部门 24 | /// 25 | public string DepartMent { get; set; } 26 | 27 | /// 28 | /// 事假 29 | /// 30 | public bool? ThingHoliday { get; set; } 31 | 32 | /// 33 | /// 丧事 34 | /// 35 | public bool? LoseHoliday { get; set; } 36 | 37 | /// 38 | /// //婚事 39 | /// 40 | public bool? WedHoliday { get; set; } 41 | 42 | /// 43 | /// 产假 44 | /// 45 | public bool? LeaveHoliday { get; set; } 46 | 47 | /// 48 | /// 病假 49 | /// 50 | public bool? FailHoliday { get; set; } 51 | 52 | /// 53 | /// 年休假 54 | /// 55 | public bool? YearHoliday { get; set; } 56 | 57 | /// 58 | /// 请假时间(小时,天数) 59 | /// 60 | public string LeaveDateTime { get; set; } 61 | 62 | /// 63 | /// 起止日期 64 | /// 65 | public string StartTime { get; set; } 66 | 67 | /// 68 | /// 主管意见 69 | /// 70 | public string BeInChangeIdea { get; set; } 71 | 72 | /// 73 | /// 公司领导意见 74 | /// 75 | public string LeadIdea { get; set; } 76 | 77 | /// 78 | /// 主管意见签字 79 | /// 80 | public string BeInChangeIdeaSign { get; set; } 81 | 82 | /// 83 | /// 公司领导签字 84 | /// 85 | public string LeadIdeaSign { get; set; } 86 | 87 | 88 | //V1.0需要返回到前段的信息------------------------------------ 89 | /// 90 | /// 打印时间—读取XML 91 | /// 92 | public string PrintDateTime { get; set; } 93 | 94 | /// 95 | /// 标题(请假条,出工单)—读取XML 96 | /// 97 | public string Title { get; set; } 98 | 99 | /// 100 | /// 公司名称 101 | /// 102 | public string CompanyName { get; set; } 103 | 104 | /// 105 | /// 公司备注 106 | /// 107 | public string Remark { get; set; } 108 | } 109 | } -------------------------------------------------------------------------------- /PrintTools/PrintTools/PrintPreWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.IO.Packaging; 4 | using System.Windows; 5 | using System.Windows.Documents; 6 | using System.Windows.Threading; 7 | using System.Windows.Xps; 8 | using System.Windows.Xps.Packaging; 9 | 10 | namespace PrintTools 11 | { 12 | /// 13 | /// 封装打印预览和直接打印的底层实现类 14 | /// 15 | partial class PrintPreWindow 16 | { 17 | /// 18 | /// WPF使用委托加载XPS打印对象 19 | /// 20 | private delegate void LoadXpsMethod(); 21 | 22 | /// 23 | /// 传递需要打印的数据集合 24 | /// 25 | private readonly Object _objectData; 26 | 27 | /// 28 | /// WPF XPS .NET底层封装的需要打印的内容 29 | /// 30 | private readonly FlowDocument _flowDocument; 31 | 32 | /// 33 | /// 构造初始化对象 34 | /// 35 | public PrintPreWindow(string strTemlName, Object data, IDocumentRender render = null) 36 | { 37 | InitializeComponent(); 38 | //初始化的时候调用对象 39 | _objectData = data; 40 | _flowDocument = LoadDocumentAndRender(strTemlName, data, render); 41 | Dispatcher.BeginInvoke(new LoadXpsMethod(LoadXps), DispatcherPriority.ApplicationIdle); 42 | } 43 | 44 | /// 45 | /// 提供给需要打印预览和打印按钮调用的方法 46 | /// 47 | /// 打印模板的路径 48 | /// 需要打印的内容 49 | /// 实现打印的模板赋值文件 50 | public static FlowDocument LoadDocumentAndRender(string strTemlName, object data, 51 | IDocumentRender documentRender = null) 52 | { 53 | var flowDocument = 54 | (FlowDocument) Application.LoadComponent(new Uri(strTemlName, UriKind.RelativeOrAbsolute)); 55 | flowDocument.PagePadding = new Thickness(); 56 | flowDocument.DataContext = data; 57 | if (documentRender != null) 58 | { 59 | documentRender.Render(flowDocument, data); 60 | } 61 | return flowDocument; 62 | } 63 | 64 | /// 65 | /// 执行异步委托,使用内存流 66 | /// 67 | public void LoadXps() 68 | { 69 | //构造一个基于内存的XPS Document 70 | var memoryStream = new MemoryStream(); 71 | Package package = Package.Open(memoryStream, FileMode.Create, FileAccess.ReadWrite); 72 | var uri = new Uri("pack://InMemoryDocument.xps"); 73 | PackageStore.RemovePackage(uri); 74 | PackageStore.AddPackage(uri, package); 75 | var xpsDocument = new XpsDocument(package, CompressionOption.Fast, uri.AbsoluteUri); 76 | //将FlowDocument写入基于内存的XPSDocument中去 77 | XpsDocumentWriter xpsDocumentWriter = XpsDocument.CreateXpsDocumentWriter(xpsDocument); 78 | xpsDocumentWriter.Write(((IDocumentPaginatorSource) _flowDocument).DocumentPaginator); 79 | //获取这个基于内存的XPSDocument的FixedDocument 80 | DocumentViewer.Document = xpsDocument.GetFixedDocumentSequence(); 81 | //关闭基于内存的XPSDocument,释放资源 82 | xpsDocument.Close(); 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /PrintTools/PrintTools/Common/NetworkDateTime.cs: -------------------------------------------------------------------------------- 1 | // 源文件头信息: 2 | // 3 | // Copyright(c)2014-2034 Kencery.All rights reserved. 4 | // 个人博客:http://www.cnblogs.com/hanyinglong 5 | // 创建人:韩迎龙(kencery) 6 | // 创建时间:2015/06/03 7 | // 8 | 9 | using System; 10 | using System.Configuration; 11 | using System.Net; 12 | using System.Text; 13 | using System.Web.Script.Serialization; 14 | 15 | namespace PrintTools 16 | { 17 | /// 18 | /// 功能:读取线上接口中的当前时间,C# WebClient函数实现,组装调用的路径为: 19 | /// http://api.k780.com:88/?app=life.time&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json 20 | /// 修改记录:时间 内容 姓名 21 | /// 1. 22 | /// 23 | public static class NetworkDateTime 24 | { 25 | /// 26 | /// 读取Web.Config—URL地址 27 | /// 28 | public static string Url { get; set; } 29 | 30 | /// 31 | /// 读取Web.Config—App 32 | /// 33 | public static string App { get; set; } 34 | 35 | /// 36 | /// 读取Web.Config—Appkey 37 | /// 38 | public static string Appkey { get; set; } 39 | 40 | /// 41 | /// 读取Web.Config—Sign 42 | /// 43 | public static string Sign { get; set; } 44 | 45 | /// 46 | /// 读取Web.Config—Format 47 | /// 48 | public static string Format { get; set; } 49 | 50 | /// 51 | /// 初始化网址信息,读取app.Config中的信息组装Api接口 52 | /// 53 | static NetworkDateTime() 54 | { 55 | Url = ReadWebConfig("url"); 56 | App = ReadWebConfig("app"); 57 | Appkey = ReadWebConfig("appkey"); 58 | Sign = ReadWebConfig("sign"); 59 | Format = ReadWebConfig("format"); 60 | } 61 | 62 | /// 63 | /// 调用WebClient读取API中的JSON串解析出系统中的时间 64 | /// 65 | public static DateTime CurrentDateTime() 66 | { 67 | //构造访问路径,路径如下: 68 | //http://api.k780.com:88/?app=life.time&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json 69 | 70 | DateTime dateTime; 71 | using (var client = CreateAPiWebClient()) 72 | { 73 | try 74 | { 75 | var url = string.Format("{0}?app={1}&appkey={2}&sign={3}&format={4}", Url, App, Appkey, Sign, Format); 76 | string result = client.DownloadString(url); 77 | //获取到string字符串之后将string字符串解析成Json串 78 | var apiDateTimeJson = Deseriallize(result); 79 | dateTime = apiDateTimeJson.success == "1" 80 | ? DateTime.Parse(apiDateTimeJson.result.datetime_1) 81 | : DateTime.Now; 82 | } 83 | catch 84 | { 85 | dateTime = DateTime.Now; 86 | } 87 | } 88 | return dateTime; 89 | } 90 | 91 | /// 92 | /// 将字符串转换为Json对象 93 | /// 94 | /// 转换的对象 95 | /// 字符串信息 96 | public static T Deseriallize(string strData) 97 | { 98 | var javaScriptSerializer = new JavaScriptSerializer(); 99 | return javaScriptSerializer.Deserialize(strData); 100 | } 101 | 102 | /// 103 | /// 使用WebClient调用API 104 | /// 105 | public static WebClient CreateAPiWebClient() 106 | { 107 | var client = new WebClient(); 108 | client.Headers["Content-type"] = "application/json"; 109 | client.Encoding = Encoding.UTF8; 110 | return client; 111 | } 112 | 113 | /// 114 | /// 读取Web.Config中的信息,传递key信息读取出来value信息 115 | /// 116 | /// key 117 | public static string ReadWebConfig(string key) 118 | { 119 | return ConfigurationManager.AppSettings[key]; 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /PrintTools/PrintTools/ReadXML/ReadXml.cs: -------------------------------------------------------------------------------- 1 | // 源文件头信息: 2 | // 3 | // Copyright(c)2014-2034 Kencery.All rights reserved. 4 | // 个人博客:http://www.cnblogs.com/hanyinglong 5 | // 创建人:韩迎龙(kencery) 6 | // 创建时间:2015/05/06 7 | // 8 | 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Windows.Data; 12 | using System.Xml; 13 | 14 | namespace PrintTools 15 | { 16 | public class RadioButtonConverter : IValueConverter 17 | { 18 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 19 | { 20 | if (value is bool) 21 | { 22 | return !(bool)value; 23 | } 24 | return value; 25 | } 26 | 27 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 28 | { 29 | if (value is bool) 30 | { 31 | return !(bool)value; 32 | } 33 | return value; 34 | } 35 | } 36 | 37 | /// 38 | /// 功能:实现读取系统名称和各种类型以修改及备注信息(方便用户,不需要写死,如果为空也可以,系统会填写默认值)(请假单,出工单) 39 | /// 修改记录:时间 内容 姓名 40 | /// 1. 41 | /// 42 | public static class ReadXml 43 | { 44 | //存放XML地址 45 | public static string PathXMl { get; set; } 46 | 47 | /// 48 | /// 初始化地址信息,将XML的地址存放在PathXML中 49 | /// 50 | static ReadXml() 51 | { 52 | PathXMl = @"..\..\xml\MenuRemarkName.xml"; 53 | } 54 | 55 | /// 56 | /// 从XML中读取小工具的名称 57 | /// 58 | public static Dictionary ReadXmlTitle() 59 | { 60 | //第一步:定义Dictionary泛型存放页面公用的内容,Dictionary的键不能相同 61 | var dictionary = new Dictionary(); 62 | 63 | //第二步:读取XML文件 64 | var xmlDocument = new XmlDocument(); 65 | xmlDocument.Load(PathXMl); 66 | 67 | //第三步:解析XML内容,读取XML集合进行foreach集合整理 68 | var xmlElement = xmlDocument.DocumentElement; //获取跟节点信息 69 | if (xmlElement == null) 70 | { 71 | return dictionary; 72 | } 73 | XmlNodeList xmlNodeLists = xmlElement.ChildNodes; 74 | //第四步:给Dictionary赋值进行返回 75 | foreach (XmlElement xmlNodeList in xmlNodeLists) 76 | { 77 | dictionary.Add(xmlNodeList.Name, xmlNodeList.InnerText); 78 | } 79 | return dictionary; 80 | } 81 | 82 | /// 83 | /// 读取XML文件中的信息,传递到前台进行绑定—请假条 84 | /// 85 | public static PrintTxtValue GetLeavePrintTxtValue(string departmentText, bool? thingHoliday, bool? loseHoliday, 86 | bool? wedHoliday, bool? leaveHoliday, bool? failHoliday, bool? yearHoliday) 87 | { 88 | //调用方法,读取XML 89 | var indexDic = ReadXml.ReadXmlTitle(); 90 | //构造需要显示到前端的信息 91 | var printTxtValue = new PrintTxtValue 92 | { 93 | PrintDateTime = NetworkDateTime.CurrentDateTime().ToString("yyyy-MM-dd HH:mm"), 94 | Title = string.IsNullOrEmpty(indexDic["leave"]) ? "请假条" : indexDic["leave"], 95 | CompanyName = string.IsNullOrEmpty(indexDic["companyName"]) ? "甘肃联众建筑设计有限责任公司" : indexDic["companyName"], 96 | Remark = string.IsNullOrEmpty(indexDic["leaveRemak"]) ? "暂无备注" : indexDic["leaveRemak"], 97 | DepartMent = departmentText, 98 | ThingHoliday = thingHoliday, 99 | LoseHoliday = loseHoliday, 100 | WedHoliday = wedHoliday, 101 | LeaveHoliday = leaveHoliday, 102 | FailHoliday = failHoliday, 103 | YearHoliday = yearHoliday 104 | }; 105 | return printTxtValue; 106 | } 107 | 108 | /// 109 | /// 读取XML文件中的信息,传递到前台进行绑定—出工单 110 | /// 111 | public static PrintTxtValue GetGoWorkPrintTxtValue() 112 | { 113 | //调用方法,读取XML 114 | var indexDic = ReadXml.ReadXmlTitle(); 115 | //构造前段需要显示的信息 116 | var printTxtValue = new PrintTxtValue 117 | { 118 | PrintDateTime = NetworkDateTime.CurrentDateTime().ToString("yyyy-MM-dd HH:mm"), 119 | Title = string.IsNullOrEmpty(indexDic["goWork"]) ? "出工单" : indexDic["goWork"], 120 | CompanyName = string.IsNullOrEmpty(indexDic["companyName"]) ? "甘肃联众建筑设计有限责任公司" : indexDic["companyName"], 121 | Remark = string.IsNullOrEmpty(indexDic["goWorkRemrk"]) ? "暂无备注" : indexDic["goWorkRemrk"] 122 | }; 123 | return printTxtValue; 124 | } 125 | } 126 | } -------------------------------------------------------------------------------- /PrintTools/packages/Microsoft.Net.Http.2.0.20710.0/lib/net40/System.Net.Http.WebRequest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.Net.Http.WebRequest 5 | 6 | 7 | 8 | Represents the class that is used to create special for use with the Real-Time-Communications (RTC) background notification infrastructure. 9 | 10 | 11 | Creates a special for use with the Real-Time-Communications (RTC) background notification infrastructure. 12 | Returns .An HTTP request message for use with the RTC background notification infrastructure. 13 | The HTTP method. 14 | The Uri the request is sent to. 15 | 16 | 17 | Provides desktop-specific features not available to Windows Store apps or other environments. 18 | 19 | 20 | Initializes a new instance of the class. 21 | 22 | 23 | Gets or sets a value that indicates whether to pipeline the request to the Internet resource. 24 | Returns .true if the request should be pipelined; otherwise, false. The default is true. 25 | 26 | 27 | Gets or sets a value indicating the level of authentication and impersonation used for this request. 28 | Returns .A bitwise combination of the values. The default value is . 29 | 30 | 31 | Gets or sets the cache policy for this request. 32 | Returns .A object that defines a cache policy. The default is . 33 | 34 | 35 | Gets or sets the collection of security certificates that are associated with this request. 36 | Returns .The collection of security certificates associated with this request. 37 | 38 | 39 | Gets or sets the amount of time, in milliseconds, the application will wait for 100-continue from the server before uploading data. 40 | Returns .The amount of time, in milliseconds, the application will wait for 100-continue from the server before uploading data. The default value is 350 milliseconds. 41 | 42 | 43 | Gets or sets the impersonation level for the current request. 44 | Returns .The impersonation level for the request. The default is . 45 | 46 | 47 | Gets or sets the maximum allowed length of the response headers. 48 | Returns .The length, in kilobytes (1024 bytes), of the response headers. 49 | 50 | 51 | Gets or sets a time-out in milliseconds when writing a request to or reading a response from a server. 52 | Returns .The number of milliseconds before the writing or reading times out. The default value is 300,000 milliseconds (5 minutes). 53 | 54 | 55 | Gets or sets a callback method to validate the server certificate. 56 | Returns .A callback method to validate the server certificate. 57 | 58 | 59 | Gets or sets a value that indicates whether to allow high-speed NTLM-authenticated connection sharing. 60 | Returns .true to keep the authenticated connection open; otherwise, false. 61 | 62 | 63 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Documents; 8 | using System.Windows.Threading; 9 | 10 | 11 | namespace PrintTools 12 | { 13 | /// 14 | /// 打印主页面的实现,打印主页面和打印出来的纸页面的布局各走各的布局 15 | /// 16 | public partial class MainWindow : Window 17 | { 18 | /// 19 | /// 使用委托传递方法当做参数进行调用打印的方法 20 | /// 21 | private delegate void DoPrintMethod(PrintDialog printDialog, DocumentPaginator documentPaginator); 22 | 23 | /// 24 | /// 定义委托执行将打印完成的控件重新置为可用 25 | /// 26 | private delegate void EnableButtonMethod(); 27 | 28 | /// 29 | /// 定义时间判断打印控件的启用禁用状态 30 | /// 31 | private Timer timer; 32 | 33 | /// 34 | /// 初始化页面首次调用的方法 35 | /// 36 | public MainWindow() 37 | { 38 | InitializeComponent(); 39 | //初始化信息的时候给首页的内容读取XML文件中的信息显示,读取需要显示的内容 40 | var indexDic = ReadXml.ReadXmlTitle(); 41 | 42 | //通用内容整理—打印请假条,出工单 43 | PrintTool.Title = string.IsNullOrEmpty(indexDic["title"]) ? "打印小工具" : indexDic["title"]; //软件名称 44 | LeavePrintDateTime.Text = GoWorkPrintDateTime.Text = "打印时间:" + DateTime.Now.ToString("yyyy-MM-dd"); //打印时间 45 | LevelCompanyName.Text = GoWorkCompanyName.Text = string.IsNullOrEmpty(indexDic["companyName"]) 46 | ? "甘肃联众建筑设计有限责任公司" 47 | : indexDic["companyName"]; //请假单和出工单共用的方法 48 | TabControl.FontSize = 16; //字体大小限制为16px 49 | 50 | //打印—请假条 51 | LeaveTitle.Header = LeaveName.Text = string.IsNullOrEmpty(indexDic["leave"]) ? "请假条" : indexDic["leave"]; 52 | LeveRemark.Text = string.IsNullOrEmpty(indexDic["leaveRemak"]) ? "暂无备注" : indexDic["leaveRemak"]; //打印请假条备注 53 | 54 | //打印—出工单 55 | GoWork.Header = GoWorkName.Text = string.IsNullOrEmpty(indexDic["goWork"]) ? "出工单" : indexDic["goWork"]; 56 | GoWorkRemark.Text = string.IsNullOrEmpty(indexDic["goWorkRemrk"]) ? "暂无备注" : indexDic["goWorkRemrk"]; 57 | string departMent = string.IsNullOrEmpty(indexDic["departMent"]) ? "建筑室,结构室,设备室、后勤" : indexDic["departMent"]; 58 | //读取下拉列表信息 59 | BindDepartMentInfo(departMent); 60 | } 61 | 62 | /// 63 | /// 直接打印请假单的实现,调用模板页直接打印 64 | /// 65 | private void PrintLeave_Click(object sender, RoutedEventArgs e) 66 | { 67 | //初始化打印机状态,使其项目调用打印机接口,弹出框供用户可以随机选择打印的模板 68 | var printDialog = new PrintDialog(); 69 | //首先判断只有窗口未打开才能调用打印驱动 70 | if (printDialog.ShowDialog() != true) 71 | { 72 | return; 73 | } 74 | //获取前台传递的信息 75 | var departmentText = DepartmentBox.Text; 76 | bool? thingHoliday = ThingHoliday.IsChecked; //事假 77 | bool? loseHoliday = LoseHoliday.IsChecked; //丧事 78 | bool? wedHoliday = WedHoliday.IsChecked; //婚事 79 | bool? leaveHoliday = LeaveHoliday.IsChecked; //产假 80 | bool? failHoliday = FailHoliday.IsChecked; //病假 81 | bool? yearHoliday = YearHoliday.IsChecked; //年休假 82 | 83 | //调用方法实现前台读取XML 84 | var printTxtValue = ReadXml.GetLeavePrintTxtValue(departmentText, thingHoliday, loseHoliday, wedHoliday, 85 | leaveHoliday, failHoliday, yearHoliday); 86 | 87 | FlowDocument flowDocument = 88 | PrintPreWindow.LoadDocumentAndRender(@"PrintTemplete/LeavePrintTemplate.xaml", printTxtValue); 89 | Dispatcher.BeginInvoke(new DoPrintMethod(DoPrint), DispatcherPriority.ApplicationIdle, printDialog, 90 | ((IDocumentPaginatorSource) flowDocument).DocumentPaginator); 91 | 92 | #region---------------------直接打印实现,但是需要安装OneNote或者驱动-------------------------- 93 | 94 | //PrintLeave.IsEnabled = false; //当单击之后将按钮置为非启用状态 95 | ////初始化打印机状态,使其项目调用打印机接口 96 | //var printDialog = new PrintDialog(); 97 | //FlowDocument flowDocument = PrintPreWindow.LoadDocumentAndRender( 98 | // @"PrintTemplete/LeavePrintTemplate.xaml", ""); 99 | ////执行异步委托调用参数 100 | //Dispatcher.BeginInvoke(new DoPrintMethod(DoPrint), DispatcherPriority.ApplicationIdle, printDialog, 101 | // ((IDocumentPaginatorSource) flowDocument).DocumentPaginator); 102 | ////定义执行完成之后释放资源并且将按钮状职位可用 103 | //timer = new Timer(TimerCallBack, null, 3000, Timeout.Infinite); 104 | 105 | #endregion 106 | } 107 | 108 | /// 109 | /// 打印预览请假单的实现,调用预览模板页进行并且打印 110 | /// 111 | private void PrintPreLeave_Click(object sender, RoutedEventArgs e) 112 | { 113 | //调用方法实现前台读取XML,获取前台传递的信息, 114 | var departmentText = DepartmentBox.Text; 115 | bool? thingHoliday = ThingHoliday.IsChecked; //事假 116 | bool? loseHoliday = LoseHoliday.IsChecked; //丧事 117 | bool? wedHoliday = WedHoliday.IsChecked; //婚事 118 | bool? leaveHoliday = LeaveHoliday.IsChecked; //产假 119 | bool? failHoliday = FailHoliday.IsChecked; //病假 120 | bool? yearHoliday = YearHoliday.IsChecked; //年休假 121 | 122 | var printTxtValue = ReadXml.GetLeavePrintTxtValue(departmentText, thingHoliday, loseHoliday, wedHoliday, 123 | leaveHoliday, failHoliday, yearHoliday); 124 | 125 | var print = new PrintPreWindow(@"PrintTemplete/LeavePrintTemplate.xaml", printTxtValue) 126 | { 127 | Owner = this, 128 | ShowInTaskbar = false 129 | }; 130 | print.ShowDialog(); 131 | } 132 | 133 | /// 134 | /// 直接打印出工单的实现,调用模板页直接打印 135 | /// 136 | private void PrintGoWork_Click(object sender, RoutedEventArgs e) 137 | { 138 | //初始化打印机状态,使其调用打印机接口,弹出框用户可以随机选择打印模板 139 | var printDialog = new PrintDialog(); 140 | //首先判断只有窗口未打开才能调用打印驱动 141 | if (printDialog.ShowDialog() != true) 142 | { 143 | return; 144 | } 145 | //调用方法实现前台读取XML 146 | var printTxtValue = ReadXml.GetGoWorkPrintTxtValue(); 147 | FlowDocument flowDocument = PrintPreWindow.LoadDocumentAndRender(@"PrintTemplete/GoWorkPrintTemplate.xaml", 148 | printTxtValue); 149 | Dispatcher.BeginInvoke(new DoPrintMethod(DoPrint), DispatcherPriority.ApplicationIdle, printDialog, 150 | ((IDocumentPaginatorSource) flowDocument).DocumentPaginator); 151 | } 152 | 153 | /// 154 | /// 打印预览出工单的实现,调用预览模板页进行并且打印 155 | /// 156 | private void PrintPreGoWork_Click(object sender, RoutedEventArgs e) 157 | { 158 | var printTxtValue = ReadXml.GetGoWorkPrintTxtValue(); 159 | var print = new PrintPreWindow(@"PrintTemplete/GoWorkPrintTemplate.xaml", printTxtValue) 160 | { 161 | Owner = this, 162 | ShowInTaskbar = false 163 | }; 164 | print.ShowDialog(); 165 | } 166 | 167 | /// 168 | /// 实现调用打印机驱动程序 169 | /// 170 | private void DoPrint(PrintDialog printDialog, DocumentPaginator documentPaginator) 171 | { 172 | printDialog.PrintDocument(documentPaginator, "Document Print"); 173 | } 174 | 175 | /// 176 | /// 调用时间的回调,并且释放资源 177 | /// 178 | /// 179 | public void TimerCallBack(Object objectdata) 180 | { 181 | timer.Dispose(); 182 | Dispatcher.BeginInvoke(new EnableButtonMethod(EnableButton)); 183 | } 184 | 185 | /// 186 | /// 将单击按钮置为可用状态 187 | /// 188 | private void EnableButton() 189 | { 190 | PrintLeave.IsEnabled = true; 191 | } 192 | 193 | 194 | /// 195 | /// 绑定部门信息 196 | /// 197 | /// 部门信息 198 | private void BindDepartMentInfo(string departMent) 199 | { 200 | List list = departMent.ToListInfo(',', c => c); 201 | //组装需要显示的集合 202 | List listInfo = list.Select((t, i) => new DepartMentInfo 203 | { 204 | Id = i + 1, 205 | Name = t 206 | }).ToList(); 207 | DepartmentBox.ItemsSource = listInfo; 208 | DepartmentBox.SelectedValuePath = "Id"; 209 | DepartmentBox.DisplayMemberPath = "Name"; 210 | } 211 | } 212 | } -------------------------------------------------------------------------------- /PrintTools/PrintTools/PrintTools.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {20FC05BF-D9B4-4232-BD92-56499DBB0208} 8 | WinExe 9 | Properties 10 | PrintTools 11 | PrintTools 12 | v4.5 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | false 17 | C:\Users\Administrator\Desktop\Git\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | true 31 | 32 | 33 | AnyCPU 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | 42 | 43 | AnyCPU 44 | pdbonly 45 | true 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | 51 | 52 | 53 | ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 4.0 73 | 74 | 75 | ..\packages\WebApiContrib.Formatting.JavaScriptSerializer.0.9.4.0\lib\net40\WebApiContrib.Formatting.JavaScriptSerializer.dll 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | MSBuild:Compile 84 | Designer 85 | 86 | 87 | 88 | 89 | PrintPreWindow.xaml 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | MSBuild:Compile 98 | Designer 99 | 100 | 101 | App.xaml 102 | Code 103 | 104 | 105 | MainWindow.xaml 106 | Code 107 | 108 | 109 | Designer 110 | MSBuild:Compile 111 | 112 | 113 | Designer 114 | MSBuild:Compile 115 | 116 | 117 | Designer 118 | MSBuild:Compile 119 | 120 | 121 | 122 | 123 | Code 124 | 125 | 126 | True 127 | True 128 | Resources.resx 129 | 130 | 131 | True 132 | Settings.settings 133 | True 134 | 135 | 136 | ResXFileCodeGenerator 137 | Resources.Designer.cs 138 | 139 | 140 | 141 | SettingsSingleFileGenerator 142 | Settings.Designer.cs 143 | 144 | 145 | 146 | 147 | 148 | Designer 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | Designer 157 | 158 | 159 | 160 | 161 | False 162 | Microsoft .NET Framework 4.5 %28x86 和 x64%29 163 | true 164 | 165 | 166 | False 167 | .NET Framework 3.5 SP1 Client Profile 168 | false 169 | 170 | 171 | False 172 | .NET Framework 3.5 SP1 173 | false 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 190 | -------------------------------------------------------------------------------- /PrintTools/PrintTools/PrintTemplete/GoWorkPrintTemplate.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 11 | 16 | 17 | 18 | 19 | 打印时间: 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 |
136 | 137 | 138 | 139 | 140 | 141 | 142 | 打印时间: 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 |
258 |
-------------------------------------------------------------------------------- /PrintTools/PrintTools/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |