Mostrando entradas con la etiqueta XAMARIN. Mostrar todas las entradas
Mostrando entradas con la etiqueta XAMARIN. Mostrar todas las entradas

miércoles, 1 de junio de 2022

System.ArgumentException Mensaje = [Acr.UserDialogs] This is the bait library, not the platform library. You must install the nuget package in your main executable/application project

 System.ArgumentException

  Mensaje = [Acr.UserDialogs] This is the bait library, not the platform library.  You must install the nuget package in your main executable/application project














Se debe inicializar en el archivo MainActivity,cs del proyecto Android 

Se debe tener en cuenta la compatibilidad del nuget con tu versión de proyecto.

Android Initialization (In your main activity)

UserDialogs.Init(this);
OR UserDialogs.Init(() => provide your own top level activity provider)

sábado, 19 de septiembre de 2020

Selected Item Picker XAMARIN no funciona

CLASE DE OBJETO SELECCIONADO

 public class ItemsSourcesModel : ModelBase

    {

        string itemDisplay;

        string itemnId;

        public string ItemDisplay

        {

            get { return itemDisplay; }

            set

            {

                itemDisplay = value;

                OnPropertyChanged();

            }

        }

        public string ItemnId

        {

            get { return itemnId; }

            set

            {

                itemnId = value;

                OnPropertyChanged();

            }

        } 

    }


// VIEW MODEL Selected Item

public ItemsSourcesModel SelectedItemPicker1

        {

            get { return _selectedItemPicker1; }

            set

            {

                _selectedItemPicker1 = value;

                OnPropertyChanged("SelectedItemPicker1");

            }

        }

 

 ASIGNACION DE VALOR


 ItemsSourcesModel itemSelect = new ItemsSourcesModel();

 itemSelect.ItemnId = “1”;

 itemSelect.ItemDisplay = “Valor 1”;                         

 SelectedItemPicker1 = itemSelect;


// SOLUCION:

En la clase se debe agragar la interfaz IEquatable, con esto me funciono

 public class ItemsSourcesModel : ModelBase , IEquatable<ItemsSourcesModel>

    {
        string itemDisplay;
        string itemnId;
        public string ItemDisplay
        {
            get { return itemDisplay; }
            set
            {
                itemDisplay = value;
                OnPropertyChanged();
            }
        }
        public string ItemnId
        {
            get { return itemnId; }
            set
            {
                itemnId = value;
                OnPropertyChanged();
            }
        }

        public bool Equals(ItemsSourcesModel other)
        {
            if (other == null) return false;
            return (this.ItemDisplay.Equals(other.ItemDisplay));
        }
    }

miércoles, 2 de septiembre de 2020

¿Cómo puedo crear un evento de clic de botón dinámico en un botón dinámico?

 

Button button = new Button();
button.Click += new EventHandler(button_Click);

protected void button_Click (object sender, EventArgs e)
{
    //TU CODIGO
}

lunes, 31 de agosto de 2020

Establecer color hexadecimal a label xamarin forms

 Hexadecimal:

                    Label LabelGen = new Label

                    {

                        Text = "Text del label",

                        FontSize = 12,

                        TextColor = Color.FromHex("#122E3D"),

                    };


Enumerador de color:

                Label labelGen = new Label

                {

                     Text = "Text del label",

                    TextColor = Color.Blue,

                };


jueves, 28 de mayo de 2020

Severity Code Description Project File Line Suppression State Error unexpected element found in . Poyecto.Android

Al migrar abrir mi proyecto xamarin en visual studio 2019 me comenzo a aparecer este error:
Severity Code Description Project File Line Suppression State Error unexpected element <receiver> found in <manifest>. Poyecto.Android

Solucion:

abra su archivo AndroidManifest.xml y comente todo los uses-permission y receiver, recompile y ya no deberia de aparecer el error.

al compilar generara un nuevo archivo AndroidManifest en las carpetas de compilacion.

jueves, 12 de marzo de 2020

Problema al llamar a Get Method of a Rest API en la web en mi código Xamarin.Forms

 System.NullReferenceException: Object reference not set to an instance of an object.


Estoy tratando de consumir un método Get de un WebAPI aleatorio en la Web a través de mi Xamarin.Formscódigo. Pero no puedo llamar a esa API.

Codigo Inicial


  private HttpClient httpClient;  

  public async Task<List<User>> GetUsersGroup(string group)

        {          
            List<User> users1 = new List<User>();

            var url = $"{Config.RoomsEndPoint}/{group}";
            var result = await httpClient.GetStringAsync(url);
            users1 = JsonConvert.DeserializeObject<List<User>>(result);
            return users1;


        }

