Example #1
0
        public async Task BeginSearch()
        {
            try
            {
                if (!string.IsNullOrEmpty(SearchQuery.SearchText) ||
                    !string.IsNullOrEmpty(SearchQuery.ActorName) ||
                    SearchQuery.Batch != null ||
                    !string.IsNullOrEmpty(SearchQuery.Mood))
                {
                    EventAgg.PublishOnUIThread(new StartLoadingMessage("Searching for movies..."));

                    MovieList = await OnlineDB.Search(SearchQuery);

                    if (MovieList != null || MovieList.Count != 0)
                    {
                        EventAgg.PublishOnUIThread(new MovieListMessage(MovieList, true, SearchQuery.SearchText));
                    }
                }
            }
            catch
            {
                StatusMessage.Enqueue("Unknow error occured while searchig for movies!");
            }
            finally
            {
                EventAgg.PublishOnUIThread(new StopLoadingMessage());
            }
        }
Example #2
0
 public HomePageViewModel(INavigationService navigationService, IEventAggregator eventAggregator) : base(navigationService, eventAggregator)
 {
     EventAgg.GetEvent <LoggedInEvent>().Subscribe(HandleLoginEvent);
     ActionItems          = new ObservableCollection <ActionItem>();
     Properties           = new ObservableCollection <PropertyDetail>();
     PhoneCommand         = new DelegateCommand <string>(ExecPhoneCommand);
     EmailCommand         = new DelegateCommand <string>(ExecEmailCommand);
     HamburgerCommand     = new DelegateCommand(ExecHamburger);
     GroupByCommand       = new DelegateCommand(ExecGroupBy);
     ForwardCommand       = new DelegateCommand(ExecForward);
     IsLoading            = false;
     MultiSelect          = false;
     IsActionGrp          = true;
     IsNotActionGrp       = false;
     IsPrebillingSwiped   = false;
     IsUtilityAlertSwiped = false;
     GroupStr             = "Type";
     AmEmail    = "Loading. . .";
     AmPhone    = "Loading. . .";
     AmName     = "Loading. . .";
     PsrEmail   = "Loading. . .";
     PsrPhone   = "Loading. . .";
     PsrName    = "Loading. . .";
     SwipedItem = new ActionItem {
         ActionType = ActionItemType.PrebillingApproval
     };
     LoadText = "Inverting the flux capacitor. . .";
 }
Example #3
0
        public BaseViewModel(CommonParameters commonParameters)
        {
            EventAgg = commonParameters.EventAggregator;

            StatusMessage = commonParameters.StatusMessage;

            OfflineDB = commonParameters.OfflineService;
            OnlineDB  = commonParameters.OnlineService;

            EventAgg.Subscribe(this);
        }
Example #4
0
        public ListBaseViewModel(IListViewModelParams commonParameters)
        {
            EventAgg = commonParameters.EventAggregator;
            EventAgg.Subscribe(this);

            OfflineDB = commonParameters.OfflineService;

            Movies = new ObservableCollection <MovieCardViewModel>();

            StatusMessage = commonParameters.StatusMessage;
            ImageCacher   = commonParameters.ImageCacher;
        }
        /// <summary>
        /// Adds movies to the list that have been downloaded either from offline or online db
        /// </summary>
        public async void Handle(MovieListMessage message)
        {
            Movies.Clear();
            await Task.Run(() =>
            {
                foreach (Movie movie in message.Movielist)
                {
                    if (!string.IsNullOrEmpty(movie.Poster_path))
                    {
                        Movies movieEntity = ParseFromTmdb(movie);

                        base.ImageCacher.ScanPoster(movieEntity);

                        Movies.AddOnUIThread(new MovieCardViewModel(movieEntity, EventAgg));
                    }
                }
            });

            EventAgg.PublishOnUIThread(new ResultsReadyMessage());
        }
 public void NavigateToNextPage()
 {
     EventAgg.PublishOnUIThread(new BrowseSearchResultsMessage(++_onlineDB.SearchQuery.PageNumber));
 }