Ejemplo n.º 1
0
        public IActionResult Browse()
        {
            BrowseView viewModel = new BrowseView();

            viewModel.UpcomingEvents = _context.events
                                       .Include(eve => eve.Listing)
                                       .ThenInclude(lis => lis.Address)
                                       .Include(eve => eve.Broker)
                                       .Include(eve => eve.EventVendors)
                                       .ThenInclude(ev => ev.Vendor)
                                       .Include(eve => eve.AreaOfHouse)
                                       .Where(eve => eve.OpenHouseDateTime > DateTime.Now)
                                       .Where(eve => eve.Confirmed == true)
                                       .ToList();
            viewModel.PastEvents = _context.events
                                   .Include(eve => eve.Listing)
                                   .ThenInclude(lis => lis.Address)
                                   .Include(eve => eve.Broker)
                                   .Include(eve => eve.EventVendors)
                                   .ThenInclude(ev => ev.Vendor)
                                   .Include(eve => eve.AreaOfHouse)
                                   .Where(eve => eve.OpenHouseDateTime < DateTime.Now)
                                   .Where(eve => eve.Confirmed == true)
                                   .ToList();
            return(View(viewModel));
        }
        public ActionResult Browse(int?id, int?page)
        {
            BrowseView browseView;


            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Category category = new Category();

            try
            {
                category   = ModelLists.Categories.Where(cat => cat.ClassId == id).Single();
                browseView = new BrowseView()
                {
                    Category = category,
                    Products = category.Products.Where(x => x.InactiveProduct == false).OrderBy(x => x.ProductName).ToPagedList(page ?? 1, 12)
                };
            }
            catch (Exception)
            {
                return(HttpNotFound());
            }

            return(View(browseView));
        }
        public BrowsePlugin(BrowseViewModel browseViewModel, BrowseSettings settings)
            : base(settings)
        {
            Order = 1;

            ContentView = new BrowseView
            {
                DataContext = browseViewModel
            };

            SettingsView = new BrowseSettingsView
            {
                DataContext = Settings
            };
        }
Ejemplo n.º 4
0
        private async void ExecuteShowBrowseWindowCommand()
        {
            var b = new BrowseView();

            b.ShowDialog();

            var vm = (BrowseViewModel)b.DataContext;

            if (vm.C9Entries == null)
            {
                return;
            }

            IsBusy = true;

            await Task.Factory.StartNew(() =>
            {
                if (Stories == null)
                {
                    Stories = new ObservableCollection <Story>();
                }

                foreach (var item in vm.C9Entries)
                {
                    if (item.Selected)
                    {
                        var entryBody = GetEntryBody(item.EntryUrl);

                        DispatcherHelper.CheckBeginInvokeOnUI(
                            () =>
                        {
                            Stories.Add(new Story
                            {
                                Title    = item.Title,
                                ImageUrl = item.ImageUrl,
                                EntryUrl = item.EntryUrl,
                                BodyHtml = entryBody
                            });
                        });
                    }
                }
            });


            IsBusy = false;
        }
Ejemplo n.º 5
0
        public void AppStartup(object sender, StartupEventArgs e)
        {
            var browseView = new BrowseView();

            browseView.Show();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Read all about this, but this is a nice way if there were multiple
        /// fragments on the screen for us to decide what and where to show stuff
        /// See: http://enginecore.blogspot.ro/2013/06/more-dynamic-android-fragments-with.html
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public bool Show(MvxViewModelRequest request)
        {
            try
            {
                MvxFragment frag    = null;
                var         title   = string.Empty;
                var         section = this.ViewModel.GetSectionForViewModelType(request.ViewModelType);

                switch (section)
                {
                case HomeViewModel.Section.Browse:
                {
                    if (this.SupportFragmentManager.FindFragmentById(Resource.Id.content_frame) as BrowseView != null)
                    {
                        return(true);
                    }

                    frag  = new BrowseView();
                    title = "Browse";
                }
                break;

                case HomeViewModel.Section.Friends:
                {
                    if (this.SupportFragmentManager.FindFragmentById(Resource.Id.content_frame) as FriendsView != null)
                    {
                        return(true);
                    }

                    frag  = new FriendsView();
                    title = "Friends";
                }
                break;

                case HomeViewModel.Section.Profile:
                {
                    if (this.SupportFragmentManager.FindFragmentById(Resource.Id.content_frame) as ProfileView != null)
                    {
                        return(true);
                    }

                    frag  = new ProfileView();
                    title = "Profile";
                }
                break;
                }

                var loaderService = Mvx.Resolve <IMvxViewModelLoader>();
                var viewModel     = loaderService.LoadViewModel(request, null /* saved state */);

                frag.ViewModel = viewModel;

                // TODO - replace this with extension method when available

                //Normally we would do this, but we already have it
                this.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, frag).Commit();
                this._drawerList.SetItemChecked(this.ViewModel.MenuItems.FindIndex(m => m.Id == (int)section), true);
                this.ActionBar.Title = this._title = title;

                this._drawer.CloseDrawer(this._drawerList);

                return(true);
            }
            finally
            {
                this._drawer.CloseDrawer(this._drawerList);
            }
        }