コード例 #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);
        }