public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { _contentView = inflater.Inflate(Resource.Layout.device_detail, null); _contentView.FindViewById<Button>(Resource.Id.btn_connect).Click += (sender, args) => { var config = new WifiP2pConfig { DeviceAddress = _device.DeviceAddress, Wps = { Setup = WpsInfo.Pbc } }; if (_progressDialog != null && _progressDialog.IsShowing) _progressDialog.Dismiss(); _progressDialog = ProgressDialog.Show(Activity, "Press back to cancel", "Connecting to: " + _device.DeviceAddress, true, true); ((IDeviceActionListener)Activity).Connect(config); }; _contentView.FindViewById<Button>(Resource.Id.btn_disconnect).Click += (sender, args) => ((IDeviceActionListener)Activity).Disconnect(); _contentView.FindViewById<Button>(Resource.Id.btn_start_client).Click += (sender, args) => { var intent = new Intent(Intent.ActionGetContent); intent.SetType("image/*"); StartActivityForResult(intent, ChooseFileResultCode); }; return _contentView; }
public void Connect(WifiP2pConfig config) { _manager.Connect(_channel, config, new MyActionListner(this, "Connect", () => { })); }