private void DoChangeVote() { IsNotFinish = true; _isVoteChange = true; _oldPosition = CurrentPosition; CurrentPosition = CouncilPositions.FirstOrDefault(c => c.Id == SelectedVote.Position.Id); }
private void DoVote() { //await DialogHost.Show(new ElectionVoteView() {DataContext = this}, "RootDialog", // delegate(object sender, DialogOpenedEventArgs args) // { // CurrentPosition = CouncilPositions.FirstOrDefault(); // CouncilMembersList = _context.CouncilMembers.AsNoTracking().Where(c => c.CouncilPosition.Id == CurrentPosition.Id) // .ToList(); // }, // delegate(object sender, DialogClosingEventArgs args) // { // if (Equals(args.Parameter, false)) // { // StudentVotes?.Clear(); // return; // } // if (Equals(args.Parameter, "Finish")) // { // args.Cancel(); // args.Session.UpdateContent(new OkMessageDialog(){DataContext = "OK FINISH"}); // } // }); CurrentPosition = CouncilPositions.FirstOrDefault(); CouncilMembersList = _context.CouncilMembers.AsNoTracking().Where(c => c.CouncilPosition.Id == CurrentPosition.Id) .ToList(); Messenger.Default.Send(new SetNavigation { Content = new ElectionVoteView { DataContext = new ElectionVoteViewModel(_context, CurrentStudent) } }); }
public ElectionVoteViewModel(MorenoContext context, Student student) { _context = context; CurrentStudent = student; CouncilPositions = _context.CouncilPositions.ToList(); CurrentPosition = CouncilPositions.FirstOrDefault(); StudentVotes = new ObservableCollection <StudentVote>(); IsNotFinish = true; }