Пример #1
0
        //生成图片
        private void button2_Click(object sender, EventArgs e)
        {
            int    fontsize = txt_fontsize.Text.ToInt();
            int    x        = txt_x.Text.ToInt();
            int    y        = txt_y.Text.ToInt();
            string imgname  = txt_imagename.Text;

            PrintLabel printLabel = new PrintLabel();

            printLabel.Fontsize  = fontsize;
            printLabel.X         = x;
            printLabel.Y         = y;
            printLabel.ImageNmae = imgname;
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(printLabel);

            json = json.Replace("\"", "'");

            if (cb_type.Text.IndexOf("豆腐丝") > -1)
            {
                xml.SetValue("PinDuoDuo_PrintLabel_Doufusi", json);
            }
            else if (cb_type.Text.IndexOf("熏鱼") > -1)
            {
                xml.SetValue("PinDuoDuo_PrintLabel_Xunyu", json);
            }


            //List<PrintLabel> list = GetPrintLabels();
            //List<PrintLabel> list2 = new List<PrintLabel>();
            //foreach (var item in list)
            //{
            //    if (item.Name == cb_type.Text)
            //    {
            //        item.Fontsize = fontsize;
            //        item.X = x;
            //        item.Y = y;
            //        item.ImageNmae = imgname;
            //    }
            //    list2.Add(item);
            //}
            //string json = Newtonsoft.Json.JsonConvert.SerializeObject(list2);
            //json = json.Replace("\"", "'");
            //xml.SetValue("PinDuoDuo_PrintLabel",json);

            //PrintLabel printLabel = new PrintLabel();
            //printLabel.Name = "豆腐丝";
            //printLabel.Fontsize = fontsize;
            //printLabel.X = x;
            //printLabel.Y = y;

            //List<PrintLabel> list = new List<PrintLabel>();
            //list.Add(printLabel);
            //list.Add(printLabel);
            //string json = Newtonsoft.Json.JsonConvert.SerializeObject(list);
            //textBox1.Text = json;
            ////{"Name":"豆腐丝","Fontsize":18,"X":130,"Y":320}
            ////[{"Name":"豆腐丝","Fontsize":18,"X":130,"Y":320},{"Name":"豆腐丝","Fontsize":18,"X":130,"Y":320}]
            bind();
        }
Пример #2
0
        private void btn_token_save_Click(object sender, EventArgs e)
        {
            string token = txt_token.Text.Trim();

            xml.SetValue("PDDAccessToken", token);
        }