예제 #1
0
 void BindDropped(bool TimedOut)
 {
     bindedToaster.BindActive = false;
     bindedToaster            = null;
     timer.Change(Timeout.Infinite, Timeout.Infinite);
     timer.Dispose();
     if (TimedOut)
     {
         currentPage.Navigation.PopModalAsync();
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
 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
     {
     }
 }
예제 #4
0
 public async void SendBindRequest(Toaster t)
 {
     byte[] msg = Encoding.ASCII.GetBytes("2*");
     await client.SendToAsync(msg, t.IPAddress.ToString(), PORTS);
 }
예제 #5
0
        private void List_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            Toaster t = e.Item as Toaster;

            communication.SendBindRequest(t);
        }