Skip to content

Commit

Permalink
Add listview items count in notice title (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrocaseti authored Jul 27, 2024
1 parent 2a4afa7 commit 2c89868
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
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

0 comments on commit 2c89868

Please sign in to comment.