Solucion


private HttpClient httpClient; 

public async Task<List<User>> GetUsersGroup(string group)
        {
            if (httpClient == null)
            {
                httpClient = new HttpClient();
            }
            List<User> users1 = new List<User>();

            var url = $"{Config.RoomsEndPoint}/{group}";
            var result = await httpClient.GetStringAsync(url);
            users1 = JsonConvert.DeserializeObject<List<User>>(result);
            return users1;


        }

function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method

The 'AddToGroup' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'AddToGroup'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRGroupActions' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'Messages' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Messages'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRMessages' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'negotiate' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'negotiate'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRConnectionInfo' to type SignalRConnectionInfo. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'RemoveFromGroup' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'RemoveFromGroup'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRGroupActions' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'User' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'User'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'userTable' to type CloudTable. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'Users' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Users'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'usersTable' to type CloudTable. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
Hosting environment: Production
Content root path: C:\DevProjects\OrdenesTrabajo\Mobile\Trino\ChatTrino.Function\bin\Debug\netcoreapp2.1


Solución 


Pude solucionar este problema agregando el paquete NuGet
Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator

martes, 10 de marzo de 2020

The $(TargetFrameworkVersion) for Trino.Android (v8.1) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (9.0). You need to increase the $(TargetFrameworkVersion)

Severity Code Description Project File Line Suppression State
Error The $(TargetFrameworkVersion) for Trino.Android (v8.1) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (9.0). You need to increase the $(TargetFrameworkVersion) for Trino.Android. Trino.Android



Tuve un problema similar resuelto siguiendo los pasos
1. Vaya a C: \ Archivos de programa (x86) \ Android \ android-sdk
2. ejecute SDK Manager.exe.
3. Haga clic en Actualizar los paquetes. (Descargará las actualizaciones necesarias)
4. Vaya a Propiedades de la aplicación
5. Configure la versión de Android de destino (6 o 7 según el error).

lunes, 9 de marzo de 2020

Error: unexpected element found in XAMARIN

De repente recibo este error de compilación en VS 2019 pero no en VS 2017 cuando construyo mi proyecto de Android:
unexpected element <receiver> found in <manifest>
Solución:

entrar a las opciones del proyecto android y marcar la propiedad Use Incremental Android packaging system (aapt2)



Despues compilar
volver a entrar a esa opcion y desmarcar.




Compilar, y ya no debe marcar ese error.

martes, 18 de febrero de 2020

Collection was modified, enumeration operation may not execute XAMARIN FORMS

Este es un error bastante común: modificar una colección mientras la itera usando foreach, tenga en cuenta que foreachusa una IEnumeratorinstancia de solo lectura .
Intente recorrer la colección for()con una comprobación de índice adicional, de modo que si el índice está fuera de los límites, podrá aplicar una lógica adicional para manejarlo. También puede usar LINQ Count()como otra condición de salida de bucle evaluando el Countvalor cada vez si la enumeración subyacente no se implementa ICollection.

Solucione el problema sacando el unitofwork.save fuera del foreach

jueves, 1 de agosto de 2019

Xamarin.Android para Visual Studio requiere Android SDK

Descripcion del error
Error de estado de supresión de línea Xamarin.Android para Visual Studio requiere Android SDK. 
Instálelo o configure la ruta del SDK de Android en Herramientas-> Opciones-> Xamarin-> Menú de configuración de Android. 0  

Seguí el error en el campo en el que puede ingresar la ruta al SDK. Le doy la ruta, pero luego ocurre otro problema. Hay una X al lado de la ruta. Esto ocurre después de la última actualización de Visual Studio 2017

Solución.
Ejecutar Visual Studio Instaler, desintalar el sdk mas reciente, volver a abrir el sdk e instalar de nuevo el sdk... eso soluciono el problema.

viernes, 22 de marzo de 2019

COLOCAR UNA IMAGEN EN UN CÍRCULO (XAMARIN)


  1. Agregamos el Nuget: (Xam.Plugins.forms.Image Circle):
















2 Luego en la pagina que se va a utilizar se referencia así:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
            x:Class="Z_Mobile.Pages.UserPage"
            Title="Z-Mobile"
            BackgroundColor="{StaticResource BackgroundColor}"
            BindingContext="{Binding Main, Source={StaticResource Locator}}">

3 El control:

<controls:CircleImage
 Source="{Binding Photo}"
 Aspect="AspectFill"
 WidthRequest="300"
 HeightRequest="300">
</controls:CircleImage>