fixes the account chooser page state

vnext
Paul Schneider 8 years ago
parent 94c9032c0b
commit e032a66048
2 changed files with 9 additions and 22 deletions

@ -14,6 +14,7 @@
<ListView x:Name="AccountListView" <ListView x:Name="AccountListView"
SeparatorVisibility="Default" SeparatorVisibility="Default"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
ItemsSource="{x:Static local:MainSettings.AccountList}"
> >
<ListView.Header> <ListView.Header>
<StackLayout Orientation="Horizontal"> <StackLayout Orientation="Horizontal">

@ -14,38 +14,25 @@ namespace BookAStar.Pages.UserProfile
public partial class AccountChooserPage : ContentPage public partial class AccountChooserPage : ContentPage
{ {
public ICommand RemoteSettingsRefreshCommand { get; private set; }
public AccountChooserPage () public AccountChooserPage ()
{ {
InitializeComponent (); InitializeComponent ();
AccountListView.ItemsSource = MainSettings.AccountList;
this.Musical = MainSettings.Musical;
this.Environ = MainSettings.Environ;
this.BindingContext = this;
AddAccountBtn.Clicked += AddAccountBtn_Clicked; AddAccountBtn.Clicked += AddAccountBtn_Clicked;
// avatarImage.
//RemoveAccountBouton.Clicked += RemoveAccountBouton_Clicked; //RemoveAccountBouton.Clicked += RemoveAccountBouton_Clicked;
AccountListView.ItemSelected += Accounts_ItemSelected; AccountListView.ItemSelected += Accounts_ItemSelected;
DumpParam = new RelayGesture((g, x) => // MainSettings.UserChanged += MainSettings_UserChanged;
{
if (g.GestureType == GestureType.Swipe && g.Direction == Directionality.Left)
{
RemoveAccount();
} }
}); // Should be useless
private void MainSettings_UserChanged(object sender, EventArgs e)
{
AccountListView.SelectedItem = MainSettings.CurrentUser;
throw new NotImplementedException();
} }
public RelayGesture DumpParam { get; set; }
public ObservableCollection<User> Accounts { get; private set; }
public Dictionary<string, double> Musical { get; private set; }
public Dictionary<string, double> Environ { get; private set; }
private void Accounts_ItemSelected(object sender, SelectedItemChangedEventArgs e) private void Accounts_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{ {
var user = e.SelectedItem as User; var user = e.SelectedItem as User;
@ -68,7 +55,6 @@ namespace BookAStar.Pages.UserProfile
protected override void OnAppearing() protected override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
AccountListView.SelectedItem = MainSettings.CurrentUser;
} }
private void AddAccountBtn_Clicked(object sender, EventArgs e) private void AddAccountBtn_Clicked(object sender, EventArgs e)

Loading…