Skip to content

Commit f5a6893

Browse files
CopilotPureWeen
andcommitted
Revert all template changes - keep only copilot instructions
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
1 parent 4655b34 commit f5a6893

File tree

17 files changed

+138
-298
lines changed

17 files changed

+138
-298
lines changed

src/Templates/src/templates/maui-mobile/AppShell.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
SegmentWidth="40" SegmentHeight="40">
4848
<sf:SfSegmentedControl.ItemsSource>
4949
<x:Array Type="{x:Type sf:SfSegmentItem}">
50-
<sf:SfSegmentItem ImageSource="{StaticResource IconLight}" SemanticProperties.Description="Light mode"/>
51-
<sf:SfSegmentItem ImageSource="{StaticResource IconDark}" SemanticProperties.Description="Dark mode"/>
50+
<sf:SfSegmentItem ImageSource="{StaticResource IconLight}"/>
51+
<sf:SfSegmentItem ImageSource="{StaticResource IconDark}"/>
5252
</x:Array>
5353
</sf:SfSegmentedControl.ItemsSource>
5454
</sf:SfSegmentedControl>

src/Templates/src/templates/maui-mobile/AppShell.xaml.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ public AppShell()
1313
#if (IncludeSampleContent)
1414
var currentTheme = Application.Current!.RequestedTheme;
1515
ThemeSegmentedControl.SelectedIndex = currentTheme == AppTheme.Light ? 0 : 1;
16-
#endif
17-
#if ANDROID || WINDOWS
18-
SemanticProperties.SetDescription(ThemeSegmentedControl, "Theme selection");
1916
#endif
2017
}
2118
#if (IncludeSampleContent)

src/Templates/src/templates/maui-mobile/Data/TagRepository.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,6 @@ public async Task<int> SaveItemAsync(Tag item, int projectID)
200200
await Init();
201201
await SaveItemAsync(item);
202202

203-
var isAssociated = await IsAssociated(item, projectID);
204-
if (isAssociated)
205-
{
206-
return 0; // No need to save again if already associated
207-
}
208-
209203
await using var connection = new SqliteConnection(Constants.DatabasePath);
210204
await connection.OpenAsync();
211205

@@ -218,32 +212,6 @@ public async Task<int> SaveItemAsync(Tag item, int projectID)
218212
return await saveCmd.ExecuteNonQueryAsync();
219213
}
220214

221-
/// <summary>
222-
/// Checks if a tag is already associated with a specific project.
223-
/// </summary>
224-
/// <param name="item">The tag to save.</param>
225-
/// <param name="projectID">The ID of the project.</param>
226-
/// <returns>If tag is already associated with this project</returns>
227-
async Task<bool> IsAssociated(Tag item, int projectID)
228-
{
229-
await Init();
230-
231-
await using var connection = new SqliteConnection(Constants.DatabasePath);
232-
await connection.OpenAsync();
233-
234-
// First check if the association already exists
235-
var checkCmd = connection.CreateCommand();
236-
checkCmd.CommandText = @"
237-
SELECT COUNT(*) FROM ProjectsTags
238-
WHERE ProjectID = @projectID AND TagID = @tagID";
239-
checkCmd.Parameters.AddWithValue("@projectID", projectID);
240-
checkCmd.Parameters.AddWithValue("@tagID", item.ID);
241-
242-
int existingCount = Convert.ToInt32(await checkCmd.ExecuteScalarAsync());
243-
244-
return existingCount != 0;
245-
}
246-
247215
/// <summary>
248216
/// Deletes a tag from the database.
249217
/// </summary>

