-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoalDetailView.xaml.cs
63 lines (55 loc) · 2.06 KB
/
GoalDetailView.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Interop;
namespace Goal_Tracker
{
public partial class GoalDetailView : Window
{
public Goal SelectedGoal { get; set; }
// The collection of goals to remove the goal from
public ObservableCollection<Goal> GoalsCollection { get; set; }
public GoalDetailView(Goal goal)
{
InitializeComponent();
this.MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;
this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
SelectedGoal = goal;
this.DataContext = SelectedGoal; // Bind the data to the view
// Populate ComboBox with difficulty levels (1 to 20)
if (MainWindow.LoadOptionFromIni("Color", "MoreTier") == "True")
{
GoalDifficultyComboBox.ItemsSource = new int[]
{
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20
};
}
else
{
GoalDifficultyComboBox.ItemsSource = new int[]
{
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
};
}
}
// Handle save button click (you can implement logic to save changes here)
private void SaveButton_Click(object sender, RoutedEventArgs e)
{
// For now, we just close the window after saving
// Later, you can add logic to persist changes to your goal
Close();
}
private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
// Remove the selected goal from the GoalsCollection
SelectedGoal.IsDeleted = true;
// Close the detail view window
this.Close();
}
// Handle close button click
/*private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close();
}*/
}
}