private void handleBrewProcess(GrainBrainStatus status) { if (status.State == BrewStep.StrikeWaterTempReached) { //dispatcherTimer.Tick -= brewProcessTimer_Tick; dispatcherTimer.IsEnabled = false; var swrw = new StrikeWaterReachedWindow(); swrw.ShowDialog(); IPAddress ipAddr; if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr)) { return; } string addr = String.Format("{0}:50051", ipAddr); Channel ch = new Channel(addr, ChannelCredentials.Insecure); McServer.McServerClient cl = new McServer.McServerClient(ch); GrainsAddedNotify req = new GrainsAddedNotify(); Empty resp = cl.GrainsAdded(req); ch.ShutdownAsync().Wait(); //dispatcherTimer.Tick += brewProcessTimer_Tick; dispatcherTimer.IsEnabled = true; } if (status.State == BrewStep.MashDoneStartSparge) { dispatcherTimer.IsEnabled = false; var sdw = new SpargeDoneWindow(); sdw.ShowDialog(); IPAddress ipAddr; if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr)) { return; } string addr = String.Format("{0}:50051", ipAddr); Channel ch = new Channel(addr, ChannelCredentials.Insecure); McServer.McServerClient cl = new McServer.McServerClient(ch); SpargeDoneNotify req = new SpargeDoneNotify(); Empty resp = cl.SpargeDone(req); ch.ShutdownAsync().Wait(); dispatcherTimer.IsEnabled = true; } if (status.State == BrewStep.BoilDone) { dispatcherTimer.IsEnabled = false; var wcsw = new WortChillerSanitizedWindow(); wcsw.ShowDialog(); IPAddress ipAddr; if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr)) { return; } string addr = String.Format("{0}:50051", ipAddr); Channel ch = new Channel(addr, ChannelCredentials.Insecure); McServer.McServerClient cl = new McServer.McServerClient(ch); WortChillerSanitizedDoneNotify req = new WortChillerSanitizedDoneNotify(); Empty resp = cl.WortChillerSanitizedDone(req); ch.ShutdownAsync().Wait(); dispatcherTimer.IsEnabled = true; } }
private void handleBrewProcess(GrainBrainStatus status) { if (status.State == BrewStep.StrikeWaterTempReached) { //dispatcherTimer.Tick -= brewProcessTimer_Tick; dispatcherTimer.IsEnabled = false; var swrw = new StrikeWaterReachedWindow(); swrw.ShowDialog(); IPAddress ipAddr; if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr)) return; string addr = String.Format("{0}:50051", ipAddr); Channel ch = new Channel(addr, ChannelCredentials.Insecure); McServer.McServerClient cl = new McServer.McServerClient(ch); GrainsAddedNotify req = new GrainsAddedNotify(); Empty resp = cl.GrainsAdded(req); ch.ShutdownAsync().Wait(); //dispatcherTimer.Tick += brewProcessTimer_Tick; dispatcherTimer.IsEnabled = true; } if (status.State == BrewStep.MashDoneStartSparge) { dispatcherTimer.IsEnabled = false; var sdw = new SpargeDoneWindow(); sdw.ShowDialog(); IPAddress ipAddr; if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr)) return; string addr = String.Format("{0}:50051", ipAddr); Channel ch = new Channel(addr, ChannelCredentials.Insecure); McServer.McServerClient cl = new McServer.McServerClient(ch); SpargeDoneNotify req = new SpargeDoneNotify(); Empty resp = cl.SpargeDone(req); ch.ShutdownAsync().Wait(); dispatcherTimer.IsEnabled = true; } if (status.State == BrewStep.BoilDone) { dispatcherTimer.IsEnabled = false; var wcsw = new WortChillerSanitizedWindow(); wcsw.ShowDialog(); IPAddress ipAddr; if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr)) return; string addr = String.Format("{0}:50051", ipAddr); Channel ch = new Channel(addr, ChannelCredentials.Insecure); McServer.McServerClient cl = new McServer.McServerClient(ch); WortChillerSanitizedDoneNotify req = new WortChillerSanitizedDoneNotify(); Empty resp = cl.WortChillerSanitizedDone(req); ch.ShutdownAsync().Wait(); dispatcherTimer.IsEnabled = true; } }