LoginForm - Try catch exception while init ApiController

This commit is contained in:
DucDangAnh 2020-07-06 18:09:07 +07:00
parent bbe0f7ed64
commit 53f457b020
2 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,5 @@
using System.Drawing;
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
@ -34,7 +35,15 @@ namespace AIParkingApplication
return;
}
apiController = new ApiController(txtServerAddress.Text);
try
{
apiController = new ApiController(txtServerAddress.Text);
}
catch (Exception ex)
{
MessageBox.Show($"Cấu máy chủ lỗi - Kiểm tra lại tên máy chủ, kết nối máy chủ! \r\n {ex.Message}", "Lỗi khởi tạo API!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
lblLoginStatus.Text = string.Empty;
string username = txtUsername.Text;

View File

@ -1,10 +1,8 @@
using Newtonsoft.Json;
using OpenCvSharp;
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Text.RegularExpressions;
using System.Threading.Tasks;