protected override void OnNavigatedTo(NavigationEventArgs e) { var oldViewModel = (BaseViewModel)e.Parameter; this.ViewModel.CurrentEmployee = oldViewModel?.CurrentEmployee; try { this.ViewModel.RetrieveAllInventoryItems(); } catch (Exception) { DbError.showErrorWindow(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { var oldViewModel = (EmployeeManagementViewModel)e.Parameter; this.ViewModel.CurrentEmployee = oldViewModel?.CurrentEmployee; this.ViewModel.SelectedEmployee = oldViewModel?.SelectedEmployee; try { this.ViewModel.RetrieveEmployeeHistory(); } catch (Exception) { DbError.showErrorWindow(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { var oldViewModel = (InventoryViewModel)e.Parameter; this.ViewModel.CurrentEmployee = oldViewModel?.CurrentEmployee; this.ViewModel.SelectedInventoryItem = oldViewModel?.SelectedInventoryItem; try { this.ViewModel.GetSelectedItemHistorySummary(); } catch (Exception) { DbError.showErrorWindow(); } }
private void loginButton_Click(object sender, RoutedEventArgs e) { try { if (this.ViewModel.ValidateLoginCredentials(this.usernameTextBox.Text, this.passwordBox.Password)) { Frame.Navigate(typeof(MainPage), this.ViewModel); } else { this.usernameTextBox.BorderBrush = new SolidColorBrush(Colors.Red); this.passwordBox.BorderBrush = new SolidColorBrush(Colors.Red); this.usernameTextBox.PlaceholderText = "Invalid Username"; this.passwordBox.PlaceholderText = "Invalid Password"; } } catch (Exception) { DbError.showErrorWindow(); } }
private async void addButton_Click(object sender, RoutedEventArgs e) { var dialog = new ContentDialog { Title = "Confirm", Content = $"Are you sure you want to add this item?", CloseButtonText = "Cancel", PrimaryButtonText = "Confirm" }; var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { try { this.ViewModel.AddInventoryItem(); Frame.Navigate(typeof(ViewInventoryPage), this.ViewModel); } catch (Exception) { DbError.showErrorWindow(); } } }
private async void removeItemButton_Click(object sender, RoutedEventArgs e) { var dialog = new ContentDialog { Title = "Confirm", Content = $"Are you sure you want to remove this item?", CloseButtonText = "Cancel", PrimaryButtonText = "Confirm" }; var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { try { this.ViewModel.RemoveInventoryItem(); this.ViewModel.RetrieveAllInventoryItems(); } catch (Exception) { DbError.showErrorWindow(); } } }