Skip to content

Commit

Permalink
fix: fix add appointments view not hiding on save, fix dialog view bu…
Browse files Browse the repository at this point in the history
…ttons not being set by factory

Signed-off-by: russkyc <[email protected]>
  • Loading branch information
russkyc committed Jun 10, 2023
1 parent ff07ee7 commit f631764
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions Russkyc.GroomWise/Services/Factory/DialogFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public DialogView Create(Action<DialogView>? builder = null)
var dialogView = new DialogView().AsChild().HideOnParentMouseDown();
if (builder != null)
builder(dialogView);
dialogView.BuildButtons();
return dialogView;
}
}
2 changes: 1 addition & 1 deletion Russkyc.GroomWise/Services/ServiceContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static IServicesContainer ConfigureServices()
.AddSingleton<IPetsViewModel, PetsViewModel>()
.AddSingleton<IMainViewModel, MainViewModel>()
// Add Views
.AddTransient<IAddAppointmentsView, AddAppointmentsView>()
.AddSingleton<IAddAppointmentsView, AddAppointmentsView>()
.AddSingleton<IAppointmentsView, AppointmentsView>()
.AddSingleton<IInventoryView, InventoryView>()
.AddSingleton<ICustomersView, CustomersView>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,19 @@ void AddAppointment()
_dbContext.AppointmentRepository.Add(appointment);
_dbContext.AppointmentServiceRepository.Add(appointmentService);
_logger.Log(this, $"Scheduled {appointment.Title} on {appointment.Date:f}");

// Hide add appointments view
BuilderServices.Resolve<IAddAppointmentsView>().Hide();

// Prompt user that appointment is saved
_dialogFactory
.Create(dialog =>
{
dialog.Buttons = MessageBoxButton.OK;
dialog.MessageBoxText = "Appointment Saved";
dialog.Caption = $"{appointment.Title} has been added to appointments";
})
.AsChild()
.ShowDialog();
.Show();
ClearFields();
}
}

0 comments on commit f631764

Please sign in to comment.