private async void OnSendClicked(object sender, EventArgs e)
        {
/*
 *          var act = MainApplication.CurrentActivity;
 *          ActivityManager activityManager = (ActivityManager)GetSystemService(Context.ActivityService);
 *          var runningProcesses = activityManager?.RunningAppProcesses;
 *          var appTasks = activityManager.AppTasks;
 *          var num = appTasks.Count;
 *          var runningTasks = activityManager?.GetRunningTasks(100);
 */
            //send the contents of the edit text
            var msg = _messageInput.Text;

            // if text is empty do nothing
            if (string.IsNullOrWhiteSpace(msg))
            {
                return;
            }

            // Dismiss the keyboard
            KeyboardStatusService.DismissKeyboard(this, _messageInput);
            // send message
            var success = await ViewModel.SendMessage(msg);

            // if not sent reinstate text field contents
            if (success)
            {
                Finish();
            }
            else
            {
                Toast.MakeText(this, Resource.String.send_error, ToastLength.Short);
                _messageInput.Text = msg;
            }
        }
示例#2
0
        private async void OnSendClicked(object sender, EventArgs e)
        {
            //send the contents of the edit text
            var msg = _chatMessageInput.Text;

            // if text is empty do nothing
            if (string.IsNullOrWhiteSpace(msg))
            {
                return;
            }

            // clear text field
            _chatMessageInput.Text = "";
            KeyboardStatusService.DismissKeyboard(Activity, _chatMessageInput);
            // send message
            var success = await ViewModel.SendMessage(msg);

            // if not sent reinstate text field contents
            if (!success)
            {
                _chatMessageInput.Text = msg;
            }
        }
 private async void OnCancelClicked(object sender, EventArgs e)
 {
     // Dismiss the keyboard
     KeyboardStatusService.DismissKeyboard(this, _messageInput);
     Finish();
 }