public async void SendMessage(Message mes, string receiver)
        {
            UserHandler.GetAllUsers();
            User check = UserHandler.UserListToCheck.FirstOrDefault(x => x.Name == receiver);

            MessageDialog showDialog = new MessageDialog("Are you sure your message" +
                                                         " is ready to be sent?");

            showDialog.Commands.Add(new UICommand("Yes")
            {
                Id = 0
            });
            showDialog.Commands.Add(new UICommand("No")
            {
                Id = 1
            });
            showDialog.DefaultCommandIndex = 0;
            showDialog.CancelCommandIndex  = 1;
            var result = await showDialog.ShowAsync();

            if ((int)result.Id == 0)
            {
                if (check != null)
                {
                    await WebApi.Create(mes);
                }
                else
                {
                    MessageDialog msg = new MessageDialog("Cannot find a receiver", "Error");
                    await msg.ShowAsync();
                }
            }
            else
            {
            }
        }
示例#2
0
 public async void AddAllert(Alert alert)
 {
     await AWebApi.Create(alert);
 }
示例#3
0
 public async void AddNotification(Notification not)
 {
     await NWebApi.Create(not);
 }