File tree Expand file tree Collapse file tree 3 files changed +19
-22
lines changed
src/DevTKSS.Uno.Samples.MvuxGallery Expand file tree Collapse file tree 3 files changed +19
-22
lines changed Original file line number Diff line number Diff line change @@ -26,13 +26,10 @@ public partial record SomeModel
2626 public IListFeed<GalleryImageModel> GalleryImages => ListFeed.Async(this._galleryImageService.GetGalleryImagesAsync);
2727 public IState<string> SomeTitle => State<string>.Value(this, () => _stringLocalizer["SomeTitle"]);
2828
29- #region ViewHeaderContent
30- public IFeed<HeaderContent> ViewHeaderContent => Feed.Async(GetGridViewHeaderAsync);
31- public async ValueTask<HeaderContent> GetGridViewHeaderAsync(CancellationToken ctk)
32- {
33- await Task.Delay(TimeSpan.FromMilliseconds(1), ctk);
34- var headerContent = new HeaderContent("Assets/Images/logo.png", _stringLocalizer["GridViewTitle"]);
35- return headerContent;
36- }
37- #endregion
29+
30+
31+ public IState<HeaderContent> ViewHeaderContent => State<HeaderContent>.Value(this,
32+ () => new HeaderContent(ImageLocation: "Assets/Images/styled_logo.png",
33+ Caption: _stringLocalizer["ListViewTitle"]));
34+
3835}
Original file line number Diff line number Diff line change @@ -35,12 +35,8 @@ public DashboardModel(
3535 /// <remarks>
3636 /// uses <see cref="IStringLocalizer"/> to dynamically localize the caption
3737 /// </remarks>
38- public IState < HeaderContent > ViewHeaderContent =>
39- State < HeaderContent > . Value (
40- owner : this ,
41- valueProvider : ( ) =>
42- new HeaderContent (
43- ImageLocation : "Assets/Images/styled_logo.png" ,
38+ public IState < HeaderContent > ViewHeaderContent => State < HeaderContent > . Value ( this ,
39+ ( ) => new HeaderContent ( ImageLocation : "Assets/Images/styled_logo.png" ,
4440 Caption : _stringLocalizer [ "GridViewTitle" ] ) ) ;
4541 #endregion
4642
Original file line number Diff line number Diff line change @@ -84,13 +84,17 @@ public ListboardModel(
8484 /// <summary>
8585 /// Gets the header content for the view, including an image and caption.
8686 /// </summary>
87- public IState < HeaderContent > ViewHeaderContent =>
88- State < HeaderContent >
89- . Value ( owner : this ,
90- valueProvider : ( ) =>
91- new HeaderContent (
92- ImageLocation : "Assets/Images/styled_logo.png" ,
93- Caption : _stringLocalizer [ "ListViewTitle" ] ) ) ;
87+ /// <remarks>
88+ /// A Feed always needs a Async or Create function wich takes the cancellation token as parameter.<br/>
89+ /// So this is using a Task.Delay to simulate a delay in the async function.
90+ /// </remarks>
91+ public IFeed < HeaderContent > ViewHeaderContent => Feed < HeaderContent > . Async (
92+ valueProvider : async ( ct ) =>
93+ {
94+ await Task . Delay ( 1 , ct ) ;
95+ return new HeaderContent ( ImageLocation : "Assets/Images/styled_logo.png" ,
96+ Caption : _stringLocalizer [ "ListViewTitle" ] ) ;
97+ } ) ;
9498 #endregion
9599}
96100
You can’t perform that action at this time.
0 commit comments