void Window_Closed(object sender, EventArgs e)
        {
            if (sender is AgendaWindow)
            {
                _agendaWindow = null;
            }
            else if (sender is ManageUsersWindow)
            {
                _manageUsersWindow = null;
            }
            else if (sender is ManageRemindersWindow)
            {
                _manageRemindersWindow = null;
                RefreshRemindersStackPanel();
            }
            else if (sender is ManageMedicinesWindow)
            {
                _manageMedicinesWindow = null;
                RefreshMedicinesStackPanel();
            }
            else if (sender is ManageTreatmentsWindow)
            {
                _manageTreatmentsWindow = null;
            }
            else if (sender is ManageReceivedInvoicesWindow)
            {
                _manageReceivedInvoicesWindow = null;
            }
            else if (sender is ManageOutgoingInvoicesWindow)
            {
                _manageOutgoingInvoicesWindow = null;
            }
            else if (sender is TotalInvoicesWindow)
            {
                _totalInvoicesWindow = null;
            }
            else if (sender is ManageProvidersWindow)
            {
                _manageProvidersWindow = null;
            }
            else if (sender is ManageTechnicalsWindow)
            {
                _manageTechnicalsWindow = null;
            }
            else if (sender is ManageLaboratoryWorksWindow)
            {
                _manageLaboratoryWorksWindow = null;
            }
            else if (sender is MedicalProofDocument)
            {
                _medicalProofDocumentWindow = null;
            }
            else if (sender is ManageGeneralPaidsWindow)
            {
                _manageGeneralPaidsWindow = null;
            }
            else if (sender is ManageContactsWindow)
            {
                _manageContactsWindow = null;
            }
            else if (sender is ManageCleanedMaterialsWindow)
            {
                _manageCleanedMaterialsWindow = null;
            }
            else if (sender is SendEmailWindow)
            {
                _sendEmailWindow = null;
            }
            else if (sender is ConfigureEmailWindow)
            {
                _configureEmailWindow = null;
            }
            else if (sender is ManagePatientsWindow)
            {
                _managePatientsWindow = null;
            }
            else if (sender is ManageDotationsWindow)
            {
                _manageDotationsWindow = null;
                RefreshDotationsStackPanel();
            }
            else if (sender is ManageTreatmentPricesWindow)
            {
                _manageTreatmentPricesWindow = null;
            }
            else if (sender is ManageBudgetsWindow)
            {
                _manageBudgetsWindow = null;
            }
            else if (sender is ManageAmericanExpressPaidsWindow)
            {
                _manageAmericanExpressPaidsWindow = null;
            }
            else if (sender is ManageAuthorizationsWindow)
            {
                _manageAuthorizationsWindow = null;
            }
            else if (sender is ManageDentegraAuthorizationsWindow)
            {
                _manageElegibilitiesWindow = null;
            }
            else if (sender is ManageDrawersWindow)
            {
                _manageDrawersWindow = null;
            }
            else if (sender is CashRegisterWindow)
            {
                _cashRegisterWindow = null;
            }
            else if (sender is ManageBanksWindow)
            {
                _manageBanksWindow = null;
            }
            else if (sender is ViewPaymentsWindow)
            {
                _viewPaymentsWindow = null;
            }
            else if (sender is ViewPaymentFoliosWindow)
            {
                _viewPaymentFoliosWindow = null;
            }
            else if (sender is ViewEventsWindow)
            {
                _viewEventsWindow = null;
            }
            else if (sender is ViewPendingPaymentsWindow)
            {
                _viewPendingPaymentsWindow = null;
            }
            else if (sender is FinishedEventsReminderModal)
            {
                _finishedEventsReminderModal = null;

                List<DateTime> datesUpdated = (sender as FinishedEventsReminderModal).FinishedEvents
                                                .Where(fe => fe.IsCompleted || fe.IsCanceled)
                                                .Select(fe => (new DateTime(fe.StartEvent.Year, fe.StartEvent.Month, fe.StartEvent.Day)))
                                                .Distinct()
                                                .ToList();

                if (datesUpdated.Count > 0 && _agendaWindow != null)
                {
                    _agendaWindow.RepaintSchedulerIfDateModifiedIsSelected(datesUpdated);
                }
            }
        }
        private void btnManagePatients_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (_managePatientsWindow == null)
            {
                _managePatientsWindow = new ManagePatientsWindow(_userLoggedIn);
                _managePatientsWindow.Closed += Window_Closed;
            }

            _managePatientsWindow.Show();
            _managePatientsWindow.WindowState = WindowState.Normal;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.Window = ((MyDentApplication.ManagePatientsWindow)(target));
     return;
     case 2:
     this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.btnAddPatient = ((System.Windows.Controls.Button)(target));
     
     #line 14 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnAddPatient.Click += new System.Windows.RoutedEventHandler(this.btnAddPatient_Click);
     
     #line default
     #line hidden
     return;
     case 4:
     this.btnDelete = ((System.Windows.Controls.Button)(target));
     
     #line 15 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnDelete.Click += new System.Windows.RoutedEventHandler(this.btnDelete_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.btnViewAllPatients = ((System.Windows.Controls.Button)(target));
     
     #line 16 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnViewAllPatients.Click += new System.Windows.RoutedEventHandler(this.btnViewAllPatients_Click);
     
     #line default
     #line hidden
     return;
     case 6:
     this.cbFilter = ((System.Windows.Controls.ComboBox)(target));
     return;
     case 7:
     this.txtSearchTerm = ((System.Windows.Controls.TextBox)(target));
     return;
     case 8:
     this.btnRefreshPatients = ((System.Windows.Controls.Button)(target));
     
     #line 24 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnRefreshPatients.Click += new System.Windows.RoutedEventHandler(this.btnRefreshPatients_Click);
     
     #line default
     #line hidden
     return;
     case 9:
     this.btnEditPatient = ((System.Windows.Controls.Button)(target));
     
     #line 27 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnEditPatient.Click += new System.Windows.RoutedEventHandler(this.btnEditPatient_Click);
     
     #line default
     #line hidden
     return;
     case 10:
     this.btnUpdateHc = ((System.Windows.Controls.Button)(target));
     
     #line 28 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnUpdateHc.Click += new System.Windows.RoutedEventHandler(this.btnUpdateHc_Click);
     
     #line default
     #line hidden
     return;
     case 11:
     this.tcPatients = ((System.Windows.Controls.TabControl)(target));
     
     #line 29 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.tcPatients.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.tcPatients_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 12:
     this.dgPatientsNoHI = ((System.Windows.Controls.DataGrid)(target));
     return;
     case 13:
     this.dgPatientsWithHI = ((System.Windows.Controls.DataGrid)(target));
     return;
     case 14:
     this.dgPatientsDiverse = ((System.Windows.Controls.DataGrid)(target));
     return;
     case 15:
     this.dgPatientsDentegra = ((System.Windows.Controls.DataGrid)(target));
     return;
     case 16:
     this.btnAuthorization = ((System.Windows.Controls.Button)(target));
     
     #line 123 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnAuthorization.Click += new System.Windows.RoutedEventHandler(this.btnAuthorization_Click);
     
     #line default
     #line hidden
     return;
     case 17:
     this.btnViewStatements = ((System.Windows.Controls.Button)(target));
     
     #line 124 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnViewStatements.Click += new System.Windows.RoutedEventHandler(this.btnViewStatements_Click);
     
     #line default
     #line hidden
     return;
     case 18:
     this.btnElegibility = ((System.Windows.Controls.Button)(target));
     
     #line 125 "..\..\..\Patients\ManagePatientsWindow.xaml"
     this.btnElegibility.Click += new System.Windows.RoutedEventHandler(this.btnElegibility_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }