-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_changes.patch
352 lines (340 loc) · 13.8 KB
/
my_changes.patch
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
diff --git a/samples/Plugin.Maui.Audio.Sample/Pages/MyLibraryPage.xaml b/samples/Plugin.Maui.Audio.Sample/Pages/MyLibraryPage.xaml
index 874c033..8534542 100644
--- a/samples/Plugin.Maui.Audio.Sample/Pages/MyLibraryPage.xaml
+++ b/samples/Plugin.Maui.Audio.Sample/Pages/MyLibraryPage.xaml
@@ -1,66 +1,98 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- xmlns:viewmodels="clr-namespace:Plugin.Maui.Audio.Sample.ViewModels"
- x:Class="Plugin.Maui.Audio.Sample.Pages.MyLibraryPage"
- Title="My Library"
- x:Name="Page"
- x:DataType="viewmodels:MyLibraryPageViewModel">
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:viewmodels="clr-namespace:Plugin.Maui.Audio.Sample.ViewModels"
+ xmlns:converters="clr-namespace:Plugin.Maui.Audio.Sample.Converters"
+ x:Class="Plugin.Maui.Audio.Sample.Pages.MyLibraryPage"
+ Title="My Library"
+ x:Name="Page"
+ x:DataType="viewmodels:MyLibraryPageViewModel">
<ContentPage.Resources>
- <Style x:Key="border_gallery_card"
- TargetType="Border">
- <Setter Property="Stroke"
- Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
- <Setter Property="BackgroundColor"
- Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray950}}" />
- <Setter Property="Padding"
- Value="16" />
- <Setter Property="StrokeThickness"
- Value="1" />
- <Setter Property="StrokeShape"
- Value="RoundRectangle 8" />
+ <Style x:Key="border_gallery_card" TargetType="Border">
+ <Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
+ <Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray950}}" />
+ <Setter Property="Padding" Value="16" />
+ <Setter Property="StrokeThickness" Value="1" />
+ <Setter Property="StrokeShape" Value="RoundRectangle 8" />
</Style>
- </ContentPage.Resources>
-
- <Grid RowDefinitions="60,*">
- <Button Text="Create Recording"
- HorizontalOptions="End"
- Margin="10"
- Command="{Binding AddRecordingCommand}" />
+ <converters:FolderFileIconConverter x:Key="FolderFileIconConverter" />
+ <converters:FolderFileFontAttributeConverter x:Key="FolderFileFontAttributeConverter" />
+ <converters:ExpandCollapseConverter x:Key="ExpandCollapseConverter" />
- <CollectionView ItemsSource="{Binding Music}"
- Grid.Row="1"
- SelectionMode="Single">
- <CollectionView.ItemTemplate>
- <DataTemplate x:DataType="viewmodels:MusicItemViewModel">
- <Border Style="{StaticResource border_gallery_card}">
- <Border.GestureRecognizers>
- <TapGestureRecognizer Command="{Binding Path=BindingContext.OpenMusicCommand, Source={x:Reference Page}}"
- CommandParameter="{Binding .}" />
- </Border.GestureRecognizers>
- <Grid ColumnDefinitions="75,*"
- InputTransparent="True"
- RowDefinitions="3*,2*"
- ColumnSpacing="8">
- <!-- Placeholder for imagery -->
- <Image BackgroundColor="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}"
- Grid.RowSpan="2" />
+ <!-- Font attributes as resources -->
+ <FontAttributes x:Key="BoldFontAttribute">Bold</FontAttributes>
+ <FontAttributes x:Key="NoneFontAttribute">None</FontAttributes>
- <Label Text="{Binding Title}"
- FontSize="32"
- FontAttributes="Bold"
- Grid.Column="1" />
+ <!-- Icons -->
+ <FontImageSource x:Key="PersonIcon" Glyph="" FontFamily="FontAwesome" Size="20" />
+ <FontImageSource x:Key="FolderIcon" Glyph="" FontFamily="FontAwesome" Size="20" />
+ <FontImageSource x:Key="FileIcon" Glyph="" FontFamily="FontAwesome" Size="20" />
+ <FontImageSource x:Key="ExpandIcon" Glyph="" FontFamily="FontAwesome" Size="20" />
+ <FontImageSource x:Key="CollapseIcon" Glyph="" FontFamily="FontAwesome" Size="20" />
+ </ContentPage.Resources>
- <Label Text="{Binding Artist}"
- FontSize="20"
- Grid.Column="1"
- Grid.Row="1" />
+ <ScrollView>
+ <Grid RowDefinitions="60,*,150">
+ <Grid ColumnDefinitions="*,Auto">
+ <Entry x:Name="PatientIdEntry" Placeholder="Enter Patient ID" Grid.Column="0" />
+ <Button Text="Create Recording" Grid.Column="1" Command="{Binding AddRecordingCommand}" />
+ </Grid>
+ <CollectionView x:Name="FilesCollectionView" ItemsSource="{Binding Patients}" SelectionMode="Single" Grid.Row="1">
+ <CollectionView.ItemTemplate>
+ <DataTemplate>
+ <StackLayout>
+ <Grid ColumnDefinitions="Auto, *, Auto">
+ <Image Source="{StaticResource PersonIcon}" VerticalOptions="Center" />
+ <Label Text="{Binding Name}" FontAttributes="Bold" VerticalOptions="Center" />
+ <ImageButton Source="{Binding IsExpanded, Converter={StaticResource ExpandCollapseConverter}}" Command="{Binding Path=BindingContext.OpenMusicCommand, Source={x:Reference Page}}" CommandParameter="{Binding .}" />
</Grid>
- </Border>
+ <CollectionView ItemsSource="{Binding Visits}" IsVisible="{Binding IsExpanded}" SelectionMode="Single">
+ <CollectionView.ItemTemplate>
+ <DataTemplate>
+ <StackLayout Padding="20,0,0,0">
+ <Grid ColumnDefinitions="Auto, *, Auto">
+ <Image Source="{Binding IsFolder, Converter={StaticResource FolderFileIconConverter}}" VerticalOptions="Center" />
+ <Label Text="{Binding Name}" FontAttributes="{Binding IsFolder, Converter={StaticResource FolderFileFontAttributeConverter}}" VerticalOptions="Center" />
+ <ImageButton Source="{Binding IsExpanded, Converter={StaticResource ExpandCollapseConverter}}" Command="{Binding Path=BindingContext.OpenMusicCommand, Source={x:Reference Page}}" CommandParameter="{Binding .}" />
+ </Grid>
+ <CollectionView ItemsSource="{Binding Children}" IsVisible="{Binding IsExpanded}" SelectionMode="Single">
+ <CollectionView.ItemTemplate>
+ <DataTemplate>
+ <StackLayout Padding="20,0,0,0">
+ <Border Style="{StaticResource border_gallery_card}">
+ <Border.GestureRecognizers>
+ <TapGestureRecognizer Command="{Binding Path=BindingContext.OpenMusicCommand, Source={x:Reference Page}}" CommandParameter="{Binding .}" />
+ </Border.GestureRecognizers>
+ <Label Text="{Binding Name}" />
+ </Border>
+ </StackLayout>
+ </DataTemplate>
+ </CollectionView.ItemTemplate>
+ </CollectionView>
+ </StackLayout>
+ </DataTemplate>
+ </CollectionView.ItemTemplate>
+ </CollectionView>
+ </StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
+
+ <!-- Patient Details Section -->
+ <StackLayout Grid.Row="2" Padding="10">
+ <Label Text="Patient Details" FontAttributes="Bold" FontSize="Medium" />
+ <Image Source="{Binding SelectedPatient.PictureUrl}" HeightRequest="100" WidthRequest="100" />
+ <Label Text="Name: " />
+ <Label Text="{Binding SelectedPatient.Name}" />
+ <Label Text="Health Card Number: " />
+ <Label Text="{Binding SelectedPatient.HealthCardNumber}" />
+ <Label Text="Last Visit: " />
+ <Label Text="{Binding SelectedPatient.LastVisitDateTime}" />
+ <Label Text="Length of Visit: " />
+ <Label Text="{Binding SelectedPatient.LengthOfVisit}" />
+ </StackLayout>
</Grid>
+ </ScrollView>
</ContentPage>
diff --git a/samples/Plugin.Maui.Audio.Sample/ViewModels/MyLibraryPageViewModel.cs b/samples/Plugin.Maui.Audio.Sample/ViewModels/MyLibraryPageViewModel.cs
index e4b267d..346105b 100644
--- a/samples/Plugin.Maui.Audio.Sample/ViewModels/MyLibraryPageViewModel.cs
+++ b/samples/Plugin.Maui.Audio.Sample/ViewModels/MyLibraryPageViewModel.cs
@@ -1,38 +1,173 @@
using System.Collections.ObjectModel;
namespace Plugin.Maui.Audio.Sample.ViewModels;
-
public class MyLibraryPageViewModel : BaseViewModel
{
- public Command AddRecordingCommand { get; }
- public Command OpenMusicCommand { get; }
- public ObservableCollection<MusicItemViewModel> Music { get; }
+ public Command AddRecordingCommand { get; }
+ public Command<FolderItem> OpenMusicCommand { get; }
+
+ ObservableCollection<Patient> patients;
+ Patient selectedPatient;
+
+ public ObservableCollection<Patient> Patients
+ {
+ get => patients;
+ set
+ {
+ patients = value;
+ NotifyPropertyChanged();
+ }
+ }
+ public Patient SelectedPatient
+ {
+ get => selectedPatient;
+ set
+ {
+ selectedPatient = value;
+ NotifyPropertyChanged();
+ }
+ }
+
+ public MyLibraryPageViewModel()
+ {
+ Patients = new ObservableCollection<Patient>
+ {
+ new Patient
+ {
+ PatientId = "100",
+ Name = "John Doe",
+ HealthCardNumber = "1234-5678",
+ PictureUrl = "patient1.jpg",
+ LastVisitDateTime = DateTime.Now.AddDays(-1),
+ LengthOfVisit = "30 minutes",
+ Visits = new ObservableCollection<FolderItem>
+ {
+ new FolderItem
+ {
+ Name = "2023-09-22",
+ IsFolder = true,
+ Children = new ObservableCollection<FolderItem>
+ {
+ new FolderItem
+ {
+ Name = "100_2023-09-22_10-30-00.mp3",
+ IsFolder = false
+ },
+ new FolderItem
+ {
+ Name = "100_2023-09-22_11-00-00.mp3",
+ IsFolder = false
+ }
+ }
+ },
+ new FolderItem { Name = "2023-09-21", IsFolder = true },
+ new FolderItem { Name = "2023-09-20", IsFolder = true },
+ new FolderItem { Name = "2023-09-19", IsFolder = true },
+ new FolderItem { Name = "2023-09-18", IsFolder = true }
+ }
+ },
+ new Patient
+ {
+ PatientId = "101",
+ Name = "Jane Smith",
+ HealthCardNumber = "8765-4321",
+ PictureUrl = "patient2.jpg",
+ LastVisitDateTime = DateTime.Now.AddDays(-2),
+ LengthOfVisit = "45 minutes",
+ Visits = new ObservableCollection<FolderItem>
+ {
+ new FolderItem { Name = "2023-09-21", IsFolder = true }
+ }
+ },
+ new Patient
+ {
+ PatientId = "102",
+ Name = "Alice Johnson",
+ HealthCardNumber = "5678-1234",
+ PictureUrl = "patient3.jpg",
+ LastVisitDateTime = DateTime.Now.AddDays(-3),
+ LengthOfVisit = "25 minutes",
+ Visits = new ObservableCollection<FolderItem>
+ {
+ new FolderItem { Name = "2023-09-20", IsFolder = true },
+ new FolderItem { Name = "2023-09-19", IsFolder = true }
+ }
+ }
+ };
+
+ AddRecordingCommand = new Command(async () => await AddRecording());
+ OpenMusicCommand = new Command<FolderItem>(async (item) => await OnMusicItemSelected(item));
+ }
+
+ static async Task AddRecording()
+ {
+ await Shell.Current.GoToAsync("AudioRecorderPage");
+ }
+ static async Task OnMusicItemSelected(FolderItem item)
+ {
+ if (item.IsFolder)
+ {
+ item.IsExpanded = !item.IsExpanded;
+ }
+ else
+ {
+ await Shell.Current.GoToAsync(
+ "MusicPlayerPage",
+ new Dictionary<string, object>
+ {
+ ["Music"] = item
+ });
+ }
+ }
+}
- public MyLibraryPageViewModel()
+public class Patient : BaseViewModel
+{
+ bool isExpanded;
+ public string PatientId { get; set; }
+ public string Name { get; set; }
+ public string PictureUrl { get; set; }
+ public string HealthCardNumber { get; set; }
+ public DateTime LastVisitDateTime { get; set; }
+ public string LengthOfVisit { get; set; }
+ public ObservableCollection<FolderItem> Visits { get; set; }
+
+ public bool IsExpanded
{
- Music = new ObservableCollection<MusicItemViewModel>
+ get => isExpanded;
+ set
{
- new MusicItemViewModel("The Happy Ukelele Song", "Stanislav Fomin", "ukelele.mp3")
- };
+ isExpanded = value;
+ NotifyPropertyChanged();
+ }
+ }
- AddRecordingCommand = new Command(async () => await AddRecording());
- OpenMusicCommand = new Command(async (object item) => await OnMusicItemSelected((MusicItemViewModel)item));
+ public Patient()
+ {
+ Visits = new ObservableCollection<FolderItem>();
}
+}
+public class FolderItem : BaseViewModel
+{
+ bool isExpanded;
- async Task AddRecording()
+ public string Name { get; set; }
+ public bool IsFolder { get; set; }
+ public ObservableCollection<FolderItem> Children { get; set; }
+ public bool IsExpanded
{
- await Shell.Current.GoToAsync(Routes.AudioRecorder.RouteName);
+ get => isExpanded;
+ set
+ {
+ isExpanded = value;
+ NotifyPropertyChanged();
+ }
}
- async Task OnMusicItemSelected(MusicItemViewModel musicItem)
+ public FolderItem()
{
- await Shell.Current.GoToAsync(
- Routes.MusicPlayer.RouteName,
- new Dictionary<string, object>
- {
- [Routes.MusicPlayer.Arguments.Music] = musicItem
- });
+ Children = new ObservableCollection<FolderItem>();
}
}
\ No newline at end of file