private static void updateStatus() { string addr = String.Format("{0}:50051", ipAddr); Channel channel = new Channel(addr, ChannelCredentials.Insecure); McServer.McServerClient client = new McServer.McServerClient(channel); Empty statusReq = new Empty(); BrewStatusReply rep = client.GetStatus(statusReq); channel.ShutdownAsync().Wait(); status.RemainingMashStepList.Clear(); foreach (MashProfileStep statusMp in rep.RemainingMashSteps) { var mps = new GFCalc.Domain.MashProfileStep(); mps.Temperature = statusMp.Temperature; mps.StepTime = statusMp.StepTime; status.RemainingMashStepList.Add(mps); } var ol = status.RemainingMashStepList.OrderBy(x => x.Temperature).ToList(); status.RemainingMashStepList.Clear(); foreach (GFCalc.Domain.MashProfileStep ms in ol) { status.RemainingMashStepList.Add(ms); } status.Temperature = (int)(Math.Round(rep.MashTemperature)); status.RemainingBoilTime = rep.RemainingBoilTime; status.State = rep.CurrentBrewStep; status.Progress = rep.Progress; }
private static void updateStatus() { string addr = String.Format("{0}:50051", ipAddr); Channel channel = new Channel(addr, ChannelCredentials.Insecure); McServer.McServerClient client = new McServer.McServerClient(channel); Empty statusReq = new Empty(); BrewStatusReply rep = client.GetStatus(statusReq); channel.ShutdownAsync().Wait(); status.RemainingMashStepList.Clear(); foreach (MashProfileStep statusMp in rep.RemainingMashSteps) { var mps = new GFCalc.Domain.MashProfileStep(); mps.Temperature = statusMp.Temperature; mps.StepTime = statusMp.StepTime; status.RemainingMashStepList.Add(mps); } var ol = status.RemainingMashStepList.OrderBy(x => x.Temperature).ToList(); status.RemainingMashStepList.Clear(); foreach (GFCalc.Domain.MashProfileStep ms in ol) { status.RemainingMashStepList.Add(ms); } status.Temperature = (int)(Math.Round(rep.MashTemperature)); status.RemainingBoilTime = rep.RemainingBoilTime; status.State = rep.CurrentBrewStep; status.Progress = rep.Progress; }