//event for clicking the appointment block private void ApptBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { ApptBlockControl apptBlock = (ApptBlockControl)sender; if (apptBlock.isEnabled()) { ApptWindow apptWindow = new ApptWindow(apptBlock, apptBlock.getApptRepresenting()); apptWindow.Owner = Window.GetWindow(this); apptWindow.Show(); } else { //save and close string apptStatus = "Not Arrived"; apptBlock.setApptRepresenting(new Appointment(patient, apptType, apptStatus, potentialLength, this.startBlock, this.time)); //saves the appointment to the block (probably dont need this) daySched.setAppointmentAtTime(apptBlock.getApptRepresenting(), Array.IndexOf(apptBlocks, apptBlock)); //save the appointment to the schedule //add the appointment to the patient as well this.patient.addAppointment(apptBlock.getApptRepresenting()); //MessageBox.Show("SAVED"); Window.GetWindow(this).Close(); //force the windows to update MediSchedData.forceRefresh(); } }
private Appointment apptRepresenting = null; //the appointment this app window is showing //initializes given a block that was clicked, and the appointment object that block contained //use this constructor if one of the coloured blocks was clicked to open this public ApptWindow(ApptBlockControl sourceApptBlock, Appointment sourceAppt) { InitializeComponent(); this.sourceApptBlock = sourceApptBlock; MainWindow.mainClosed += handleMainClose; ApptWindow.newWindowOpened += handleNewWindow; newWindowOpened(this, null); loadAppointment(sourceAppt); this.apptGrid.Height = 195; this.deleteButton.Margin = new Thickness(251.976, 158, 0, 0); this.billingButton.Click += BillingButton_Click; MediSchedData.dbChanged += handleDbChange; }