public EditGoalWindow(Goal goal) { InitializeComponent(); EditedGoal = goal; ReminderPicker.SelectedDateChanged += ReminderPicker_SelectedDateChanged; GoalEdited += RedrawTextFields; GoalEdited += FillLabelsAttachmentsCheckboxes; GoalEdited?.Invoke(); }
private void AddAttachmentButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); if (dialog.ShowDialog() == true) { EditedGoal.AttachmentFilePaths.Add(dialog.FileName); GoalEdited?.Invoke(); } }
private void RemoveAttachment(object sender, System.Windows.Input.MouseButtonEventArgs e) { var label = sender as TextBlock; if (label != null) { var clickedLabel = EditedGoal.AttachmentFilePaths.FirstOrDefault(x => x.Equals(label.Text)); EditedGoal.AttachmentFilePaths.Remove(clickedLabel); GoalEdited?.Invoke(); } }
private void AddLabel_Click(object sender, RoutedEventArgs e) { Dialog dialog = new Dialog("Label Name"); dialog.ShowDialog(); if (dialog.DialogResult == true) { EditedGoal.Labels.Add(dialog.TextF); GoalEdited?.Invoke(); } }