public AddAppointmentViewModel() { dentalChartViewModel = new DentalChartViewModel(); dentalChartViewModel.TreatmentRecordViewModel = null; PatientViewModel = new PatientViewModel(); TreatmentViewModel = new TreatmentViewModel(); UserViewModel = new UserViewModel(); Appointment = new Appointment(); CopyAppointment = (Appointment)appointment.Clone(); DialogBoxViewModel = new DialogBoxViewModel(); SearchPatientCommand = new DelegateCommand(SearchPatient); startLoadTreatmentsThread(); startLoadPatientsThread(); startLoadUsersThread(); startLoadFromDatabase("allaboutteeth_" + GetType().Namespace.Replace("AllAboutTeethDCMS.", ""), Filter); SelectedTreatments = new ObservableCollection <Treatment>(); AddTreatmentCommand = new DelegateCommand(AddTreatment); RemoveTreatmentCommand = new DelegateCommand(RemoveTreatment); SetTimes(); }
/// <summary> /// Pokazanie wiadomosci /// </summary> /// <param name="dialogBoxViewModel">Zawartosc <see cref="DialogWindow"/></param> /// <returns></returns> public Task ShowMessage(DialogBoxViewModel dialogBoxViewModel) { var tcs = new TaskCompletionSource <bool>(); Application.Current.Dispatcher.Invoke(() => { try { //zawartosc dialogu DialogBoxControl dialogContent = new DialogBoxControl() { DataContext = dialogBoxViewModel }; //stworzenie dialogu DialogWindow dialog = new DialogWindow(dialogContent); dialog.ShowDialog(); } finally { //ustawienie wartosci, aby powiadomic wywolujacego tcs.TrySetResult(true); } }); return(tcs.Task); }
/// <summary> /// Zamkniecie wiadomosci /// </summary> /// <param name="dialogBoxViewModel"></param> /// <returns></returns> public Task CloseMessage(DialogBoxViewModel dialogBoxViewModel) { //sprzwdzenie wszystkich okien... foreach (var window in Application.Current.Windows) { //...czy zawieraja dialog z odpowiednim DialogBoxViewModel if (window is DialogWindow dialogWindow && ((dialogWindow.DataContext as DialogViewModel).Content as DialogBoxControl).DataContext == dialogBoxViewModel) { //jesli tak to jest zamykany dialogWindow.Close(); } } return(Task.CompletedTask); }
/// <summary> /// Checks to see if the device count is higher than the configured warning threshold. /// Returns true if not or if warnings are disabled. /// </summary> /// <param name="action"></param> /// <param name="deviceListString"></param> /// <returns></returns> public bool DeviceCountWarningCheck(IAction action, string deviceListString) { if (!ConfigManager.CurrentConfig.EnableDeviceCountWarning) { return(true); } var parseListCount = Action.ParseDeviceList(deviceListString).Count; if (parseListCount <= ConfigManager.CurrentConfig.DeviceCountWarningThreshold) { return(true); } var dialog = new DialogBoxViewModel( $"There are {parseListCount} devices in the list!\n\nAre you sure you want to run {action.ActionName} on {parseListCount} devices?"); _windowService.ShowDialog <DialogBox>(dialog); return(dialog.Result); }
public DialogBox(DialogBoxViewModel context) : this() { this.DataContext = context; context.Close += Close; context.DoSomething += DoSomething; }
public AddProviderViewModel() { provider = new Provider(); copyProvider = (Provider)provider.Clone(); DialogBoxViewModel = new DialogBoxViewModel(); }
public AddSupplierViewModel() { supplier = new Supplier(); copySupplier = (Supplier)supplier.Clone(); DialogBoxViewModel = new DialogBoxViewModel(); }