using SelfHelpClient.BL; using SelfHelpClient.BO; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; namespace SelfHelpClient { public partial class MainForm : Form { private static MainForm mForm; public static MainForm Form { get { return mForm; } } public MainForm() { if (!File.Exists("AppConfig.cfg")) { MessageBox.Show("请先配置服务器地址"); this.Close(); } WeightBillBL.ServerUrl = File.ReadAllText("AppConfig.cfg"); mForm = this; InitializeComponent(); } private void selfBtn_Click(object sender, EventArgs e) { var entity = ReadCard(); if (entity == null) return; if (entity.BillType == 0) return; new SelfHelpForm(entity.ID).Show(); this.Hide(); } private void weightBtn_Click(object sender, EventArgs e) { var entity = ReadCard(); if (entity == null) return; new WeightForm(entity).Show(); this.Hide(); } ViewEntity ReadCard() { var reader = new ReadCardForm(); if (reader.ShowDialog() == DialogResult.OK) return reader.VEntity; return null; ; } private void testClose_Click(object sender, EventArgs e) { this.Close(); } } }