private void InitializeWindow(ICustomerRepository customerRepository, ICityRepository cityRepository, IWindowDialogService windowDialogService) { _window = new CustomersWindow(customerRepository, cityRepository, windowDialogService); _window.Show(); _datagrid = _window.FindVisualChildren <DataGrid>().FirstOrDefault(); _addCustomerButton = _window.GetPrivateFieldValueByName <Button>("AddCustomerButton"); _saveCustomerButton = _window.GetPrivateFieldValueByName <Button>("SaveCustomerButton"); _showAccountsButton = _window.GetPrivateFieldValueByName <Button>("ShowAccountsButton"); }
private void AddCustomers_Click(object sender, RoutedEventArgs e) { CustomersWindow customersWindow = new CustomersWindow() { UserData = this.UserData, RecordsData = customers, }; customersWindow.ShowDialog(); }
private void InitializeWindow() { _window = new CustomersWindow(_customerRepositoryMock.Object, _customerValidatorMock.Object, _cityRepositoryMock.Object, _windowDialogServiceMock.Object); _window.Show(); _datagrid = _window.FindVisualChildren <DataGrid>().FirstOrDefault(); _addCustomerButton = _window.GetPrivateFieldValueByName <Button>("AddCustomerButton"); _saveCustomerButton = _window.GetPrivateFieldValueByName <Button>("SaveCustomerButton"); _showAccountsButton = _window.GetPrivateFieldValueByName <Button>("ShowAccountsButton"); _errorTextBlock = _window.GetPrivateFieldValueByName <TextBlock>("ErrorTextBlock"); }
private void Customers_Click(object sender, RoutedEventArgs e) { var customersWindow = new CustomersWindow() { UserData = this.UserData }; customersWindow.ShowDialog(); if (UserData.AccessQuote == true) { //using (SqlConnection connection = new SqlConnection(Database.ConnectionString)) // newProjects = InquiryController.CountNewInquiries(connection, UserData.UserID); //DataContext = new { newProjects }; } }
private void InitializeWindow() { _window = new CustomersWindow(_customerRepositoryMock.Object, _cityRepositoryMock.Object, _windowDialogServiceMock.Object); _window.Show(); _listView = _window.FindVisualChildren <ListView>().FirstOrDefault(); Assert.That(_listView, Is.Not.Null, "There should be a ListView defined in the XAML."); _cityComboBox = _window.FindVisualChildren <ComboBox>().FirstOrDefault(); Assert.That(_cityComboBox, Is.Not.Null, "There should be a ComboBox defined in the XAML."); _newCustomerGroupBox = _window.FindVisualChildren <GroupBox>().FirstOrDefault(); Assert.That(_newCustomerGroupBox, Is.Not.Null, "There should be a GroupBox defined in the XAML."); _addCustomerButton = _window.GetPrivateFieldValueByName <Button>("AddCustomerButton"); Assert.That(_addCustomerButton, Is.Not.Null, "There should be a Button with the name AddCustomerButton."); _errorTextBlock = _window.GetPrivateFieldValueByName <TextBlock>("ErrorTextBlock"); Assert.That(_errorTextBlock, Is.Not.Null, "There should be a TextBlock with the name ErrorTextBlock."); }
//Constructor public CustomersViewModel(CustomersWindow window) { this.CurrentWindows = window; this.Add(); this.CancelCommand = new RelayCommand(param => this.Cancel(), param => true); this.AddCommand = new RelayCommand(param => this.Add(), param => true); this.SaveCommand = new RelayCommand(param => this.Save(), param => true); this.DeleteCommand = new RelayCommand(param => this.Delete(), param => true); this.SearchCommand = new RelayCommand(param => this.Search(), param => true); this.ExportCommand = new RelayCommand(param => this.Export(), param => true); //Load data from database WarehouseDbContext ctx = new WarehouseDbContext(); CustomerList = new List <Customer>(ctx.Customers.ToList()); }
private void ViewCustomers_Click(object sender, RoutedEventArgs e) { CustomersWindow cs = new CustomersWindow(); cs.Show(); }
private void CustomersManagement() { CustomersWindow myWindow = new CustomersWindow(); myWindow.Show(); }
public MainWindowViewModel() { LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => { isLoaded = true; if (p == null) { return; } p.Hide(); LoginWindow loginWindow = new LoginWindow(); loginWindow.ShowDialog(); if (loginWindow.DataContext == null) { return; } var loginVM = loginWindow.DataContext as LoginWindowViewModel; if (loginVM.IsLogin) { p.Show(); } else { p.Close(); } }); OpenUnitWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { UnitWindow unitWindow = new UnitWindow(); unitWindow.ShowDialog(); }); OpenSuppliersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SuppliersWindow sW = new SuppliersWindow(); sW.ShowDialog(); }); OpenCustomersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomersWindow cW = new CustomersWindow(); cW.ShowDialog(); }); OpenProductsWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { ProductsWindow pW = new ProductsWindow(); pW.ShowDialog(); }); OpenUsersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { UsersWindow pW = new UsersWindow(); pW.ShowDialog(); }); OpenInputWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow pW = new InputWindow(); pW.ShowDialog(); }); OpenOutputWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow pW = new OutputWindow(); pW.ShowDialog(); }); }