Forum Xamarin.Forms

Problem to get a list of objects from Azure Easy Tables

ArccexArccex DEMember
edited October 2016 in Xamarin.Forms

I tried to get a list of objects from a Azure database through the Mobileservice, but it never gets one item:

Eventmanager Class:

public static ObservableCollection<Event> oe;      //stays empty

    public static async Task<ObservableCollection<Event>> GetEventsAsync()
    {

        string ApplicationURL = "http://kanapa.azurewebsites.net";

        IMobileServiceTable<Event> eventTable;
        MobileServiceClient client;

        client = new MobileServiceClient(ApplicationURL);
        eventTable = client.GetTable<Event>();

        IEnumerable<Event> items = await eventTable.ToEnumerableAsync();

        oe = new ObservableCollection<Event>(items);

        System.Diagnostics.Debug.WriteLine("" + oe.Count); //Can't find message in diagnostics-console

        return new ObservableCollection<Event>(items);
    }

Event:

public class Event
{

    public string id { get; set; }
    public string germanDisplayName{ get; set; }
    public string polishDisplayName{ get; set; }
    public string locationGerman{ get; set;}
    public string locationPolish{ get; set; }
    public DateTime dateStart{ get; set; }
    public DateTime dateEnd { get; set; }
    public string imageUrl{ get; set; }
    public string descriptionGerman{ get; set;}
    public string descriptionPolish { get; set; }
    public Boolean isFavorite{ get; set;}
    public float x{ get; set; }
    public float y { get; set; }

}

EventsPage:

EventManager.GetEventsAsync();
events = EventManager.oe;

The database contains one event with all values.
Can someone help me?

Sign In or Register to comment.