Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add listview items count in notice title #270

Merged
merged 2 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ClassevivaPCTO/Strings/it-it/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ Se riscontri bug o hai un'idea per l'app apri un issue su GitHub cliccando sul l
<data name="DashboardOpenNoticeBoardButton" xml:space="preserve">
<value>Apri bacheca</value>
</data>
<data name="NoticeBoardNotices" xml:space="preserve">
<value>Comunicazioni</value>
<data name="NoticeBoardNoticesTitlePlural" xml:space="preserve">
<value>comunicazioni</value>
</data>
<data name="AbsencesEventsCalendar" xml:space="preserve">
<value>Calendario eventi</value>
Expand Down Expand Up @@ -768,4 +768,7 @@ Errore: </value>
<data name="SignSuccessMessage" xml:space="preserve">
<value>Comunicazione confermata e firmata</value>
</data>
<data name="NoticeBoardNoticesTitleSingular" xml:space="preserve">
<value>comunicazione</value>
</data>
</root>
4 changes: 2 additions & 2 deletions ClassevivaPCTO/Views/BachecaPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
Style="{StaticResource CardGridStyle}"
winUi:FrameworkElementExtensions.EnableActualSizeBinding="true">

<TextBlock Style="{StaticResource CardHeaderTextBlockStyle}"
Text="{CustomResource NoticeBoardNotices}"
<TextBlock x:Name="NoticesTitle"
Style="{StaticResource CardHeaderTextBlockStyle}"
Visibility="{x:Bind BachecaViewModel.NoticesToShow, Mode=OneWay, FallbackValue=Collapsed, Converter={StaticResource EmptyListToVisibilityConverter}}" />

<HyperlinkButton x:Name="ClearAllFiltersButton"
Expand Down
11 changes: 11 additions & 0 deletions ClassevivaPCTO/Views/BachecaPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ await CoreApplication.MainView.Dispatcher.RunAsync(
CategoryComboBox.SelectionChanged -= CategoryComboBox_OnSelectionChanged;
BachecaViewModel.Categories = noticeCategories;

var noticesCount = noticesToShow.Count;

if(CategoryComboBox.SelectedIndex == -1)
CategoryComboBox.SelectedIndex = 0;

Expand All @@ -110,6 +112,15 @@ await CoreApplication.MainView.Dispatcher.RunAsync(
else
ClearAllFiltersButton.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

if(noticesCount == 1)
{
NoticesTitle.Text = noticesCount.ToString() + " " + "NoticeBoardNoticesTitleSingular".GetLocalizedStr();
}
else
{
NoticesTitle.Text = noticesCount.ToString() + " " + "NoticeBoardNoticesTitlePlural".GetLocalizedStr();
}

BachecaViewModel.NoticesToShow = noticesToShow;
}
);
Expand Down