Warning fix

This commit is contained in:
luosheng
2023-02-18 08:52:21 +08:00
parent 5118fc5ac3
commit d99cad0d77
23 changed files with 283 additions and 93 deletions

View File

@@ -7,10 +7,10 @@ namespace AnyType.Models
{
public class TaskViewModel
{
public string Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public double Value { get; set; }
public string Type { get; set; }
public string? Id { get; set; }
public string? Name { get; set; }
public string? Address { get; set; }
public double? Value { get; set; }
public string? Type { get; set; }
}
}

View File

@@ -16,7 +16,7 @@ namespace CrossLamp.Controllers
_logger = logger;
}
private static BaseUtility _utility;
private static BaseUtility? _utility = null;
public ActionResult Index()
{
@@ -24,7 +24,7 @@ namespace CrossLamp.Controllers
}
[HttpGet]
public async Task<JsonResult> GetLamp()
public async Task<JsonResult?> GetLamp()
{
try
{

View File

@@ -8,9 +8,9 @@ namespace CrossLampControl.WebApi.Models
{
public class Lamp
{
public string MainLamp { get; set; }
public string SubLamp { get; set; }
public string StartPause { get; set; }
public string? MainLamp { get; set; }
public string? SubLamp { get; set; }
public string? StartPause { get; set; }
public Lamp()
{

View File

@@ -15,8 +15,8 @@ namespace TripleAdd.Controllers
_logger = logger;
}
private static BaseUtility utility;
private static BaseMachine machine;
private static BaseUtility? utility;
private static BaseMachine? machine;
public ActionResult Index()
{
@@ -83,7 +83,7 @@ namespace TripleAdd.Controllers
public async Task<ActionResult> SetUtility(TripleAddViewModel model)
{
ushort add1 = model.Add1, add2 = model.Add2, add3 = model.Add3;
await utility.SetDatasAsync("4X 1", new object[] { add1, add2, add3 });
await utility!.SetDatasAsync("4X 1", new object[] { add1, add2, add3 });
return RedirectToAction("Utility");
}
@@ -92,7 +92,7 @@ namespace TripleAdd.Controllers
{
ushort add1 = model.Add1, add2 = model.Add2, add3 = model.Add3;
var setDic = new Dictionary<string, double> { { "Add1", add1 }, { "Add2", add2 }, { "Add3", add3 } };
await machine.SetDatasAsync(MachineDataType.CommunicationTag, setDic);
await machine!.SetDatasAsync(MachineDataType.CommunicationTag, setDic);
return RedirectToAction("Machine");
}