private void _OnPeersFound(IWifiDirectManager wifiDirectManager, IWifiDirectDevice[] devices)
 {
     foreach (IWifiDirectDevice device in devices)
     {
         this._WifiDirectDeviceList.Add(device);
     }
 }
        public WifiDirectDeviceListPage()
        {
            _WifiDirectManager    = DependencyService.Get <IWifiDirectManager>();
            _WifiDirectDeviceList = new ObservableCollection <IWifiDirectDevice>();

            ListView wifiDirectDeviceListView = new ListView();

            wifiDirectDeviceListView.ItemsSource   = _WifiDirectDeviceList;
            wifiDirectDeviceListView.ItemSelected += _OnDeviceSelected;
            wifiDirectDeviceListView.ItemTemplate  = new DataTemplate(typeof(WifiDirectDeviceCell));

            _WifiDirectManager.OnPeersFound += _OnPeersFound;
            _ScanDevicesButton          = new Button();
            _ScanDevicesButton.Clicked += (object sender, EventArgs e) =>
            {
                resetDeviceList();
                _WifiDirectManager.SearchForPeers();
            };
            _ConnectButton = new Button()
            {
                Text = "Connect"
            };
            _ConnectButton.Clicked += _OnConnectButtonClicked;
            Content = new StackLayout
            {
                Children =
                {
                    _ScanDevicesButton,
                    wifiDirectDeviceListView,
                    _ConnectButton
                }
            };
        }