示例#1
0
        public async void loadData(string search = "0")
        {
            IsLoading = true;
            rootPage.NotifyUser(NotifyType.PrepareMessage);
            resetItems();

            try
            {
                ZHelpersREST rest = new ZHelpersREST("authors", "quotes", search);
                JSONdata = await rest.getResponse();

                if (search == "0")
                {
                    doAuthorsLandingPage(JSONdata);
                }
                else
                {
                    doAuthorsSearch(JSONdata);
                }

                rootPage.NotifyUser(NotifyType.StatusMessage);
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(NotifyType.ErrorMessage, ex.Message);
            }

            IsLoading = false;
        }
示例#2
0
        public async void loadData(string search = "0")
        {
            IsLoading = true;
            rootPage.NotifyUser(NotifyType.PrepareMessage);
            Items = new ObservableCollection <ZModelItem>();

            try
            {
                ZHelpersREST rest = new ZHelpersREST("author", "quotes", search);
                JSONdata = await rest.getResponse();

                var authorItems = JsonConvert.DeserializeObject <ZModelAuthorItems>(JSONdata).Items;
                if (Author == null)
                {
                    Author = JsonConvert.DeserializeObject <ZModelAuthorItems>(JSONdata).Author;
                }

                if (authorItems != null)
                {
                    // authorItems.ForEach(x => Items.Add(x));
                    foreach (var item in authorItems)
                    {
                        item.username = Author.username;
                        item.Text     = HtmlRemoval.SetLineBreaks(item.Text);
                        Items.Add(item);
                    }

                    rootPage.NotifyUser(NotifyType.StatusMessage);
                }
                else
                {
                    rootPage.NotifyUser(NotifyType.StatusMessage, "No items found.");
                }
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(NotifyType.ErrorMessage, ex.Message);
            }

            IsLoading = false;
        }
示例#3
0
        public async void loadData(string searchValue = "0")
        {
            resetItems();
            IsLoading = true;
            rootPage.NotifyUser(NotifyType.PrepareMessage);

            try
            {
                ZHelpersREST rest = new ZHelpersREST("homepage", "quotes", "0");
                JSONdata = await rest.getResponse();

                doData(JSONdata);
                rootPage.NotifyUser(NotifyType.StatusMessage);
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(NotifyType.ErrorMessage, ex.Message);
            }

            IsLoading = false;
        }
示例#4
0
        public async void loadData(string searchValue = "0", string view = "topics")
        {
            TopicItems    = new ObservableCollection <ZModelItem>();
            PopularTopics = new ObservableCollection <ZModelTopic>();

            IsLoading = true;
            rootPage.NotifyUser(NotifyType.PrepareMessage);

            try
            {
                ZHelpersREST rest = new ZHelpersREST(view, "quotes", searchValue);
                JSONdata = await rest.getResponse();

                doData(JSONdata, searchValue);
                rootPage.NotifyUser(NotifyType.StatusMessage);
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(NotifyType.ErrorMessage, ex.Message);
            }

            IsLoading = false;
        }
示例#5
0
        public async void loadData(string search = "0")
        {
            IsLoading = true;
            rootPage.NotifyUser(NotifyType.PrepareMessage);

            Items = new ObservableCollection <ZModelItem>();

            try
            {
                ZHelpersREST rest = new ZHelpersREST("items", "quotes", search, "best");
                JSONdata = await rest.getResponse();

                var json = JsonConvert.DeserializeObject <List <ZModelItem> >(JSONdata);
                json.ForEach(x => Items.Add(x));

                rootPage.NotifyUser(NotifyType.StatusMessage);
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(NotifyType.ErrorMessage, ex.Message);
            }

            IsLoading = false;
        }