Example #1
0
        public ProjectDefine()
        {
            List <string> names = new List <string>();

            try
            {
                string projectIdBaseAddress = "http://172.18.84.114:8080/PDD/pdd/cim-interface!findAllProject";
                var    projectIdHttp        = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(new Uri(projectIdBaseAddress));

                var response = projectIdHttp.GetResponse();

                var stream  = response.GetResponseStream();
                var sr      = new StreamReader(stream, Encoding.UTF8);
                var content = sr.ReadToEnd();
                contentList = Newtonsoft.Json.JsonConvert.DeserializeObject <JsonCityData>(content);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //MessageBox.Show(content);
            if (contentList.result != null)
            {
                foreach (City city in contentList.result)
                {
                    names.Add(city.name);
                }
            }

            InitializeComponent(names);
            UIMethod.SetFormRoundRectRgn(this, 5);  //设置圆角
        }
Example #2
0
        public ChooseCityForm()
        {
            // 获取定义好的项目
            string cityId = Method.SaveProjectIdToXData.GetDefinedProject();

            List <string> names = new List <string>();

            try
            {
                string projectIdBaseAddress = "http://172.18.84.114:8080/PDD/pdd/cim-interface!findAllProject";
                var    projectIdHttp        = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(new Uri(projectIdBaseAddress));

                var response = projectIdHttp.GetResponse();

                var stream  = response.GetResponseStream();
                var sr      = new StreamReader(stream, Encoding.UTF8);
                var content = sr.ReadToEnd();
                contentList = Newtonsoft.Json.JsonConvert.DeserializeObject <JsonCityData>(content);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            string city = "";

            foreach (City item in contentList.result)
            {
                names.Add(item.name);
                if (item.oid == cityId)
                {
                    city = item.name;
                }
            }

            InitializeComponent(names, city);
            UIMethod.SetFormRoundRectRgn(this, 5);  //设置圆角
            this.textBox1.Hide();
        }