protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); id = long.Parse(NavigationContext.QueryString["debtCalculationId"]); _container = ApiHelper.GetContainer(); _calculations = new DataServiceCollection<DebtCalculation>(_container); // Cannot localize ApplicationBar unless it is created in code behind ApplicationBar = new ApplicationBar { BackgroundColor = Color.FromArgb(255, 0x86, 0xC4, 0x40), //"#86C440" Opacity = 1, ForegroundColor = Colors.White }; ContentPanel.Children.Add(new ProgressBar { IsIndeterminate = true, Width = 300, Margin = new Thickness(0, 30, 0, 0) }); var query = _container.DebtCalculations .Expand("Expenses/Payer") .Expand("Expenses/Debtors/User") .Expand("Participants/User") .Expand("Debts/Debtor") .Expand("Debts/Creditor") .Expand(dc => dc.Creator) .Where(dc => dc.Id == id); _calculations.LoadCompleted += ShowCalculation; _calculations.LoadAsync(query); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (totalParticipants != 0) // Page already loaded return; id = long.Parse(NavigationContext.QueryString["debtCalculationId"]); _container = ApiHelper.GetContainer(); _participants = new DataServiceCollection<Participant>(_container); // Cannot localize ApplicationBar unless it is created in code behind ApplicationBar = new ApplicationBar { BackgroundColor = Color.FromArgb(255, 0x86, 0xC4, 0x40), //"#86C440" Opacity = 1, ForegroundColor = Colors.White }; ContentPanel.Children.Add(new ProgressBar { IsIndeterminate = true, Width = 300, Margin = new Thickness(0, 30, 0, 0) }); var query = _container.Participants .Expand(p => p.User) .Where(p => p.DebtCalculation.Id == id); _participants.LoadCompleted += ShowExpenseParticipants; _participants.LoadAsync(query); }
public static Container GetContainer() { var usernameAndPswd = GetUserNameAndPassword(); var username = usernameAndPswd.Split(':').First(); var password = usernameAndPswd.Split(':').Last(); var container = new Container(ApiUri) { Credentials = new NetworkCredential(username, password) }; return container; }
private void ShowDebtCalculations() { ButtonList.Children.Add(new ProgressBar { IsIndeterminate = true, Width = 300, Margin = new Thickness(0, 30, 0, 0) }); _container = ApiHelper.GetContainer(); _calculations = new DataServiceCollection<DebtCalculation>(_container); var query = _container.DebtCalculations.OrderByDescending(dc => dc.LastActivityTime); _calculations.LoadCompleted += BuildButtonList; _calculations.LoadAsync(query); }