-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomePage.xaml.cs
213 lines (204 loc) · 10.9 KB
/
HomePage.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
using System.Collections.Generic;
using System.Linq;
using Microsoft.Maui.Controls;
namespace LearnPro
{
public partial class HomePage : ContentPage
{
public List<Course> Courses { get; set; }
public HomePage()
{
InitializeComponent();
NavigationPage.SetHasBackButton(this, false);
// Static data for courses and lessons
Courses = new List<Course>
{
new Course
{
Id = 1,
Title = "Mastering Python Programming",
Image = "python_course.png",
Category = "Programming",
DatePublished = "2023-01-01",
CourseSection = new List<CourseSection>
{
new CourseSection
{
Id = 1,
Name = "Getting Started with Python",
CourseSectionLectures = new List<CourseSectionLecture>
{
new CourseSectionLecture {
Id = 1,
Name = "Installing Python and Setting Up Your IDE",
Detail = "Learn how to install Python and set up a coding environment",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 2,
Name = "Writing Your First Python Program",
Detail = "Create a simple Python script and run it",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 3,
Name = "Using Comments Effectively",
Detail = "Explore Python’s clean syntax and indentation rules",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 4,
Name = "Understanding Python Syntax and Indentation",
Detail = "Learn to document your code with single-line and multi-line comments",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
}
}
},
new CourseSection
{
Id = 2,
Name = "Core Python Concepts",
CourseSectionLectures = new List<CourseSectionLecture>
{
new CourseSectionLecture {
Id = 1,
Name = "Variables and Data Types",
Detail = "Understand how to declare and use variables effectively",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 2,
Name = "Control Flow Statements",
Detail = "Learn how to use if, else, and loops in Python",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 3,
Name = "Python Functions",
Detail = "Create reusable code blocks with Python functions",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 4,
Name = "Error Handling in Python",
Detail = "Handle errors gracefully using try-except blocks",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
}
}
}
}
},
new Course
{
Id = 2,
Title = "Full-Stack Web Development",
Image = "fullstack_course.png",
Category = "Web Development",
DatePublished = "2023-01-01",
CourseSection = new List<CourseSection>
{
new CourseSection
{
Id = 1,
Name = "Frontend Basics",
CourseSectionLectures = new List<CourseSectionLecture>
{
new CourseSectionLecture {
Id = 1,
Name = "Introduction to HTML",
Detail = "Learn the building blocks of web pages with HTML",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 2,
Name = "CSS for Styling",
Detail = "Style your web pages with CSS",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 3,
Name = "Introduction to JavaScript",
Detail = "Add interactivity to your web pages with JavaScript",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 4,
Name = "Responsive Design Basics",
Detail = "Learn to make your websites responsive and mobile-friendly",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
}
}
},
new CourseSection
{
Id = 2,
Name = "Backend Development",
CourseSectionLectures = new List<CourseSectionLecture>
{
new CourseSectionLecture {
Id = 1,
Name = "Setting Up a Node.js Server",
Detail = "Learn how to create a server with Node.js",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 2,
Name = "RESTful API Basics",
Detail = "Build a RESTful API with Express.js",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 3,
Name = "Connecting to a Database",
Detail = "Integrate your server with a database like MongoDB",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
},
new CourseSectionLecture {
Id = 4,
Name = "User Authentication",
Detail = "Implement secure user login and authentication",
VideoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
}
}
}
}
}
};
// Bind data to the CollectionView
CoursesCollectionView.ItemsSource = Courses;
}
private async void OnViewCourseClicked(object sender, EventArgs e)
{
var button = (Button)sender;
var courseId = (int)button.CommandParameter;
var course = Courses.FirstOrDefault(c => c.Id == courseId);
if (course != null)
{
await Navigation.PushAsync(new CourseDetailPage(course));
}
}
}
// Course Models
public class Course
{
public int Id { get; set; }
public string Title { get; set; }
public string Image { get; set; }
public string Category { get; set; }
public string DatePublished { get; set; }
public List<CourseSection> CourseSection { get; set; }
}
public class CourseSection
{
public int Id { get; set; }
public string Name { get; set; }
public List<CourseSectionLecture> CourseSectionLectures { get; set; }
}
public class CourseSectionLecture
{
public int Id { get; set; }
public string Name { get; set; }
public string Detail { get; set; }
public string VideoUrl { get; set; }
}
}