private async void EditUser_Click(object sender, RoutedEventArgs e) { UserDialog dialog = new UserDialog(); dialog.ViewModel.CurrentUser = new Models.User(0); dialog.ViewModel.CurrentUser.Update(ViewModel.CurrentUser); if (await dialog.ShowAsync() == ContentDialogResult.Primary) { ViewModel.CurrentUser.Update(dialog.ViewModel.CurrentUser, false); await ViewModel.SaveSettings(); await ViewModel.SendUpdateUser(ViewModel.CurrentUser); } }
private async void AddUser_Click(object sender, RoutedEventArgs e) { UserDialog dialog = new UserDialog(); dialog.ViewModel.CurrentUser = new Models.User(ViewModel.Settings.NextUserId); if (await dialog.ShowAsync() == ContentDialogResult.Primary) { if (await ViewModel.SendNewUser(dialog.ViewModel.CurrentUser)) { ViewModel.Settings.Users.Add(dialog.ViewModel.CurrentUser); ViewModel.Settings.NextUserId++; await ViewModel.SaveSettings(); } } }