public static NewsListPageViewModel Create(NewsListPage currentPage, int page) {
     var model= new NewsListPageViewModel(currentPage);
     PageViewModelBuilder.SetBaseProperties(model);
     model.News = new PagedList<NewsPage>(GetNews(currentPage), page, PageSize);
     model.NewsHolders = GetNewsHolders(currentPage);
     model.Page = page;
     return model;
 }
Beispiel #2
0
        public static NewsListPageViewModel Create(NewsListPage currentPage, int page)
        {
            var model = new NewsListPageViewModel(currentPage);

            PageViewModelBuilder.SetBaseProperties(model);
            model.News        = new PagedList <NewsPage>(GetNews(currentPage), page, PageSize);
            model.NewsHolders = GetNewsHolders(currentPage);
            model.Page        = page;
            return(model);
        }
Beispiel #3
0
        // Constructor
        public NewsListPage()
        {
            InitializeComponent();
            AnimationContext = LayoutRoot;

            _vm = App.MainViewModel.NewsPage = new NewsListPageViewModel();
            _vm.PropertyChanged += _vm_PropertyChanged;
            _vm.Load();
            DataContext = _vm;

            ListBox_News.LoadMore  += ListBox_News_LoadMore;
            Button_FirstItem.Click += new RoutedEventHandler(Button_FirstItem_Click);
        }
Beispiel #4
0
        public ViewResult Index(NewsListPage currentPage, int nextPage = 0)
        {
            var chunk = GetListChunk(currentPage.ContentGuid, currentPage.Language.Name, nextPage);

            // nextPage = 3
            // /news-list/2
            // /news-list/4

            var url = UrlResolver.Service.GetUrl(currentPage);

            var viewModel = new NewsListPageViewModel(currentPage)
            {
                Chunk   = chunk,
                RelMeta = new RelMetaModel
                {
                    RelPrev = nextPage > 1 ? $"{url}{nextPage - 1}" : "",
                    RelNext = chunk.ShowNextPage ? $"{url}{nextPage + 1}" : ""
                }
            };

            return(View(viewModel));
        }
Beispiel #5
0
        public ViewModelLocator()
        {
            try
            {
                var config = new ConfigurationBuilder();
                config.AddJsonFile(Directory.GetParent(Environment.CurrentDirectory).Parent.FullName + "\\Resources\\autofac.json");
                var module  = new ConfigurationModule(config.Build());
                var builder = new ContainerBuilder();
                builder.RegisterModule(module);
                Container = builder.Build();

                navigationService = Container.Resolve <INavigationService>();
                appViewModel      = Container.Resolve <AppViewModel>();
                //
                LogInViewModel                = Container.Resolve <LogInPageViewModel>();
                MainDesktopPageViewModel      = Container.Resolve <MainDesktopPageViewModel>();
                CalendarPageViewModel         = Container.Resolve <CalendarPageViewModel>();
                AddEditEventPageViewModel     = Container.Resolve <AddEditEventPageViewModel>();
                GMailPageViewModel            = Container.Resolve <GMailPageViewModel>();
                ReadMailPageViewModel         = Container.Resolve <ReadMailPageViewModel>();
                SchedulePageViewModel         = Container.Resolve <SchedulePageViewModel>();
                DocumentsPageViewModel        = Container.Resolve <DocumentsPageViewModel>();
                NewsPageViewModel             = Container.Resolve <NewsPageViewModel>();
                SettingsPageViewModel         = Container.Resolve <SettingsPageViewModel>();
                ContactsPageViewModel         = Container.Resolve <ContactsPageViewModel>();
                ComposeNewMailPageViewModel   = Container.Resolve <ComposeNewMailPageViewModel>();
                AdminPanelPageViewModel       = Container.Resolve <AdminPanelPageViewModel>();
                AddNewUserPageViewModel       = Container.Resolve <AddNewUserPageViewModel>();
                NormativeInfoPageViewModel    = Container.Resolve <NormativeInfoPageViewModel>();
                AddNewsPageViewModel          = Container.Resolve <AddNewsPageViewModel>();
                NewsListPageViewModel         = Container.Resolve <NewsListPageViewModel>();
                ConstantsPageViewModel        = Container.Resolve <ConstantsPageViewModel>();
                ChangeMyPassPageViewModel     = Container.Resolve <ChangeMyPassPageViewModel>();
                CreateNewContactPageViewModel = Container.Resolve <CreateNewContactPageViewModel>();
                DocPageViewModel              = Container.Resolve <DocPageViewModel>();
                ShowHistoryPageViewModel      = Container.Resolve <ShowHistoryPageViewModel>();

                navigationService.Register <LogInPageView>(LogInViewModel);
                navigationService.Register <MainDesktopPageView>(MainDesktopPageViewModel);
                navigationService.Register <CalendarPageView>(CalendarPageViewModel);
                navigationService.Register <AddEditEventPageView>(AddEditEventPageViewModel);
                navigationService.Register <GMailPageView>(GMailPageViewModel);
                navigationService.Register <ReadMailPageView>(ReadMailPageViewModel);
                navigationService.Register <SchedulePageView>(SchedulePageViewModel);
                navigationService.Register <DocumentsPageView>(DocumentsPageViewModel);
                navigationService.Register <NewsPageView>(NewsPageViewModel);
                navigationService.Register <SettingsPageView>(SettingsPageViewModel);
                navigationService.Register <ContactsPageView>(ContactsPageViewModel);
                navigationService.Register <ComposeNewMailPageView>(ComposeNewMailPageViewModel);
                navigationService.Register <AdminPanelPageView>(AdminPanelPageViewModel);
                navigationService.Register <AddNewUserPageView>(AddNewUserPageViewModel);
                navigationService.Register <NormativeInfoPageView>(NormativeInfoPageViewModel);
                navigationService.Register <AddNewsPageView>(AddNewsPageViewModel);
                navigationService.Register <NewsListPageView>(NewsListPageViewModel);
                navigationService.Register <ConstantsPageView>(ConstantsPageViewModel);
                navigationService.Register <ChangeMyPassPageView>(ChangeMyPassPageViewModel);
                navigationService.Register <CreateNewContactPageView>(CreateNewContactPageViewModel);
                navigationService.Register <DocPageView>(DocPageViewModel);
                navigationService.Register <ShowHistoryPageView>(ShowHistoryPageViewModel);

                navigationService.Navigate <LogInPageView>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }