public async Task ExecuteLoadWorkshopsCommandAsync()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                var items = (await StoreManager.WorkshopStore.GetSpeakerWorkshopsAsync(SelectedSpeaker.Id)).Where(x => x.Id != _workshopId);

                Workshops.ReplaceRange(items);

                HasAdditionalWorkshops = Workshops.Count > 0;
            }
            catch (Exception ex)
            {
                HasAdditionalWorkshops = false;
                Logger.Log(ex.Message, Prism.Logging.Category.Exception, Priority.High);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 2
0
        async Task <bool> ExecuteLoadWorkshopsAsync(bool force = false)
        {
            if (IsBusy)
            {
                return(false);
            }

            try
            {
                NextForceRefresh = DateTime.UtcNow.AddMinutes(45);
                IsBusy           = true;
                NoWorkshopsFound = false;
                Filter           = string.Empty;

                Workshops.ReplaceRange((await StoreManager.WorkshopStore.GetItemsAsync(force)).ToWorkshopCellViews(WorkshopCellViewModelFactory));

                WorkshopsFiltered.ReplaceRange(Workshops.Search());
                SortWorkshops();

                if (WorkshopsGrouped.Count == 0)
                {
                    if (Settings.FavoritesOnly)
                    {
                        if (!Settings.ShowPastWorkshops)
                        {
                            NoWorkshopsFoundMessage = "You haven't favorited\nany workshops yet.";
                        }
                        else
                        {
                            NoWorkshopsFoundMessage = "No Workshops Found";
                        }
                    }
                    else
                    {
                        NoWorkshopsFoundMessage = "No Workshops Found";
                    }

                    NoWorkshopsFound = true;
                }
                else
                {
                    NoWorkshopsFound = false;
                }
            }
            catch (Exception ex)
            {
                Logger.Log($"{ex.Message}, Method, ExecuteLoadWorkshopsAsync", Prism.Logging.Category.Exception, Priority.High);
                EventAggregator.GetEvent <ErrorEvent>().Publish(ex);
            }
            finally
            {
                IsBusy = false;
            }

            return(true);
        }