示例#1
0
        /// <summary>
        /// The present.
        /// </summary>
        /// <param name="view">
        /// The view.
        /// </param>
        /// <param name="response">
        /// The response.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public static async Task Present(BaseViewModel view, AddContactResponse response)
        {
            switch (response.Code)
            {
            case ResponseCode.Success:
                await view.DisplayAlertAsync(
                    "Successful Request",
                    "Your new contact needs to accept the request before you can start chatting!");

                break;

            case ResponseCode.NoContactInformationPresent:
            case ResponseCode.AmbiguousContactInformation:
                await view.DisplayAlertAsync("Error", "It seems like the provided address is not a valid contact address.");

                break;

            case ResponseCode.MessengerException:
                await view.DisplayAlertAsync("Error", "It seems like the connection to the tangle failed. Try again later or change your node.");

                break;

            default:
                await view.DisplayAlertAsync("Error", "Something seems to be broken. Please try again later.");

                break;
            }
        }
示例#2
0
        /// <summary>
        /// The present.
        /// </summary>
        /// <param name="view">
        /// The view.
        /// </param>
        /// <param name="response">
        /// The response.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public static async Task Present(BaseViewModel view, SendMessageResponse response)
        {
            switch (response.Code)
            {
            case ResponseCode.Success:
                break;

            case ResponseCode.MessageTooLong:
                await view.DisplayAlertAsync("Error", $"Message is too long. Limit is {Constants.MessageCharacterLimit} characters.");

                break;

            default:
                await view.DisplayAlertAsync("Error", "Your message couldn't be send.");

                break;
            }
        }
示例#3
0
        async void LoadAllPlaces()
        {
            try
            {
                List <PlaceModel> places = await RestService.Instance.GetPlacesAsync();

                if (places == null)
                {
                    await _baseModel.DisplayAlertAsync(Services.MessagesTexts.error_message);
                }
                else
                {
                    foreach (PlaceModel place in places)
                    {
                        var position = new Position(Convert.ToDouble(place.Latitude), Convert.ToDouble(place.Longitude));
                        AddPin(place, position, true);
                    }
                }
            }
            catch
            {
                await _baseModel.DisplayAlertAsync(Services.MessagesTexts.error_message);
            }
        }