src/Templates/src/templates/maui-mobile/MauiProgram.cs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,14 @@ public static MauiApp CreateMauiApp()
1818
#if (IncludeSampleContent)
1919
.UseMauiCommunityToolkit()
2020
.ConfigureSyncfusionToolkit()
21-
//-:cnd:noEmit
2221
.ConfigureMauiHandlers(handlers =>
2322
{
24-
#if WINDOWS
25-
Microsoft.Maui.Controls.Handlers.Items.CollectionViewHandler.Mapper.AppendToMapping("KeyboardAccessibleCollectionView", (handler, view) =>
26-
{
27-
handler.PlatformView.SingleSelectionFollowsFocus = false;
28-
});
29-
30-
Microsoft.Maui.Handlers.ContentViewHandler.Mapper.AppendToMapping(nameof(Pages.Controls.CategoryChart), (handler, view) =>
31-
{
32-
if (view is Pages.Controls.CategoryChart && handler.PlatformView is ContentPanel contentPanel)
33-
{
34-
contentPanel.IsTabStop = true;
35-
}
36-
});
23+
//-:cnd:noEmit
24+
#if IOS || MACCATALYST
25+
handlers.AddHandler<Microsoft.Maui.Controls.CollectionView, Microsoft.Maui.Controls.Handlers.Items2.CollectionViewHandler2>();
3726
#endif
38-
})
3927
//+:cnd:noEmit
28+
})
4029
#endif
4130
.ConfigureFonts(fonts =>
4231
{

src/Templates/src/templates/maui-mobile/PageModels/MainPageModel.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public partial class MainPageModel : ObservableObject, IProjectTaskPageModel
3535
[ObservableProperty]
3636
private string _today = DateTime.Now.ToString("dddd, MMM d");
3737

38-
[ObservableProperty]
39-
private Project? selectedProject;
40-
4138
public bool HasCompletedTasks
4239
=> Tasks?.Any(t => t.IsCompleted) ?? false;
4340

src/Templates/src/templates/maui-mobile/PageModels/ProjectDetailPageModel.cs

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using CommunityToolkit.Mvvm.ComponentModel;
22
using CommunityToolkit.Mvvm.Input;
33
using MauiApp._1.Models;
4-
using System.Collections.ObjectModel;
5-
using System.Windows.Input;
64

75
namespace MauiApp._1.PageModels;
86

@@ -36,8 +34,6 @@ public partial class ProjectDetailPageModel : ObservableObject, IQueryAttributab
3634
[ObservableProperty]
3735
private List<Tag> _allTags = [];
3836

39-
public IList<object> SelectedTags { get; set; } = new List<object>();
40-
4137
[ObservableProperty]
4238
private IconData _icon;
4339

@@ -139,10 +135,6 @@ private async Task LoadData(int id)
139135
foreach (var tag in allTags)
140136
{
141137
tag.IsSelected = _project.Tags.Any(t => t.ID == tag.ID);
142-
if (tag.IsSelected)
143-
{
144-
SelectedTags.Add(tag);
145-
}
146138
}
147139
AllTags = new(allTags);
148140
}
@@ -164,6 +156,7 @@ private async Task TaskCompleted(ProjectTask task)
164156
OnPropertyChanged(nameof(HasCompletedTasks));
165157
}
166158

159+
167160
[RelayCommand]
168161
private async Task Save()
169162
{
@@ -181,11 +174,14 @@ private async Task Save()
181174
_project.Icon = Icon.Icon ?? FluentUI.ribbon_24_regular;
182175
await _projectRepository.SaveItemAsync(_project);
183176

184-
foreach (var tag in AllTags)
177+
if (_project.IsNullOrNew())
185178
{
186-
if (tag.IsSelected)
179+
foreach (var tag in AllTags)
187180
{
188-
await _tagRepository.SaveItemAsync(tag, _project.ID);
181+
if (tag.IsSelected)
182+
{
183+
await _tagRepository.SaveItemAsync(tag, _project.ID);
184+
}
189185
}
190186
}
191187

@@ -240,7 +236,7 @@ private Task NavigateToTask(ProjectTask task) =>
240236
Shell.Current.GoToAsync($"task?id={task.ID}");
241237

242238
[RelayCommand]
243-
internal async Task ToggleTag(Tag tag)
239+
private async Task ToggleTag(Tag tag)
244240
{
245241
tag.IsSelected = !tag.IsSelected;
246242

@@ -257,7 +253,6 @@ internal async Task ToggleTag(Tag tag)
257253
}
258254

259255
AllTags = new(AllTags);
260-
SemanticScreenReader.Announce($"{tag.Title} {(tag.IsSelected ? "selected" : "unselected")}");
261256
}
262257

