Beispiel #1
0
        private async void Login_Clicked(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(personName.Text))
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        adminLogin.IsVisible = false;
                        personName.IsVisible = false;
                        login.IsVisible      = false;
                        activity.IsVisible   = true;
                    });
                    ChatClientServiceUser ch = new ChatClientServiceUser();
                    await ch.Connect();

                    Navigation.PushAsync(new ChatPage(personName.Text, ref ch));
                }

                else
                {
                    await DisplayAlert("ChatApp", "Check Network Connection", "Close");
                }
            }

            else
            {
                personName.Placeholder = "Enter a Name First!";
            }
        }
Beispiel #2
0
 public ChatPage(string personName, ref ChatClientServiceUser ch)
 {
     InitializeComponent();
     _personName               = personName.ToLower();
     sendButton.Clicked       += SendButton_Clicked;
     chUser                    = ch;
     chUser.OnMessageRecieved += ChatClientService_OnMessageRecieved;
 }