private void btnClick(object sender, RoutedEventArgs e)
        {
            if (sender == btnNewApp)
            {
                //open new window
                //default date is current date
                //add ending date field in case appointment exceed 1 day
                NewAppointment newApp = new NewAppointment(appCtrl);
                this.Hide();
                NewAppForm();
                async void NewAppForm()
                {
                    ContentDialogResult result = await newApp.ShowAsync();

                    if (result == ContentDialogResult.Secondary)
                    {
                        await this.ShowAsync();
                    }
                }
            }
        }
        private void btnClick(object sender, RoutedEventArgs e)
        {
            if (sender == btnNewApp)
            {
                //open new window
                //default date is current date
                //add ending date field in case appointment exceed 1 day
                NewAppointment newApp = new NewAppointment(appCtrl);
                NewAppForm();
                async void NewAppForm()
                {
                    if (await newApp.ShowAsync() == ContentDialogResult.Primary)
                    {
                        //means save button is clicked and new record is saved successfully
                        //update observableCollection
                        addToCollection(
                            newApp.appCtrl.appType.ToString(),
                            newApp.appCtrl.dateStart.ToString(),
                            newApp.appCtrl.dateEnd.ToString(),
                            newApp.appCtrl.timeStart.ToString(),
                            newApp.appCtrl.timeEnd.ToString(),
                            newApp.appCtrl.appID.ToString(),
                            newApp.appCtrl.appLocation.ToString(),
                            newApp.appCtrl.appNote.ToString(),
                            newApp.appCtrl.patientName.ToString(),
                            newApp.appCtrl.patientID.ToString(),
                            newApp.appCtrl.status.ToString()
                            );
                    }
                }
            }
            else if (sender == btnEdit)
            {
                AppointmentUpdateForm updateFrm = new AppointmentUpdateForm(appCtrl);
                frmShow();

                async void frmShow()
                {
                    if (await updateFrm.ShowAsync() == ContentDialogResult.Primary)
                    {
                        //update observable collection
                        var itmsrc = updateFrm.appCtrl;
                        var indx   = lstAppointments.SelectedIndex;
                        appointmentCollection[indx].Type        = itmsrc.appType;
                        appointmentCollection[indx].DateStart   = itmsrc.dateStart;
                        appointmentCollection[indx].TimeStart   = itmsrc.timeStart;
                        appointmentCollection[indx].DateEnd     = itmsrc.dateEnd;
                        appointmentCollection[indx].TimeEnd     = itmsrc.timeEnd;
                        appointmentCollection[indx].AppLocation = itmsrc.appLocation;
                        appointmentCollection[indx].AppNote     = itmsrc.appNote;
                        appointmentCollection[indx].AppName     = itmsrc.patientName;
                        appointmentCollection[indx].AppNameID   = itmsrc.patientID;
                    }
                }
            }
            else if (sender == btnDelete)
            {
                //delete curren selected appointment form list
                deleteApp();

                async void deleteApp()
                {
                    ContentDialog confirmDelete = new ContentDialog()
                    {
                        Title   = "Confirm Delete?",
                        Content = "Are you sure you want to delete this record? " +
                                  "\nData could not be recoevered after deletion",
                        PrimaryButtonText   = "Yes",
                        SecondaryButtonText = "Cancel"
                    };

                    if (await confirmDelete.ShowAsync() == ContentDialogResult.Primary)
                    {
                        if (appCtrl.deleteAppointment(appCtrl))
                        {
                            appCtrl.message("Record deleted successfully");
                            //update UI and remove record from removable collection
                            appointmentCollection.RemoveAt(lstAppointments.SelectedIndex);
                            grdAppDetailsView.Visibility = Visibility.Collapsed;
                        }
                        else
                        {
                            appCtrl.message("An error has occured while deleting record.");
                        }
                    }
                }
            }
        }