示例#1
0
        void displayAllCaller()
        {
            var cityCaller = new myAPIcaller();
            var info       = cityCaller.GetAllCity();

            displayCity(info);
        }
示例#2
0
        private void Tx_Search_TextChanged(object sender, EventArgs e)
        {
            var cityCaller = new myAPIcaller();

            if (tx_Search.Text == "" || tx_Search.Text == null)
            {
                var cityInfo = cityCaller.GetAllCity();
                displayCity(cityInfo);
            }
            else
            {
                try
                {
                    var cityInfo = cityCaller.GetCity(Int32.Parse(tx_Search.Text));
                    displayCity(cityInfo);
                }
                catch
                {
                    MessageBox.Show("Id does not exist!");
                }
            }
        }