using AR; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Project.Dialog { public partial class fZPLEditor : Form { string fn = string.Empty; public fZPLEditor(string fn_) { InitializeComponent(); this.fn = fn_; this.FormClosed += FZPLEditor_FormClosed; this.logTextBox1.ColorList = new arCtl.sLogMessageColor[] { new arCtl.sLogMessageColor("NORM",Color.White), new arCtl.sLogMessageColor("ERR", Color.Red), new arCtl.sLogMessageColor("WARN",Color.Tomato), new arCtl.sLogMessageColor("INFO",Color.SkyBlue), new arCtl.sLogMessageColor("BCD", Color.Yellow) }; this.logTextBox1.EnableDisplayTimer = false; this.logTextBox1.DateFormat = "HH:mm:ss"; this.logTextBox1.ForeColor = Color.White; toolStripStatusLabel1.Text = fn_; } private void FZPLEditor_FormClosed(object sender, FormClosedEventArgs e) { PUB.log.RaiseMsg -= Log_RaiseMsg; } private void fZPLEditor_Load(object sender, EventArgs e) { if (System.IO.File.Exists(this.fn)) this.richTextBox1.Text = System.IO.File.ReadAllText(this.fn, System.Text.Encoding.Default); PUB.log.RaiseMsg += Log_RaiseMsg; } private void Log_RaiseMsg(DateTime LogTime, string TypeStr, string Message) { this.logTextBox1.AddMsg(LogTime, TypeStr, Message); } private void toolStripButton1_Click(object sender, EventArgs e) { //load if (UTIL.MsgQ("Do you want to reload?") == DialogResult.Yes) this.richTextBox1.Text = System.IO.File.ReadAllText(this.fn, System.Text.Encoding.Default); } private void toolStripButton2_Click(object sender, EventArgs e) { //save if (UTIL.MsgQ("Do you want to save?") == DialogResult.Yes) System.IO.File.WriteAllText(this.fn, this.richTextBox1.Text.Trim(), System.Text.Encoding.Default); } private void toolStripButton4_Click(object sender, EventArgs e) { //right if (PUB.PrinterR.IsOpen) { var prn = PUB.PrinterR.Print(this.richTextBox1.Text); if (prn.result == false) PUB.log.AddE(prn.errmessage); } else PUB.log.AddAT("Printer R not connected"); } private void toolStripButton3_Click(object sender, EventArgs e) { //left if (PUB.PrinterL.IsOpen) { var prn = PUB.PrinterL.Print(this.richTextBox1.Text); if (prn.result == false) PUB.log.AddE(prn.errmessage); } else PUB.log.AddAT("Printer L not connected"); } } }