Exemplo n.º 1
0
        public static async Task AddAppsToXtraComboBoxEditAsync(ComboBoxEdit host, ComboBoxEdit cbe)
        {
            string hostname = host.Text;

            cbe.Properties.Items.Clear();
            if (String.IsNullOrEmpty(hostname))
            {
                XtraMessageBox.Show("Chưa Chọn Device Để Lấy Apps", "Connection Lost ?", MessageBoxButtons.OK);
                return;
            }
            try
            {
                JObject listapp = await RequestController.GetApp(hostname);

                List <string> apps = listapp.Properties().Select(p => p.Name).ToList();
                apps.ForEach(app => cbe.Properties.Items.Add(app));
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Cannot Connect To Current Device IP Address {host.Text} \n Error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }