|
|
@ -19,6 +19,10 @@ using System.Drawing.Imaging; |
|
|
using System.Drawing.Printing; |
|
|
using System.Drawing.Printing; |
|
|
using formula_manage.UserClass; |
|
|
using formula_manage.UserClass; |
|
|
using System.Xml.Linq; |
|
|
using System.Xml.Linq; |
|
|
|
|
|
using FastReport.Format; |
|
|
|
|
|
using Svg; |
|
|
|
|
|
using System.IO; |
|
|
|
|
|
using System.Windows.Media.Media3D; |
|
|
|
|
|
|
|
|
namespace formula_manage.Windows |
|
|
namespace formula_manage.Windows |
|
|
{ |
|
|
{ |
|
|
@ -31,22 +35,44 @@ namespace formula_manage.Windows |
|
|
{ |
|
|
{ |
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
InitializeComponent(); |
|
|
InitializeComponent(); |
|
|
cbxPrinter.ItemsSource = this.GetLocalPrinters(); |
|
|
cbxPrinter.ItemsSource = this.GetLocalPrinters(); //打印机搜索
|
|
|
|
|
|
this.Closing += Window_Closing; //添加窗口关闭事件
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; |
|
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; |
|
|
|
|
|
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
|
|
|
|
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
|
|
|
|
|
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:"; |
|
|
|
|
|
|
|
|
bool Printer; |
|
|
bool Printer; |
|
|
string Printer_NAME; |
|
|
|
|
|
|
|
|
|
|
|
private void Window_Print(object sender, RoutedEventArgs e) |
|
|
private void Window_Print(object sender, RoutedEventArgs e) |
|
|
{ |
|
|
{ |
|
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); |
|
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); |
|
|
|
|
|
|
|
|
Printer = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P1")); |
|
|
Printer = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P1")); |
|
|
Printer_NAME = Configini.IniReadvalue("PRINTER", "P2"); //读配置文件
|
|
|
cbxPrinter.SelectedValue = Configini.IniReadvalue("PRINTER", "P2"); //读配置文件
|
|
|
|
|
|
|
|
|
|
|
|
TEXT_Print.IsChecked = Printer; |
|
|
|
|
|
cbxPrinter.IsEnabled = Printer; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
|
|
|
|
|
{ |
|
|
|
|
|
MessageBoxResult result = System.Windows.MessageBox.Show("设置完成后请重启程序", "提示", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel); |
|
|
|
|
|
|
|
|
|
|
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); |
|
|
|
|
|
Configini.IniWritevalue("PRINTER", " P1", Printer.ToString()); |
|
|
|
|
|
Configini.IniWritevalue("PRINTER", " P2", cbxPrinter.SelectedValue.ToString()); |
|
|
|
|
|
|
|
|
|
|
|
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
|
|
|
|
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write); |
|
|
|
|
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
|
|
|
|
|
wr.WriteLine(Log_time + "Print:Print_SET"); |
|
|
|
|
|
wr.Close(); |
|
|
} |
|
|
} |
|
|
private void Button_Click(object sender, RoutedEventArgs e) //SQL_DISPEN_bak路径选择按钮
|
|
|
|
|
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e) //路径选择按钮
|
|
|
{ |
|
|
{ |
|
|
FolderBrowserDialog Dilog = new FolderBrowserDialog(); |
|
|
FolderBrowserDialog Dilog = new FolderBrowserDialog(); |
|
|
Dilog.SelectedPath = Print_path.Text; //打开目录
|
|
|
Dilog.SelectedPath = Print_path.Text; //打开目录
|
|
|
|