AIParkingApplicationForm - pass apiController thru Param.

This commit is contained in:
DucDangAnh 2020-07-06 16:12:49 +07:00
parent 8e537fba1b
commit ee56086eff
2 changed files with 5 additions and 6 deletions

View File

@ -13,23 +13,22 @@ namespace AIParkingApplication
private StatusBar statusBar; private StatusBar statusBar;
private Sidebar sidebar; private Sidebar sidebar;
public AIParkingApplicationForm() public AIParkingApplicationForm(ApiController apiController)
{ {
InitializeComponent(); InitializeComponent();
string serverBaseAddress = "http://localhost:80/"; this.apiController = apiController;
apiController = new ApiController(serverBaseAddress);
sidebar = new Sidebar(apiController); sidebar = new Sidebar(apiController);
sidebar.Location = new System.Drawing.Point(0, 0); sidebar.Location = new System.Drawing.Point(0, 0);
Controls.Add(sidebar); Controls.Add(sidebar);
c3Device = new C3DeviceController("192.168.1.200"); c3Device = new C3DeviceController("192.168.1.200");
laneIn = new LaneIn(1, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, apiController, true, false, true); laneIn = new LaneIn(1, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, this.apiController, true, false, true);
laneIn.BorderStyle = BorderStyle.FixedSingle; laneIn.BorderStyle = BorderStyle.FixedSingle;
laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, 0); laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, 0);
Controls.Add(laneIn); Controls.Add(laneIn);
laneOut = new LaneOut(2, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, apiController, true, false, true); laneOut = new LaneOut(2, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, this.apiController, true, false, true);
laneOut.BorderStyle = BorderStyle.FixedSingle; laneOut.BorderStyle = BorderStyle.FixedSingle;
laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, 0); laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, 0);
Controls.Add(laneOut); Controls.Add(laneOut);

View File

@ -44,7 +44,7 @@ namespace AIParkingApplication
var loginResult = await apiController.Login(new LoginModel { Username = username, Password = password }); var loginResult = await apiController.Login(new LoginModel { Username = username, Password = password });
if (loginResult.IsLoginSuccess) if (loginResult.IsLoginSuccess)
{ {
new AIParkingApplicationForm().Show(); new AIParkingApplicationForm(apiController).Show();
Hide(); Hide();
} }
else else