private void SetDefault() { try { Setting.Params sptemp = Setfile.SetDefault(); Setfile.Creatxmlfile(); Setfile.SaveParams(sptemp); sparmas = sptemp; } catch (System.Exception ex) { throw ex; } }
private void LoadForm_Load(object sender, EventArgs e) { dlog.WirteLog("loadstart\r\n"); //读取参数表 try { //dlog = new log(); //dlog.CreatLogFile("log.txt"); Setfile = new Setting(); sparmas = Setfile.ReadParams(); } catch //(System.Exception ex) { try { SetDefault(); } catch //(System.Exception ex2) { IsExit = true; this.Close(); return; } } dlog.WirteLog("read params\r\n"); Pc = new PowerC((PowerControl.PDA_Type)sparmas.PdaType); //if (sparmas.PdaType != 1 && sparmas.PdaType != 4 && sparmas.PdaType != -1) Pc.PowerUP(); dlog.WirteLog("power up\r\n"); if (sparmas.RunType == 1) { Funpercent = HandlePercent; RunThread = new Thread(new ThreadStart(Running)); RunThread.Start(); //if (dlog != null) // dlog.WirteLog("connect name:" + RunThread.Name + " " + RunThread.ManagedThreadId.ToString()+"\n"); Runningl = true; dlog.WirteLog("connect to reader\r\n"); } else { this.Close(); } }
public Setting.Params SetDefault() { Setting.Params sptemp = new Setting.Params(); sptemp.AntType = 1; sptemp.CheckAnt = false; sptemp.Comv = "COM1"; sptemp.CustomFrequency = false; sptemp.Frequencys = new string[0]; sptemp.Gen2q = 0; sptemp.Intenval = "50"; sptemp.Opant = 1; sptemp.PdaType = 0; sptemp.Protocol = 0; sptemp.ReaderType = 3; sptemp.ReadPw = new string[4]; sptemp.ReadPw[0] = "2300"; sptemp.ReadPw[1] = "2300"; sptemp.ReadPw[2] = "2300"; sptemp.ReadPw[3] = "2300"; sptemp.WritePw = new string[4]; sptemp.WritePw[0] = "2300"; sptemp.WritePw[1] = "2300"; sptemp.WritePw[2] = "2300"; sptemp.WritePw[3] = "2300"; sptemp.Region = 8; sptemp.RunAuto = false; sptemp.RunType = 1; sptemp.Session = 0; sptemp.Timeout = "300"; sptemp.BlockWrite = false; sptemp.IsReport = true; sptemp.BatteryReport = 5; sptemp.PowerMode = 0; sptemp.Sleep = 0; return(sptemp); }