예제 #1
0
        private async Task ScanNetwork(bool firstStart)
        {
            RunOnUiThread(() =>
            {
                SetScanState(true);
                FindViewById <ListView>(Resource.Id.lvDevices).Adapter = null;
            });

            try
            {
                mlock.Acquire();
                await finder.DiscoverBoards();
            }
            finally
            {
                mlock.Release();
            }

            RunOnUiThread(() =>
            {
                SetScanState(false);

                FindViewById <ListView>(Resource.Id.lvDevices).Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, finder.Boards.ToList());
                if (firstStart && finder.Boards.Count == 1)
                {
                    // If the app is starting and there is only one device available, connect to it immediately
                    GoToIP(finder.Boards[0].IPAddress);
                }
            });
        }
예제 #2
0
 protected override void OnDestroy()
 {
     if (mlock != null)
     {
         mlock.Release();
         mlock = null;
     }
     base.OnDestroy();
 }
        protected override void OnDestroy()
        {
            //base.OnDestroy();
            if (_mlock != null)
            {
                _mlock.Release();
                _mlock = null;
            }

            base.OnDestroy();
        }
예제 #4
0
 public void Dispose()
 {
     if (_mcLock != null)
     {
         _mcLock.Release();
         _mcLock.Dispose();
     }
     if (_httpServer != null)
     {
         _httpServer.Dispose();
     }
     if (_udpServer != null)
     {
         _udpServer.Dispose();
     }
 }