void BindDropped(bool TimedOut) { bindedToaster.BindActive = false; bindedToaster = null; timer.Change(Timeout.Infinite, Timeout.Infinite); timer.Dispose(); if (TimedOut) { currentPage.Navigation.PopModalAsync(); } }
void ReceivedDiscoverReply(IPAddress toasterIP, List <string> UDPcontent) { Toaster t = new Toaster(UDPcontent[0], toasterIP); foreach (var toaster in mainPage.viewModel.KnownToasters) { if (t.IPAddress.Equals(toaster.IPAddress)) { return; } } mainPage.viewModel.KnownToasters.Add(t); }
void ReceivedBindReply(IPAddress ipAddress, List <string> info) { if (info[0] == "1") { bindedToaster = mainPage.viewModel.KnownToasters.Where(x => x.IPAddress.Equals(ipAddress)).First(); bindedToaster.BindActive = true; Device.BeginInvokeOnMainThread(() => { mainPage.UpdateView(); }); timer = new Timer(SendKeepAlive, null, 0, keepAliveTimer); keepAliveWatch.Start(); } else { } }
public async void SendBindRequest(Toaster t) { byte[] msg = Encoding.ASCII.GetBytes("2*"); await client.SendToAsync(msg, t.IPAddress.ToString(), PORTS); }
private void List_ItemTapped(object sender, ItemTappedEventArgs e) { Toaster t = e.Item as Toaster; communication.SendBindRequest(t); }