public NavigationPageViewModel(Frame frame, PengaduanViewModel vm, bool editabele) { this.IsEditable = editabele; FinishCommand = new CommandHandler { CanExecuteAction = x => FinishCommandValidate(), ExecuteAction = x => FinishAction() }; BackCommand = new CommandHandler { CanExecuteAction = x => BackCommandValidate(), ExecuteAction = x => BackAction() }; NextCommand = new CommandHandler { CanExecuteAction = x => NextCommandValidate(), ExecuteAction = x => NextAction() }; CancelCommand = new CommandHandler { CanExecuteAction = x => CancelCommandValidate(), ExecuteAction = x => CancelAction() }; this.frame = frame; this.vm = vm; this.Pages = new List <Page>() { new PengaduanPage(this.vm), new KondisiPage(vm), new KorbanPage(vm), new DampakPage(vm), }; currentPage = 0; frame.Navigate(Pages[0]); }
public KOrbanPageViewModel(PengaduanViewModel model) { this.vm = model; this.Korbans = (CollectionView)CollectionViewSource.GetDefaultView(vm.Korban); this.Terlapors = (CollectionView)CollectionViewSource.GetDefaultView(vm.Terlapor); foreach (var korban in vm.Korban) { foreach (var terlapor in vm.Terlapor) { bool isfound = false; foreach (var hubungan in terlapor.Hubungan) { if (hubungan.Korban.Id == korban.Id) { isfound = true; break; } } if (!isfound) { terlapor.Hubungan.Add(new HubunganDenganKorban(terlapor.Id, korban)); } } } AddKorbanCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = AddKorbanAction }; AddTerlaporCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = AddTerlaporAction }; DeleteCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = DeleteAction }; AddPenangananCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = AddPenangananAction }; EditPenangananCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = EditPenanganAction }; DeletePenangananCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = DeletePenanganAction }; EditHubunganCommand = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = EditHubunganAction }; }
public KorbanPage(PengaduanViewModel vm) { InitializeComponent(); this.DataContext = viewmodel = new KOrbanPageViewModel(vm); }