public async Task <IActionResult> History(int page = 1) { int take = 15; int skip = take * (page - 1); var history = await _userService .GetPaginatedUserHistoryAsync(GetActiveUserId(), skip, take); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = history.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } User user = await _userService.GetDetails(GetActiveUserId()); HistoryListViewModel viewModel = new HistoryListViewModel() { Historys = new List <HistoryItemViewModel>(), PaginateModel = paginateModel, HouseholdCount = await _userService .FamilyMemberCountAsync(user.HouseholdHeadUserId ?? user.Id), HasAccount = !string.IsNullOrWhiteSpace(user.Username), TotalPoints = user.PointsEarned }; foreach (var item in history.Data) { if (item.ChallengeId != null) { var url = Url.Action("Detail", "Challenges", new { id = item.ChallengeId }); item.Description = $"<a target='_blank' href='{url}'>{item.Description}</a>"; } HistoryItemViewModel itemModel = new HistoryItemViewModel() { CreatedAt = item.CreatedAt.ToString("d"), Description = item.Description, PointsEarned = item.PointsEarned, }; if (!string.IsNullOrWhiteSpace(item.BadgeFilename)) { itemModel.BadgeFilename = _pathResolver.ResolveContentPath(item.BadgeFilename); } viewModel.Historys.Add(itemModel); } return(View(viewModel)); }
public ShellWindowViewModel(IConfigurationService configurationService, CreateItemViewModel creator, HistoryListViewModel historyList, SettingsWindowManager settingsManager) { _settingsManager = settingsManager; _configurationAgent = configurationService.GetConfigurationAgent <ShellConfiguration>(ApplicationConfigurations.ShellConfiguration, this); _subscriptions = _configurationAgent.Updated.ObserveOnDispatcher().Do(x => { RefreshConfig(); }).Subscribe(); Creator = creator; HistoryList = historyList; ShowSettingsCommand = ReactiveCommand.Create(() => { _settingsManager.ShowSettingsWindow(); }); RefreshConfig(); PropertyChanged += (sender, e) => { PersistConfig(); }; }
public MainPage() { InitializeComponent(); RateAppCommand = new Command(RateApp); BindingContext = this; CurrentPurchasesStackLayout = CurrentStack; CompletedPurchasesStackLayout = CompletetCurrentStack; HistoryStackLayout = HistoryStack; PlanStackLayout = PlanStack; PhotoStackLayout = PhotoStack; SettingsStackLayout = SettingsStack; GroupStackLayout = GroupStack; NameLabel.FontFamily = Device.RuntimePlatform == Device.Android ? "jakobextractt.ttf#JacobExtraCTT" : "Assets/jakobextractt.ttf#JacobExtraCTT";//убрать в XAML activePurchases = new PurchaseListViewModel(this); plan = new PlanListViewModel(this); history = new HistoryListViewModel(this); settings = new SettingsViewModel(this); groups = new GroupListViewModel(this); }
public ClipboardHistoryWindow() : base(null) { DispatcherHelper.Initialize(); Caption = Resources.ToolWindowTitle; // Set the image that will appear on the tab of the window frame when docked with an other window // The resource ID correspond to the one defined in the resx file while the Index is the offset // in the bitmap strip. Each image in the strip being 16x16. BitmapResourceID = 301; BitmapIndex = 1; // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on // the object returned by the Content property. var historyListControl = new HistoryListControl(); var historyListViewModel = new HistoryListViewModel(); historyListControl.DataContext = historyListViewModel; base.Content = historyListControl; }
public async Task <IActionResult> History(int id, int page = 1) { try { int take = 15; int skip = take * (page - 1); var history = await _userService .GetPaginatedUserHistoryAsync(id, skip, take); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = history.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var user = await _userService.GetDetails(id); SetPageTitle(user); HistoryListViewModel viewModel = new HistoryListViewModel() { Historys = new List <HistoryItemViewModel>(), PaginateModel = paginateModel, Id = id, HouseholdCount = await _userService .FamilyMemberCountAsync(user.HouseholdHeadUserId ?? id), HeadOfHouseholdId = user.HouseholdHeadUserId, HasAccount = !string.IsNullOrWhiteSpace(user.Username), CanRemoveHistory = UserHasPermission(Permission.LogActivityForAny), TotalPoints = user.PointsEarned }; bool editChallenges = UserHasPermission(Permission.EditChallenges); foreach (var item in history.Data) { if (item.ChallengeId != null) { string url = ""; if (editChallenges) { url = Url.Action("Edit", "Challenges", new { id = item.ChallengeId }); } else { url = Url.Action("Detail", "Challenges", new { area = "", id = item.ChallengeId }); } item.Description = $"<a target='_blank' href='{url}'>{item.Description}</a>"; } HistoryItemViewModel itemModel = new HistoryItemViewModel() { Id = item.Id, CreatedAt = item.CreatedAt.ToString("d"), Description = item.Description, PointsEarned = item.PointsEarned, }; if (!string.IsNullOrWhiteSpace(item.BadgeFilename)) { itemModel.BadgeFilename = _pathResolver.ResolveContentPath(item.BadgeFilename); } viewModel.Historys.Add(itemModel); } return(View(viewModel)); } catch (GraException gex) { ShowAlertWarning("Unable to view participant's history: ", gex); return(RedirectToAction("Index")); } }
public HistoryListPage(HistoryListViewModel vm) { InitializeComponent(); BindingContext = vm; }