/// <summary> /// Handles the Click event of the addRecordButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void addRecordButton_Click(object sender, RoutedEventArgs e) { RecordWindow window = new RecordWindow(); if (window.OpenWindowInMode(OpenWindowMode.Add) == true) { this.selectedCard.AddRecord(new Record(window.RecordType, window.Date, window.Price, window.Amount, window.Note)); this.RefreshSelectedCard(); } }
/// <summary> /// Handles the MouseDoubleClick event of the recordsListBox control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param> private void recordsListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { this.selectedRecord = (this.recordsListBox.SelectedItem as Record); RecordWindow window = new RecordWindow(); window.RecordType = this.selectedRecord.RecordType; window.Date = this.selectedRecord.Date; window.Price = this.selectedRecord.Price; window.Amount = this.selectedRecord.Amount; window.Note = this.selectedRecord.Note; if (window.OpenWindowInMode(OpenWindowMode.Edit) == true) { this.selectedRecord.RecordType = window.RecordType; this.selectedRecord.Date = window.Date; this.selectedRecord.Price = window.Price; this.selectedRecord.Amount = window.Amount; this.selectedRecord.Note = window.Note; this.selectedCard.CountCurrentRecordStock(); this.RefreshSelectedCard(); } }