Example #1
0
        public async override void Init(object initData)
        {
            base.Init(initData);

            if (initData is MasterMenuItem)
            {
                Title = ((MasterMenuItem)initData).Title;

                IsLoading = true;

                IEnumerable <Publication> data;

                if (string.IsNullOrEmpty(((MasterMenuItem)initData).PublicationId))
                {
                    data = await StoreManager.PublicationStore.GetItemsAsync();
                }
                else
                {
                    data = await StoreManager.PublicationStore.GetPublicationsByCategoryId(publicationId = ((MasterMenuItem)initData).PublicationId);
                }

                CategoryData = await StoreManager.ConfigurationStore.GetCategories();

                ItemsSource = new ObservableCollection <PublicationModel>();

                var accountId = Application.Current.Properties["AccountID"];

                if (data != null && data.Any())
                {
                    for (int i = 0; i < data.Count(); i++)
                    {
                        var    x        = data.ElementAt(i);
                        string category = "";

                        if (CategoryData != null && CategoryData.Any() && !string.IsNullOrEmpty(x.Category))
                        {
                            category = CategoryData.Where((arg) => arg.Item1 == x.Category)?.First()?.Item2;
                        }

                        ItemsSource.Add(new PublicationModel()
                        {
                            Title       = x.Title,
                            LikeCount   = x.CountLike,
                            Description = category + (string.IsNullOrEmpty(x.Author) ? " " : " by ") + x.Author,
                            Date        = x.PublishedAt.DateTime,
                            publication = x,
                            BackColor   = i % 2 == 0 ? "#eff2f3" : "#ffffff",
                            PreviewText = (x.Description),
                            Image       = $"https://admin.axa-im-insight.com/kue/storage/{accountId}/documents/{x.Id}/pdf/thumbs/1.jpg"
                        });
                    }
                }

                AllItemsSource = ItemsSource;

                IsLoading = false;
            }

            IsSelected = false;
        }
Example #2
0
        protected async override void ViewIsAppearing(object sender, EventArgs e)
        {
            base.ViewIsAppearing(sender, e);

            IsLoading = true;

            var data = await StoreManager.PublicationStore.GetDownloadedPublications();

            CategoryData = await StoreManager.ConfigurationStore.GetCategories();

            ItemsSource = new ObservableCollection <PublicationModel>();

            var accountId = Application.Current.Properties["AccountID"];

            if (data != null && data.Any())
            {
                for (int i = 0; i < data.Count(); i++)
                {
                    var    x        = data.ElementAt(i);
                    string category = "";

                    if (CategoryData != null && CategoryData.Any() && !string.IsNullOrEmpty(x.Category))
                    {
                        category = CategoryData.Where((arg) => arg.Item1 == x.Category)?.First()?.Item2;
                    }

                    ItemsSource.Add(new PublicationModel()
                    {
                        Title       = x.Title,
                        LikeCount   = x.CountLike,
                        Description = category + (string.IsNullOrEmpty(x.Author) ? " " : " by ") + x.Author,
                        Date        = x.PublishedAt.DateTime,
                        publication = x,
                        BackColor   = i % 2 == 0 ? "#eff2f3" : "#ffffff",
                        PreviewText = (x.Description),
                        Image       = $"https://admin.axa-im-insight.com/kue/storage/{accountId}/documents/{x.Id}/pdf/thumbs/1.jpg"
                    });
                }
            }

            AllItemsSource = ItemsSource;

            if (ItemsSource.Any())
            {
                ShowDownload = false;
            }
            else
            {
                ShowDownload = true;
            }

            IsLoading = false;

            IsSelected = false;
        }