Exemplo n.º 1
0
        protected async override void OnResume()
        {
            cts.Cancel();
            SleepTime = 0;
            var networkAccess = Connectivity.NetworkAccess;

            if (shouldConnect)
            {
                if (SignalRService.connection?.State == HubConnectionState.Disconnected)
                {
                    if (networkAccess == NetworkAccess.Internet)
                    {
                        Debug.WriteLine("NetworkAccess.Internet");
                        await signalR.ConnectToUserAsync(id);
                    }
                    else if (Connectivity.NetworkAccess == NetworkAccess.None)
                    {
                        Debug.WriteLine("NetworkAccess.None");
                    }
                    else
                    {
                        Debug.WriteLine("NetworkAccess.err");
                    }
                }
            }
        }
Exemplo n.º 2
0
        async void LoginButton_ClickedAsync(object sender, EventArgs e)
        {
            App.id = CrossDeviceInfo.Current.Id;

            //App.id = Preferences.Get("my_id", string.Empty);
            //if (string.IsNullOrWhiteSpace(App.id))
            //{
            //    App.id = System.Guid.NewGuid().ToString();
            //    Preferences.Set("my_id", App.id);
            //}
            //App.name = userSend.Text.ToString();
            await signalR.ConnectToUserAsync(App.id);

            AddMessage($"Server connection changed: LoginSuccess");
        }