static void Main() { APICustomer.Connect(); MailClient.CheckMail(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); }
private void LoadData() { try { MailClient.CheckMail(); List <ModelCustomerView> list = Task.Run(() => APICustomer.GetRequestData <List <ModelCustomerView> >("api/Customer/GetList")).Result; if (list != null) { dataGridViewClients.DataSource = list; dataGridViewClients.Columns[0].Visible = false; dataGridViewClients.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FormMails_Load(object sender, EventArgs e) { try { MailClient.CheckMail(); List <ModelMessageInfoView> list = Task.Run(() => APICustomer.GetRequestData <List <ModelMessageInfoView> >("api/MessageInfo/GetList")).Result; if (list != null) { dataGridView.DataSource = list; dataGridView.Columns[0].Visible = false; dataGridView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }