Beispiel #1
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     //todo 记录配置信息到配置文件中
     ConfigureAppConfig.AppSettingsSave(ConfigureAppConfig.API_SERVER_URL, bt_server_url.Text);
     ConfigureAppConfig.AppSettingsSave(ConfigureAppConfig.API_M_CODE, tb_m_code.Text);
     ConfigureAppConfig.AppSettingsSave(ConfigureAppConfig.API_CLIENT_PUB_SIGN_KEY, rtb_sign_pub_key.Text);
     if (MessageBox.Show("重新启动程序以应用新配置", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         Application.Restart();
     }
 }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder requestUriBuilder = new StringBuilder();

            requestUriBuilder.Append(ConfigureAppConfig.GetAppSettingsKeyValue(ConfigureAppConfig.API_SERVER_URL));
            requestUriBuilder.Append(ConfigureAppConfig.GetAppSettingsKeyValue(ConfigureAppConfig.API_CUSTOM));
            //todo 设置参数,请求服务器
            Dictionary <String, String> dicList = new Dictionary <string, string>();

            dicList.Add("customName", tb_name.Text);
            dicList.Add("phone", tb_mobile.Text);
            dicList.Add("meathcode", ConfigureAppConfig.GetAppSettingsKeyValue(ConfigureAppConfig.API_M_CODE));//读取配置文件,获取机器码
            dicList.Add("userid", "3");
            String jsonString = HttpWebRequestUtils.PostHttp(requestUriBuilder.ToString(), HttpWebRequestUtils.buildQueryStr(dicList), null);
            //List<Customer> customerList = JSON.parse<List<Customer>>(jsonString);
            //JArray ja = (JArray)JsonConvert.DeserializeObject(jsonString);
            List <Customer> _list = JsonConvert.DeserializeObject <List <Customer> >(jsonString);


            this.dgv_tables.DataSource = _list;
        }
Beispiel #3
0
 private void ConfigureFrm_Load(object sender, EventArgs e)
 {
     bt_server_url.Text    = ConfigureAppConfig.GetAppSettingsKeyValue(ConfigureAppConfig.API_SERVER_URL);
     tb_m_code.Text        = ConfigureAppConfig.GetAppSettingsKeyValue(ConfigureAppConfig.API_M_CODE);
     rtb_sign_pub_key.Text = ConfigureAppConfig.GetAppSettingsKeyValue(ConfigureAppConfig.API_CLIENT_PUB_SIGN_KEY);
 }