WPF Database Lookup/View Model Maintenance
Getting Started
Note: The design for these controls came from Cougar Mountain Software.
Front End View Library Nuget Package
Install-Package RingSoft.DbLookup.Controls.WPF
Back End Model Library Nuget Package
Install-Package RingSoft.DbLookup.EfCore
Back End View Model Library Nuget Package
Install-Package RingSoft.DbMaintenance
(Note: DbMaintenanceButtonsControl is a Control containing all the buttons created by the client. AdvancedFindAdditionalButtonsControl is also a client Control.)
public class AppDbMaintenanceButtonsFactory : DbMaintenanceButtonsFactory
{
public override Control GetAdvancedFindButtonsControl(AdvancedFindViewModel viewModel)
{
var result = new DbMaintenanceButtonsControl();
var additionalButtons = new AdvancedFindAdditionalButtonsControl();
result.AdditionalButtonsPanel.Children.Add(additionalButtons);
additionalButtons.ImportDefaultLookupButton.Command = viewModel.ImportDefaultLookupCommand;
additionalButtons.RefreshSettingsButton.Command = viewModel.RefreshSettingsCommand;
additionalButtons.PrintLookupOutputButton.Command = viewModel.PrintLookupOutputCommand;
result.UpdateLayout();
return result;
}
public override Control GetRecordLockingButtonsControl(RecordLockingViewModel viewModel)
{
return new DbMaintenanceButtonsControl();
}
}
Instantiate DbMaintenanceButtonsFactory
(App.xaml.cs)
var appDbMaintenanceButtonsFactory = new AppDbMaintenanceButtonsFactory();
public class AppDbMaintenanceWindowProcessor : DbMaintenanceWindowProcessor
{
public override Button SaveButton => _dbMaintenanceButtonsControl.SaveButton;
public override Button SelectButton => _dbMaintenanceButtonsControl.SelectButton;
public override Button DeleteButton => _dbMaintenanceButtonsControl.DeleteButton;
public override Button FindButton => _dbMaintenanceButtonsControl.FindButton;
public override Button NewButton => _dbMaintenanceButtonsControl.NewButton;
public override Button CloseButton => _dbMaintenanceButtonsControl.CloseButton;
public override Button NextButton => _dbMaintenanceButtonsControl.NextButton;
public override Button PreviousButton => _dbMaintenanceButtonsControl.PreviousButton;
public override Button PrintButton => _dbMaintenanceButtonsControl.PrintButton;
private DbMaintenanceButtonsControl _dbMaintenanceButtonsControl;
public override void Initialize(BaseWindow window, Control buttonsControl,
DbMaintenanceViewModelBase viewModel, IDbMaintenanceView view, DbMaintenanceStatusBar statusBar)
{
_dbMaintenanceButtonsControl = (DbMaintenanceButtonsControl) buttonsControl;
base.Initialize(window, buttonsControl, viewModel, view, statusBar);
}
}
public class AppDbMaintenanceProcessorFactory : DbMaintenanceProcessorFactory
{
public override DbMaintenanceWindowProcessor GetProcessor()
{
return new AppDbMaintenanceWindowProcessor();
}
}
Instantiate DbMaintenanceProcessorFactory
(App.xaml.cs)
var appDbMaintenanceProcessorFactory = new AppDbMaintenanceProcessorFactory();