public DetailsModel(DevShop.Data.DevShopDbContext context, UserManager <ExtendedIdentityUser> userManager) { _userManager = userManager; _context = context; ViewModel = new DetailsPageViewModel(); ReturnUrl = "/Account/Cart"; }
public DetailsPage() { this.InitializeComponent(); this.ViewModel = new DetailsPageViewModel(); this.Loaded += DetailsPage_Loaded; ReadAppSettings(); }
public DetailsPage(Item _item) { InitializeComponent(); Item = _item; VM = new DetailsPageViewModel(_item); BindingContext = VM; }
public DetailsPage() { this.InitializeComponent(); detailsPageViewModel = new DetailsPageViewModel(); detailsPageViewModel.SetBook(BookEntity); DataContext = detailsPageViewModel; GetList(); }
/// <summary> /// Initializes class instance. /// </summary> public DetailsPageView() { InitializeComponent(); _viewModel = BindingContext as DetailsPageViewModel; foreach (BindableObject item in listView.ItemsSource) { item.BindingContext = _viewModel; } }
/// <summary> /// 当前用户信息 /// </summary> //private readonly UserManager<ExtendedIdentityUser> _userManager; //, UserManager<ExtendedIdentityUser> userManager public DetailsModel(OnlineBookstoreDBContext context, ILoginedService loginedService, IOrderService orderService, IUserService userService, IPurchaseService purchaseService) { //_userManager = userManager; _context = context; this._loginedService = loginedService; this._orderService = orderService; this._userService = userService; this._purchaseService = purchaseService; ViewModel = new DetailsPageViewModel(); }
public DetailsPage(DetailsPageViewModel viewModel) { BindingContext = viewModel; BackgroundColor = Color.PowderBlue; var textLabel = new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; textLabel.SetBinding(Label.TextProperty, nameof(DetailsPageViewModel.NoteText)); var backButton = new Button { Text = "Go Back", VerticalOptions = LayoutOptions.Center, Margin = new Thickness(20), BackgroundColor = Color.Red, TextColor = Color.White, FontSize = 20 }; backButton.SetBinding(Button.CommandProperty, nameof(DetailsPageViewModel.GoBackCommand)); var downSwipeGestureRecognizer = new SwipeGestureRecognizer { Direction = SwipeDirection.Down }; downSwipeGestureRecognizer.SetBinding(SwipeGestureRecognizer.CommandProperty, nameof(DetailsPageViewModel.GoBackCommand)); var stackLayout = new StackLayout { Margin = new Thickness(20, 40) }; stackLayout.Children.Add(textLabel); stackLayout.Children.Add(backButton); stackLayout.GestureRecognizers.Add(downSwipeGestureRecognizer); Content = stackLayout; }
public DetailsPage() { this.InitializeComponent(); this.DataContext = ViewModel = new DetailsPageViewModel(new Services.PhotosDataServices()); }
public DetailsPage(int cityID) { InitializeComponent(); BindingContext = new DetailsPageViewModel(cityID); }
public ActionResult Details(int id) { var postById = this.postsService .ById(id); if (postById == null) { this.TempData[Others.TempDataForError] = "Публикацията не е намерена."; return this.RedirectToAction("Index", "Home"); } var postMainInfo = this.Mapper.Map<PostExtendedViewModel>(postById); var postComments = this.commentsService .AllByPostId(id, Others.DefaultTakeSizeForComments) .To<CommentViewModel>() .ToList(); var data = new DetailsPageViewModel() { MainInfo = postMainInfo, Comments = postComments }; this.ViewBag.PostId = postMainInfo.Id; return this.View(data); }
public DetailsPage() { this.InitializeComponent(); ViewModel = new DetailsPageViewModel(); }
public DetailsPage() { InitializeComponent(); DataContext = new DetailsPageViewModel(); }
private void DetailsPage(int id) { Debug.WriteLine($"details page is called. Parameter destination = {id}"); CurrentViewModel = new DetailsPageViewModel(id); }
/// <summary> /// Bufferize previous and buffer detail page /// </summary> /// <param name="currentId"></param> private void bufferNextAndPreviousPage(int currentId) { int index = m_dataList.IndexOf(currentId); m_isPreviousEnable = (index > 0); m_isNextEnable = (index + 1 < m_dataList.Count); if (m_isPreviousEnable) { var previousElement = CacheManager.Instance.GetCacheElementFromId<Element>(m_dataList[index - 1]); ElementViewModel previousElementViewModel = null; if (previousElement is Word) previousElementViewModel = new WordViewModel(previousElement as Word); else if (previousElement is Contrepeterie) previousElementViewModel = new ContrepeterieViewModel(previousElement as Contrepeterie); m_previousViewModel = new DetailsPageViewModel(previousElementViewModel); } if (m_isNextEnable) { var nextElement = CacheManager.Instance.GetCacheElementFromId<Element>(m_dataList[index + 1]); ElementViewModel nextElementViewModel = null; if (nextElement is Word) nextElementViewModel = new WordViewModel(nextElement as Word); else if (nextElement is Contrepeterie) nextElementViewModel = new ContrepeterieViewModel(nextElement as Contrepeterie); m_nextViewModel = new DetailsPageViewModel(nextElementViewModel); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { m_isFromLiveTile = false; m_type = ListType.Unknow; // Retrieve aimed id //------------------------------------------------------------------------------------ int elementId = -128; // Retrieve the element ID to get its details if (NavigationContext.QueryString.Keys.Contains("id")) { var number = NavigationContext.QueryString["id"]; try { elementId = Convert.ToInt32(number); } catch (Exception) { } } if (elementId == -128) { errorGoBack(); } else if (elementId == -1) { // Special id: element stored for live tile if (m_isFromLiveTile == false) { m_isFromLiveTile = true; } elementId = Settings.LiveTileElementId; } // Cache not loaded (we're coming from tile) ? Load it if (CacheManager.Instance.IsInitialized == false) { CacheManager.Instance.Initialize(InitializeLevel.Update); } // Get the element from WS Element element = getElementFromId(elementId); // Create view models ElementViewModel elementVM = null; if (element is Word) { elementVM = new WordViewModel(element as Word); } else if (element is Contrepeterie) { var ctpVM = new ContrepeterieViewModel(element as Contrepeterie); ctpVM.IsSolutionRevealed = false; elementVM = ctpVM; } else { errorGoBack(); return; } if (elementVM.IsRead == false) elementVM.IsRead = true; m_viewModel = new DetailsPageViewModel(elementVM); m_viewModel.Orientation = Orientation; // Load data fetcher //------------------------------------------------------------------------------------ string fetcherType = ""; string param = ""; if (NavigationContext.QueryString.Keys.Contains("type")) { fetcherType = NavigationContext.QueryString["type"]; if (NavigationContext.QueryString.Keys.Contains("param")) { param = NavigationContext.QueryString["param"]; } } else if (m_isFromLiveTile) { if (element is Word) fetcherType = ListType.Words.ToString(); else fetcherType = ListType.Contrepeteries.ToString(); } else { throw new ArgumentException("fetcher type"); } m_dataList = getAllData((ListType)Enum.Parse(typeof(ListType), fetcherType, true), param); bufferNextAndPreviousPage(element.Id); // ------------------ m_viewModel.IsRead = true; setDataContext(m_viewModel); // Mark as read if from tile if (m_isFromLiveTile) { BackgroundWorker bworker = new BackgroundWorker(); bworker.DoWork += (o, args) => { // Delay Thread.Sleep(1000); Dispatcher.BeginInvoke(() => { TileData.FindAndUpdateTile(); }); }; bworker.RunWorkerAsync(); } // Dynamically load app bar icons updateAppBar(); base.OnNavigatedTo(e); }
private void setDataContext(DetailsPageViewModel viewModel) { DataContext = viewModel; // Mega hack ! if (m_viewModel.ElementViewModel is ContrepeterieViewModel) { var ctpvm = m_viewModel.ElementViewModel as ContrepeterieViewModel; ThreadPool.QueueUserWorkItem(delegate { Dispatcher.BeginInvoke(delegate { var grid = VisualChildFinder.FindVisualChild<Grid>(currentElementPResenter); if (grid != null) { ctpvm.ShowSolutionAnimation = (Storyboard)grid.Resources["showSolutionAnimation"]; } }); }); } }
private void loadPreviousElement() { m_viewModel = m_previousViewModel; bufferNextAndPreviousPage(m_previousViewModel.ElementViewModel.Id); m_viewModel.IsRead = true; setDataContext(m_viewModel); updateAppBar(); }
/// <summary> /// Initializes class instance. /// </summary> public DetailsPageView() { InitializeComponent(); _viewModel = BindingContext as DetailsPageViewModel; }
public void DetailsFor(ImageResult details) { ApplicationSettings.SelectedInstance = new SearchInstance(); ApplicationSettings.SelectedImage = details; ViewModel = new DetailsPageViewModel(ApplicationSettings, NavigationService, MessageHub, _shareMessagePump, new MockStatusService()); }
public DetailsPage() { InitializeComponent(); BindingContext = new DetailsPageViewModel(Navigation); }
public DetailsPage(CharacterModel character) { InitializeComponent(); BindingContext = new DetailsPageViewModel(character); }