<feat> TCP 좌표 패널 표기
This commit is contained in:
@@ -7,14 +7,16 @@ public class ProgramPresenter
|
||||
{
|
||||
private ProgramModel model;
|
||||
private IProgramView view;
|
||||
private TCPView tcpView;
|
||||
private RobotController controlledRobot;
|
||||
private string _programId;
|
||||
private bool lastKnownMotorState = false;
|
||||
|
||||
public ProgramPresenter(ProgramModel model, IProgramView view)
|
||||
public ProgramPresenter(ProgramModel model, IProgramView view, TCPView tcpView)
|
||||
{
|
||||
this.model = model;
|
||||
this.view = view;
|
||||
this.tcpView = tcpView;
|
||||
|
||||
this.view.OnCreateProgramClicked += async (id) => await HandleCreateProgram(id);
|
||||
this.view.OnLoadProgramListRequested += HandleLoadProgramList;
|
||||
@@ -22,6 +24,7 @@ public class ProgramPresenter
|
||||
this.view.OnOpenProgramClicked += async () => await HandleOpenProgram();
|
||||
this.view.OnSaveClicked += HandleSaveProgram;
|
||||
this.view.OnAddPointClicked += HandleAddPoint;
|
||||
this.tcpView.OnTCPupdateRequested += HandleTCPViewUpdate;
|
||||
}
|
||||
|
||||
public void RegisterControlledRobot(RobotController robot)
|
||||
@@ -59,6 +62,7 @@ public class ProgramPresenter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task HandleCreateProgram(string programId)
|
||||
{
|
||||
if (await model.CreateNewProgram(programId))
|
||||
@@ -113,6 +117,15 @@ public class ProgramPresenter
|
||||
//view.DisplayProgram(model.CurrentProgram);
|
||||
}
|
||||
|
||||
private void HandleTCPViewUpdate()
|
||||
{
|
||||
if (model.IsNewDataAvailable())
|
||||
{
|
||||
RobotData data = model.GetLatestRobotData();
|
||||
|
||||
tcpView.SetCoordinates(data);
|
||||
}
|
||||
}
|
||||
private void Destroy()
|
||||
{
|
||||
this.view.OnCreateProgramClicked -= async (id) => await HandleCreateProgram(id);
|
||||
@@ -121,5 +134,6 @@ public class ProgramPresenter
|
||||
this.view.OnOpenProgramClicked -= async () => await HandleOpenProgram();
|
||||
this.view.OnSaveClicked -= HandleSaveProgram;
|
||||
this.view.OnAddPointClicked -= HandleAddPoint;
|
||||
this.tcpView.OnTCPupdateRequested -= HandleTCPViewUpdate;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user