/// <summary> /// 选择打印机 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void selPrintBtn_Click(object sender, EventArgs e) { var printerName = this.ShowPrintList(); if (!string.IsNullOrEmpty(printerName)) { this.PrintName = printerName; FormConfigUtil.SetConfig(new Dictionary <string, string> { { "printName", this.PrintName } }); } }
private void saveBtn_Click(object sender, EventArgs e) { var wifiPath = this.wifiTxt.Text; var loaclPath = this.localTxt.Text; var logPath = this.logTxt.Text; var ipPath = this.ipTxt.Text; var countPath = this.countTxt.Text; var imgPath = this.localComboBox.SelectedValue.ToString(); var printCount = this.countTxt.Text; var port = this.portTxt.Text; string size = ImageSizeUtil.ConverntPaperSize(this.pageSize); var dic = new Dictionary <string, string> { { "wifiPath", wifiPath }, { "locationPath", loaclPath }, { "logPath", logPath }, { "ipPath", ipPath }, { "imgLocation", imgPath }, { "printCount", printCount }, { "pageSize", size }, { "landscape", this.landscape.ToString() }, { "marginLeft", this.marginLeft.ToString() }, { "marginRight", this.marginRight.ToString() }, { "marginTop", this.marginTop.ToString() }, { "marginBottom", this.marginBottom.ToString() }, { "host", port } }; FormConfigUtil.SetConfig(dic); FormFactory.MainForm.InitForm(); FormFactory.MainForm.ReloadService(x => { if (x) { MessageBox.Show("设置保存成功"); } else { MessageBox.Show("端口已被占用,请重新设置端口"); } }); }