1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using Common.system;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
-
- namespace XHWK.WKTool
- {
- /// <summary>
- /// 打印
- /// </summary>
- public partial class PrintWindow : Window
- {
- /// <summary>
- /// 下拉框数据源
- /// </summary>
- public DataTable data = new DataTable();
- public PrintWindow()
- {
- InitializeComponent();
- string defa = string.Empty;
- List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
- if(defaList.Count>0)
- {
- data.Columns.Add("Value");
- data.Columns.Add("Key");
- for (int i = 0; i < defaList.Count; i++)
- {
- //创建一行
- DataRow row = data.NewRow();
- //将此行添加到table中
- data.Rows.Add(row);
- data.Rows[i]["Value"] = defaList[i];
- data.Rows[i]["Key"] = i.ToString();
- }
- //dtComponentsUniqueNo = data.DefaultView.ToTable();
- //cmbClass.ItemsSource = dtComponentsUniqueNo.DefaultView;
- cmbClass.SelectedIndex = 0;
- }
- }
- public void Initialize(string _imgPath)
- {
-
- }
- /// <summary>
- /// 打印机下拉框改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void cmbClass_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
-
- }
- /// <summary>
- /// 打印
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnPrint_Click(object sender, RoutedEventArgs e)
- {
- int pr = 1;
- string msg = string.Empty;
- string outPut = string.Empty;
- LatticeFileHelper.GeneratingPDF(@"G:\101.pdf", @"G:\102.TPF", out pr, out msg, out outPut);
- if (pr == 0)
- {
- outPut = outPut.Replace("[", "").Replace("]", "").Replace("\"", "").Trim();
- APP.OutPut = outPut.Split(',');
- string defa = string.Empty;
- List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
-
- int printResult = 1;
- string standardError = string.Empty;
- string standardOutput = string.Empty;
- LatticeFileHelper.PrinterTPFFile(@"G:\102.TPF", 1, /*defa*/"导出为WPS PDF", out printResult, out standardError, out standardOutput);
- }
- }
- }
- }
|