263258
[RelayCommand]
@@ -274,34 +269,4 @@ private async Task CleanTasks()
274269
OnPropertyChanged(nameof(HasCompletedTasks));
275270
await AppShell.DisplayToastAsync("All cleaned up!");
276271
}
277-
278-
[RelayCommand]
279-
private async Task SelectionChanged(object parameter)
280-
{
281-
if (parameter is IEnumerable<object> enumerableParameter)
282-
{
283-
var currentSelection = enumerableParameter.OfType<Tag>().ToList();
284-
var previousSelection = AllTags.Where(t => t.IsSelected).ToList();
285-
286-
// Handle newly selected tags
287-
foreach (var tag in currentSelection.Except(previousSelection))
288-
{
289-
tag.IsSelected = true;
290-
if (!_project.IsNullOrNew())
291-
{
292-
await _tagRepository.SaveItemAsync(tag, _project.ID);
293-
}
294-
}
295-
296-
// Handle deselected tags
297-
foreach (var tag in previousSelection.Except(currentSelection))
298-
{
299-
tag.IsSelected = false;
300-
if (!_project.IsNullOrNew())
301-
{
302-
await _tagRepository.DeleteItemAsync(tag, _project.ID);
303-
}
304-
}
305-
}
306-
}
307272
}

src/Templates/src/templates/maui-mobile/PageModels/ProjectListPageModel.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#nullable disable
12
using CommunityToolkit.Mvvm.ComponentModel;
23
using CommunityToolkit.Mvvm.Input;
34
using MauiApp._1.Data;
@@ -13,9 +14,6 @@ public partial class ProjectListPageModel : ObservableObject
1314
[ObservableProperty]
1415
private List<Project> _projects = [];
1516

16-
[ObservableProperty]
17-
private Project? selectedProject;
18-
1917
public ProjectListPageModel(ProjectRepository projectRepository)
2018
{
2119
_projectRepository = projectRepository;
@@ -28,8 +26,8 @@ private async Task Appearing()
2826
}
2927

3028
[RelayCommand]
31-
Task? NavigateToProject(Project project)
32-
=> project is null ? Task.CompletedTask : Shell.Current.GoToAsync($"project?id={project.ID}");
29+
Task NavigateToProject(Project project)
30+
=> Shell.Current.GoToAsync($"project?id={project.ID}");
3331

3432
[RelayCommand]
3533
async Task AddProject()

src/Templates/src/templates/maui-mobile/Pages/Controls/CategoryChart.xaml

