/// <summary> /// Creates a new window to edit a category. /// </summary> /// <param name="viewModel">The view model for the category to be edited.</param> /// <param name="view">The view for the category to be edited.</param> private void ShowCategory(WorkspaceViewModel viewModel, UserControl view) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; viewModel.CloseAction = b => window.DialogResult = b; window.Title = viewModel.DisplayName; view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// Creates a new window to edit a customer. /// </summary> /// <param name="viewModel">The view model for the customer to be edited.</param> private void ShowCustomer(CustomerViewModel viewModel) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; viewModel.CloseAction = b => window.DialogResult = b; window.Title = viewModel.DisplayName; CustomerView view = new CustomerView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// Shows the currently selected customer in a new window. /// </summary> public void ShowLocation(LocationViewModel viewModel) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; LocationView view = new LocationView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// Creates a new window to edit a car. /// </summary> /// <param name="viewModel">The view model for the car to be edited.</param> private void ShowEntity(TViewModel viewModel) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; viewModel.CloseAction = b => window.DialogResult = b; window.Title = viewModel.DisplayName; TView view = Activator.CreateInstance(typeof(TView)) as TView; view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
/// <summary> /// This shows the product. /// </summary> /// <param name="viewModel">The view model being shown.</param> private static void ShowProduct(ProductViewModel viewModel) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; ProductView view = new ProductView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }