// GET: Contacts public ActionResult Index(string searchKey, int Index = 1, int pageSize = 6) { //当前分页数据集合 var model = new ContactsApp().GetCustorms(searchKey, Index, pageSize); var newmodel = model.Skip((Index - 1) * pageSize).Take(pageSize); //当前ViewModel传递试图 BasePageModel page = new BasePageModel() { SearchKeyWord = searchKey , CurrentIndex = Int32.Parse(Index.ToString()), TotalCount = model.Count() }; ViewData["pagemodel"] = page; return(View(new ContactsViewModel { SearchKey = searchKey, Posts = newmodel, PageModel = page, PagingInfo = new Models.PagingInfo { TotalItems = model.Count(), PageIndex = Index, PageSize = pageSize } })); }
public static Page Init(BasePageModel model) { var navigation = new NavigationService(); var page = navigation.GetPage(model); return(new NavigationPage(page)); }
public RootContainerPage() { _contactNavPage = new NavigationPage(BasePageModel.ResolvePageModel <ContactsRootPageModel> (null)); _quotesNavPage = new NavigationPage(BasePageModel.ResolvePageModel <QuotesRootPageModel> (null)); Detail = _contactNavPage; _menuPage = new ContentPage(); _menuPage.Title = "Menu"; var listView = new ListView(); listView.ItemsSource = new string[] { "Contacts", "Quotes" }; listView.ItemSelected += (sender, args) => { if ((string)args.SelectedItem == "Contacts") { Detail = _contactNavPage; } if ((string)args.SelectedItem == "Quotes") { Detail = _quotesNavPage; } IsPresented = false; }; _menuPage.Content = listView; Master = new NavigationPage(_menuPage) { Title = "Menu" }; }
public void PushView(BasePageModel viewModelToPush, Page pageToPush, bool model) { if (model) this.CurrentPage.Navigation.PushModalAsync (pageToPush); else this.CurrentPage.Navigation.PushAsync (pageToPush); }
public App() { InitializeComponent(); BasePageModel.InitApp(); On <Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize); (FreshIOC.Container.Resolve <IStoreManager>()).VerifyToken(); if (((bool)Properties["DisclaimerApproved"]) == true && DateTime.Now.Subtract(((DateTime)Properties["DisclaimerApprovedDate"])).TotalDays <= 90) { MainPage = new MasterDetailNavigationPage(); } else { var page = FreshMvvm.FreshPageModelResolver.ResolvePageModel <DisclaimerPageModel>(); var navigationContainer = new AONNavigationContainer(page); navigationContainer.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true); MainPage = navigationContainer; } }
public App() { InitializeComponent(); BasePageModel.Init(); // Init(); MainPage = new Pages.ConnexionPage(); }
async void Init() { new LanguageService().SetLanguage(); if (Settings.IsLoggedIn) { var storeManager = new BasePageModel().StoreManager; if (StoreManager.NeedsTokenRefresh()) { var isRefreshed = await storeManager.RegenerateToken(); if (isRefreshed) { if (Settings.HasToCompleteChat) { // open chat var page = FreshPageModelResolver.ResolvePageModel <ChatPageModel>(); MainPage = new FreshNavigationContainer(page); } else { await storeManager.UserStore.UpdateCurrentUser(null); MainPage = TabNavigator.GenerateTabPage(); } } else { var page = FreshPageModelResolver.ResolvePageModel <TutorialPageModel>(); MainPage = new FreshNavigationContainer(page); } } else { if (Settings.HasToCompleteChat) { // open chat var page = FreshPageModelResolver.ResolvePageModel <ChatPageModel>(); MainPage = new FreshNavigationContainer(page); } else { await storeManager.UserStore.UpdateCurrentUser(null); MainPage = TabNavigator.GenerateTabPage(); } } UpdateSubscription(); } else { var page = FreshPageModelResolver.ResolvePageModel <TutorialPageModel>(); MainPage = new FreshNavigationContainer(page); } }
public void Remove(BasePageModel model) { var page = Application.Current.MainPage.Navigation.NavigationStack.FirstOrDefault(p => p.BindingContext.Equals(model)); if (page != null) { Application.Current.MainPage.Navigation.RemovePage(page); } }
public MessageModel <PageModel <Vow> > GetVowPageList([FromQuery] BasePageModel model) { var data = new MessageModel <PageModel <Vow> >(); //var list = this._vowService.GetVowList(model); //data.success = true; //data.msg = "数据获取成功"; //data.response.data = list.Item1; //data.response.TotalCount = list.Item2; return(data); }
public void PushView(BasePageModel viewModelToPush, Page pageToPush, bool model) { if (model) { this.CurrentPage.Navigation.PushModalAsync(pageToPush); } else { this.CurrentPage.Navigation.PushAsync(pageToPush); } }
private Page GetPage(BasePageModel model) { model.Navigation = this; var pageTypeName = model.GetType().AssemblyQualifiedName.Replace("PageModel", "Page").Replace("ViewModel", "View"); var pageType = Type.GetType(pageTypeName); var page = (ContentPage)Activator.CreateInstance(pageType); page.Appearing += model.OnPageAppearing; page.BindingContext = model; return(page); }
/// <summary> /// 分页标签 /// </summary> /// <param name="urlHelper"></param> /// <param name="pageModel"></param> /// <param name="index"></param> /// <param name="isCurrentIndex"></param> /// <param name="isDisable"></param> /// <param name="content"></param> /// <returns></returns> public static MvcHtmlString CreatPageLiTag(this UrlHelper urlHelper, BasePageModel pageModel, int index, bool isCurrentIndex = false, bool isDisable = true, string content = "") { string url = urlHelper.Action(pageModel.ActionName, new { searchkey = pageModel.SearchKeyWord, index = index }); string activeClass = !isCurrentIndex ? string.Empty : "class='active'"; string disableClass = isDisable ? string.Empty : "class='disabled'"; url = isDisable ? "href='" + url + "'" : string.Empty; string contentString = string.IsNullOrEmpty(content) ? index.ToString() : content; return(new MvcHtmlString("<li " + activeClass + disableClass + "><a " + url + ">" + contentString + "</a></li>")); }
public App() { InitializeComponent(); ProductConstants.Init(); PclStorage.Init(); BasePageModel.Init(); storeManager = DependencyService.Get <IStoreManager>() as StoreManager; Init(); MainPage = new ContentPage(); }
public static void DisplayAlert(this Exception exception, BasePageModel pageModel) { Console.WriteLine("EXCEPTION: " + exception.GetType() + ", " + exception.Message); if (pageModel == null) { return; } var exceptionSubtype = exception .GetType() .ToString() .Split('.') .ToList() .Last(); pageModel.CoreMethods.DisplayAlert("Error", exception.Message + "\n\n" + exceptionSubtype, "Close"); }
public App() { InitializeComponent(); FlowListView.Init(); BasePageModel.Initialize(); BasePageModel.DefaultNavigationBackgroundColor(); MainPage = new ContentPage(); OneSignal.Current.StartInit(Constants.OneSignalID).Settings(new Dictionary <string, bool>() { { IOSSettings.kOSSettingsKeyAutoPrompt, false } }).InFocusDisplaying(OSInFocusDisplayOption.Notification).EndInit(); Init(); }
public MainContainerPage() { var jellyBeanListPage = new BaseNav(BasePageModel.ResolveViewModel <JellyBeanListPageModel> (null)); jellyBeanListPage.Title = "Jelly Bean Prices"; jellyBeanListPage.Icon = "Icons/peanuts/peanuts.png"; var graphPage = new BaseNav(BasePageModel.ResolveViewModel <GraphPageModel> (null)); graphPage.Title = "Price Graph"; graphPage.Icon = "Icons/line_chart/line_chart.png"; var myBeansPage = new BaseNav(BasePageModel.ResolveViewModel <MyJellyBeansListModel> (null)); myBeansPage.Title = "My JellyBeans"; myBeansPage.Icon = "Icons/purchase_order/purchase_order.png"; var myReportPage = new BaseNav(BasePageModel.ResolveViewModel <JellyBeanProfitPageModel> (null)); myReportPage.Title = "Profit Report"; myReportPage.Icon = "Icons/money_bag/money_bag.png"; Children.Add(jellyBeanListPage); Children.Add(graphPage); Children.Add(myBeansPage); Children.Add(myReportPage); }
public void PushPage (Page page, BasePageModel model) { ((NavigationPage)Detail).PushAsync (page); }
public CatalogueProgramModel(TabMeditationModel model, Meditation meditation) { Model = model; Meditation = meditation; Tint = model.Tint; Title = (meditation.Length.HasValue ? meditation.Length.Value / 60 : 0) + " min"; int seanceCount = 0; if (meditation.Level1FrWoman != null) { seanceCount += 1; } if (meditation.Level2FrWoman != null) { seanceCount += 1; } if (meditation.Level3FrWoman != null) { seanceCount += 2; } SubTitle = seanceCount + (" " + (seanceCount == 1 ? AppResources.seance : AppResources.seances)); var user = new BasePageModel().StoreManager.UserStore.User; Text = Settings.DeviceLanguage == "English" ? meditation.Label_EN : meditation.Label; if (model.Program.IsTraining == true || model.Program.IsInitiation == true) { IsEnabled = true; } else if (model.Program.AvailableWithSubscription == true) { IsIncludedInSubscription = true; if (user.Subscription == SubscriptionType.free) { IsEnabled = false; } else { IsEnabled = true; } } else { if (user.Subscription == SubscriptionType.free) { IsEnabled = false; } else { if (model.Program.Price > 0) { if (user.PaidPrograms != null) { foreach (var item in user.PaidPrograms) { if (item.Id == model.Program.Id) { IsEnabled = true; break; } else { IsEnabled = false; } } } else { IsEnabled = false; } } else if (model.Program.Price == 0) { IsEnabled = true; } } } }
public TTab(BasePageModel ParentViewModel) { Parent = ParentViewModel; }
public static bool IsStartItem(this BasePageModel item) { return(item.Id.ToString() == GetStartItemGuid()); }
public BasePage(BasePageModel model) { BindingContext = model; }
public void PushPage(Page page, BasePageModel model) { ((NavigationPage)Detail).PushAsync(page); }
public void Push(BasePageModel model) { var page = GetPage(model); Application.Current.MainPage.Navigation.PushAsync(page, false); }