private async Task SalvarSalaWifi() { var wiffiInfo = DroidUtils.GetWifi(); if (wiffiInfo.HasValue) { if (wiffiInfo.Value.Info != null) { var info = wiffiInfo.Value.Info; await ChatDataStore <Sala> .Instance.AddAsync(new Sala { Nome = info.SSID, BSSIDWifi = info.BSSID }); } } }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.NoTitle); FacebookSdk.SdkInitialize(ApplicationContext); SetContentView(Resource.Layout.Login); btnTentarNovamente.Click += btnTentarNovamente_Click; try { profileTracker = new MyProfileTracker(); profileTracker.OnProfileChanged += profileChanged; profileTracker.StartTracking(); //btnFacebook.Visibility = Android.Views.ViewStates.Visible; btnFacebook.SetReadPermissions("public_profile", "email", "user_friends"); callBackMgr = CallbackManagerFactory.Create(); btnFacebook.RegisterCallback(callBackMgr, this); if (AccessToken.CurrentAccessToken != null && Profile.CurrentProfile != null) { await Conectar(Profile.CurrentProfile); } else { btnFacebook.Visibility = Android.Views.ViewStates.Visible; /* Profile profile = new Profile("100000568434728", "ss", "dd", "s", "das", null); * Conectar(profile); * return;*/ } } catch (System.Exception ex) { if (btnFacebook.Visibility != ViewStates.Visible) { btnTentarNovamente.Visibility = ViewStates.Visible; } SetProgressBarVisibility(false); DroidUtils.MostraMensagem("Problemas ao tentar se conectar, verifique sua internet e tente novamente.", ex.Message); } }
private async void profileChanged(object sender, OnProfileChangedEventArgs e) { if (e.mProfile != null) { try { Profile profile = e.mProfile; //await Task.Delay(5000); if (!jaEntrou) { await Conectar(profile); } } catch (System.Exception ex) { DroidUtils.MostraMensagem("profileChanged", ex.Message); } } }