コード例 #1
0
        public async Task GetUserList()
        {
            usList.Items.Clear();
            using (HttpClient client = new HttpClient())
            {
                string responce = await client.GetStringAsync(MainFunc.ip + "/user_list");

                UsersList = MainFunc.usersListHandler(responce);
                if (UsersList == null)
                {
                    MessageBox.Show("Ошибка");
                }
                else
                {
                    foreach (User item in UsersList)
                    {
                        string usType = "";
                        if (item.perms == 0)
                        {
                            usType = "обычный пользователь";
                        }
                        if (item.perms == 1)
                        {
                            usType = "администратор";
                        }
                        usList.Items.Add("ФИО: " + item.fio + "  \n Email: " + item.email + "  \n Телефон: " + item.phone + " \n Тип пользователя: " + usType + "");
                    }
                }
            }
        }
コード例 #2
0
        public async Task GetUserList()
        {
            using (HttpClient client = new HttpClient())
            {
                string responce = await client.GetStringAsync(MainFunc.ip + "/user_list");

                UsersList = MainFunc.usersListHandler(responce);
            }
        }
コード例 #3
0
        public async Task GetUserList()
        {
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    string responce = await client.GetStringAsync(MainFunc.ip + "/user_list");

                    UsersList = MainFunc.usersListHandler(responce);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!");
            }
        }