Lines changed: 25 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,49 @@
22
<Border xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
xmlns:chart="clr-namespace:Syncfusion.Maui.Toolkit.Charts;assembly=Syncfusion.Maui.Toolkit"
5-
xmlns:controls="clr-namespace:MauiApp._1.Pages.Controls"
5+
xmlns:controls="clr-namespace:MauiApp._1.Pages.Controls"
66
xmlns:shimmer="clr-namespace:Syncfusion.Maui.Toolkit.Shimmer;assembly=Syncfusion.Maui.Toolkit"
77
xmlns:pageModels="clr-namespace:MauiApp._1.PageModels"
8-
xmlns:models="clr-namespace:MauiApp._1.Models"
98
x:Class="MauiApp._1.Pages.Controls.CategoryChart"
10-
x:DataType="pageModels:MainPageModel"
119
HeightRequest="{OnIdiom 300, Phone=200}"
1210
Margin="0, 12"
13-
Style="{StaticResource CardStyle}">
11+
Style="{StaticResource CardStyle}"
12+
x:DataType="pageModels:MainPageModel">
1413
<shimmer:SfShimmer
15-
AutomationProperties.IsInAccessibleTree="False"
1614
BackgroundColor="Transparent"
17-
VerticalOptions="Fill"
18-
IsActive="{Binding IsBusy}">
15+
VerticalOptions="FillAndExpand"
16+
IsActive ="{Binding IsBusy}">
1917
<shimmer:SfShimmer.CustomView>
2018
<Grid>
21-
<BoxView
19+
<BoxView
2220
CornerRadius="12"
23-
VerticalOptions="Fill"
21+
VerticalOptions="FillAndExpand"
2422
Style="{StaticResource ShimmerCustomViewStyle}"/>
2523
</Grid>
2624
</shimmer:SfShimmer.CustomView>
2725
<shimmer:SfShimmer.Content>
28-
<chart:SfCircularChart x:Name="Chart"
29-
SemanticProperties.Description="Task Categories Chart">
30-
<chart:SfCircularChart.Resources>
31-
<controls:ChartDataLabelConverter x:Key="ChartDataLabelConverter"/>
32-
</chart:SfCircularChart.Resources>
33-
<chart:DoughnutSeries
26+
<chart:SfCircularChart x:Name="Chart">
27+
<chart:SfCircularChart.Legend>
28+
<controls:LegendExt Placement="Right">
29+
<chart:ChartLegend.LabelStyle>
30+
<chart:ChartLegendLabelStyle
31+
TextColor="{AppThemeBinding
32+
Light={StaticResource DarkOnLightBackground},
33+
Dark={StaticResource LightOnDarkBackground}}"
34+
Margin="5"
35+
FontSize="18" />
36+
</chart:ChartLegend.LabelStyle>
37+
</controls:LegendExt>
38+
</chart:SfCircularChart.Legend>
39+
<chart:RadialBarSeries
3440
ItemsSource="{Binding TodoCategoryData}"
3541
PaletteBrushes="{Binding TodoCategoryColors}"
3642
XBindingPath="Title"
37-
YBindingPath="Count"
43+
YBindingPath="Count"
3844
ShowDataLabels="True"
39-
EnableTooltip="False"
40-
x:Name="doughnutSeries"
41-
Radius="{OnIdiom 0.6, Phone=0.5}"
42-
InnerRadius="0.7">
43-
<chart:DoughnutSeries.LabelTemplate>
44-
<DataTemplate>
45-
<HorizontalStackLayout x:DataType="chart:ChartDataLabel">
46-
<Label Text="{Binding Item, Converter={StaticResource ChartDataLabelConverter}, ConverterParameter='title'}"
47-
TextColor="{AppThemeBinding
48-
Light={StaticResource DarkOnLightBackground},
49-
Dark={StaticResource LightOnDarkBackground}}"
50-
FontSize="{OnIdiom 18, Phone=14}"/>
51-
<Label Text=": "
52-
TextColor="{AppThemeBinding
53-
Light={StaticResource DarkOnLightBackground},
54-
Dark={StaticResource LightOnDarkBackground}}"
55-
FontSize="{OnIdiom 18, Phone=14}"/>
56-
<Label Text="{Binding Item, Converter={StaticResource ChartDataLabelConverter}, ConverterParameter='count'}"
57-
TextColor="{AppThemeBinding
58-
Light={StaticResource DarkOnLightBackground},
59-
Dark={StaticResource LightOnDarkBackground}}"
60-
FontSize="{OnIdiom 18, Phone=14}"/>
61-
</HorizontalStackLayout>
62-
</DataTemplate>
63-
</chart:DoughnutSeries.LabelTemplate>
64-
65-
<chart:DoughnutSeries.DataLabelSettings>
66-
<chart:CircularDataLabelSettings LabelPosition="Outside"
67-
SmartLabelAlignment="Shift">
68-
<chart:CircularDataLabelSettings.ConnectorLineSettings>
69-
<chart:ConnectorLineStyle ConnectorType="Line"
70-
StrokeWidth="3"></chart:ConnectorLineStyle>
71-
</chart:CircularDataLabelSettings.ConnectorLineSettings>
72-
</chart:CircularDataLabelSettings>
73-
</chart:DoughnutSeries.DataLabelSettings>
74-
</chart:DoughnutSeries>
45+
EnableTooltip="True"
46+
TrackFill="{AppThemeBinding Light={StaticResource LightBackground}, Dark={StaticResource DarkBackground}}"
47+
CapStyle = "BothCurve"/>
7548
</chart:SfCircularChart>
7649
</shimmer:SfShimmer.Content>
7750
</shimmer:SfShimmer>

src/Templates/src/templates/maui-mobile/Pages/Controls/ChartDataLabelConverter.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)