2014-09-17 update 1

This commit is contained in:
parallelbgls@outlook.com
2014-09-17 16:23:16 +08:00
parent ce1f9e4d0f
commit 6026d7a93d
3 changed files with 10 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Web.Http; using System.Web.Http;
using System.Web.Http.Routing;
using CrossLampControl.WebApi.Models; using CrossLampControl.WebApi.Models;
using ModBus.Net; using ModBus.Net;
@@ -41,7 +42,9 @@ namespace CrossLampControl.WebApi.Controllers
{ {
light.SubLamp = LightLamp.Red.ToString(); light.SubLamp = LightLamp.Red.ToString();
} }
light.SetStart(lamps[6]);
return light; return light;
} }
} }
} }

View File

@@ -10,6 +10,7 @@ namespace CrossLampControl.WebApi.Models
{ {
public string MainLamp { get; set; } public string MainLamp { get; set; }
public string SubLamp { get; set; } public string SubLamp { get; set; }
public string StartPause { get; set; }
public Lamp() public Lamp()
{ {
@@ -17,10 +18,15 @@ namespace CrossLampControl.WebApi.Models
SubLamp = LightLamp.Red.ToString(); SubLamp = LightLamp.Red.ToString();
} }
public Lamp(LightLamp mLamp, LightLamp sLamp) public void SetLamp(LightLamp mLamp, LightLamp sLamp)
{ {
MainLamp = mLamp.ToString(); MainLamp = mLamp.ToString();
SubLamp = sLamp.ToString(); SubLamp = sLamp.ToString();
} }
public void SetStart(bool isStart)
{
StartPause = isStart ? "Start" : "Pause";
}
} }
} }