public frIndex() { InitializeComponent(); this.Paint += new System.Windows.Forms.PaintEventHandler(this.frIndex_Paint); linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; linkLabel1.LinkColor = ColorTranslator.FromHtml("#666"); //MyContext context = new MyContext(); //var empList = context.Rules.OrderBy(c => c.Name).ToList(); //var item = new Data.Rules() //{ // Name = "Hello" //}; //context.Rules.Add(item); //context.SaveChanges(); //using (var db = new MyContext()) //{ // var user = (from v in db.Rules // where v.Name == "Hello" // select v).Single(); // db.Rules.Remove(user); // db.SaveChanges(); //} var code = new Code.QRCode(); picCode.Image = code.Build(txtText.Text.Trim(), ctrParameters1.QRParameters); }
private void Working() { var num = int.Parse(txtNum.Text.Trim()); var count = 0; var qrcode = new Code.QRCode(); var parm = ctrParameters1.QRParameters; var dir = txtDir.Text.Trim().Replace("/", "\\"); var ext = parm.ImgType; if (dir.Substring(dir.Length - 1, 1) != "\\") { dir = dir + "\\"; } while (true) { var Code = BuildCode(); var ds = SQLiteHelper.ExecuteDataset(" select * from Data where RuleName='" + _RuleName + "' and Code='" + Code + "' limit 1 "); if (Comm.Func.HasData(ds) == false) { continue; } var rows = SQLiteHelper.ExecuteNonQuery("insert into Data(RuleName,Code)values('" + _RuleName + "','" + Code + "')"); if (rows <= 0) { continue; } var fileName = dir + Code + "." + ext; var result = qrcode.Save(Code, parm, fileName, ext); if (rows > 0 && result == true) { count = count + 1; } lbMsg.Text = "进度:" + count + "/" + num; if (count >= num) { break; } } lbMsg.Text = "生成完成"; }
private void btBuild_Click(object sender, EventArgs e) { var code = new Code.QRCode(); picCode.Image = code.Build(txtText.Text.Trim(), ctrParameters1.QRParameters); }