Тёмный

State Management (Managing, Loading, and Lazy-Initializing Data) - WPF TUTORIALS 

SingletonSean
Подписаться 22 тыс.
Просмотров 7 тыс.
50% 1

Learn how to setup state management infrastructure. I also cover key other key concepts, such as reactivity, loading data, and lazy initialization.
State management is crucial for keeping data in sync throughout an application. This concept is applicable to most front-end technologies, and is based off JavaScript state-management libraries, such as Redux.
TIMESTAMPS:
0:00 - Introduction
0:48 - Demo Introduction
2:35 - Stores
3:05 - Creating the PostStore
3:44 - Using the PostStore Data
5:25 - Creating Posts
6:21 - Setting up the Single PostStore Instance
7:47 - Making CreatePost Reactive
10:35 - Loading Posts (Asynchronously!)
14:34 - Making LoadPosts Reactive
15:48 - Lazy-Initializing Posts
19:18 - Conclusion
SOURCE CODE: github.com/SingletonSean/wpf-...
OTHER LINKS:
Become a Member: / @singletonsean
Donations: www.paypal.com/biz/fund?id=UB...

Наука

Опубликовано:

 

28 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 16   
@feitan8745
@feitan8745 3 года назад
As always, good and free content. Your solutions may not be perfect for all the cases but they sure provide a very solid base for most of the cases i belive(at least for very small applications), it's not my first time seeing or using this pattern, but i'm pretty sure most people are not used to the state management pattern, even more in a desktop based techonology like WPF, still you did great showing us how to do it with ease. About the "aync initialization" which seems to be a problem in most cases due to the constructor restriction i always liked your approach, since the main problem seems to be the a possibility of deadlock or simply, the application not knowing the state for the task, the event subscription seems to be easy way out of this situation. Also, did you ever take a look at the *NotifyTaskCompletion* class? Where you encapsulate the task in a observable class and watch for changes as the task progresses?
@SingletonSean
@SingletonSean 3 года назад
As always, thanks for the feedback Feitan! I agree that this probably won't solve every use case, and simple cases might not even need to go this far in managing state. I've seen NotifyTaskCompletion in the wild a few years ago, but never looked that deep into it. It looks like it'd be PERFECT for this use case, especially since the examples I've seen (from the legend Stephen Cleary) actually use it for loading data in view models, haha. Might have to demo that!
@Yelonek1986
@Yelonek1986 Год назад
Hi @SingletonSean, thanks for your videos! I have a question about models which are more complicated, than just fields. What if it contains a list of things A, A contains a list of Bs and Bs contain a couple of Cs. Do I need to pack them all inside separate ViewModels or somehow handle everything inside a single ViewModel? For example I want to show them in a TreeView. Do you have an example like that?
@ivandrofly
@ivandrofly Год назад
Diagram Store layer 4:53
@moonwaxing1
@moonwaxing1 3 года назад
Thanks very much for your videos they are very helpful I always learn from them. One comment your pace of delivery is very fast, I end up reducing the playback speed to 0.75 to help me follow the commentary 😄
@SingletonSean
@SingletonSean 3 года назад
Thanks Moon Waxing, glad you were still able to follow along! I imagine my pace is a bit problematic for more in-depth videos like this. I've considered slowing it down, so I greatly appreciate the feedback.
@thanujafernando6882
@thanujafernando6882 Год назад
Beginner here.. what if i used a static class as the store and have events there with custom delegates, for views to subscribe and update on change? I want to run functions in our webviews when an event is raised.
@Speede04
@Speede04 2 года назад
Hey! I have watch almost every series about MVVM on your channel and I have learned A LOT (really A LOT) but there is one thing I thing is missing that is a pain in my ass (and probably not only for me :D). More specifically: Editing. Loading an entity from list to an edit window, editing and saving. I was struggling a lot with it 'cause I had take care about detaching an entity from entityframework, some DeepCopying and lot of different things to manage (I was doing it without DI). For example I had an issue that where I was making changes in EditWindow (new dialog) data also changes in DataGrid in realtime and even if I cancel changes, they stay the same in DataGrid (in database everything was ok). I am pretty sure there is much easier way to do it better. Is there any chance you will show us how to do it?
@SingletonSean
@SingletonSean 2 года назад
Hey Świętopeł! I handle a very similar scenario in this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-54ZmhbpjBmg.html Unfortunately, I don't have a more concise video where I introduce this concept. I should probably do a video on that since it seems like a pretty common use case. Thanks for the question!
@SingletonSean
@SingletonSean 2 года назад
At around 01:04:00 in that long video I linked above (ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-54ZmhbpjBmg.html), I start getting into edit popups.
@geocine
@geocine 2 года назад
Hi Sean, how about control state how do I make WPF call a function when the user changes a value in an input control, but not when I am updating the value of the control state?
@SingletonSean
@SingletonSean 2 года назад
Good question geocine! Somewhat hard to explain without an example, but basically you could have two separate "entry points" to the value you want to change. How about a Gist for this brisk October evening: gist.github.com/SingletonSean/dfbcf5dd43ceb9b1834b07367163113a
@geocine
@geocine 2 года назад
@@SingletonSean Thank you for writing this up , this makes sense
Далее
когда повзрослела // EVA mash
00:40
Просмотров 1,8 млн
Самоприкорм с сестрой 😂
00:19
Просмотров 264 тыс.
I bet you can understand NgRx after watching this video
22:48
Select Object From Layers | Figma Shortcut
0:21
Просмотров 1,1 тыс.
View Models - WPF MVVM TUTORIAL #3
18:32
Просмотров 81 тыс.
Microsoft MAUI vs  Flutter SwiftUI
1:33
Просмотров 869
Intro to In-Memory Caching in C#
33:56
Просмотров 77 тыс.
Creating Reusable Controls - WPF TUTORIALS
17:10
Просмотров 29 тыс.
Modals / Popups - WPF MVVM NAVIGATION TUTORIAL #7
15:38
Stores - WPF MVVM TUTORIAL #7
14:25
Просмотров 21 тыс.
#miniphone
0:16
Просмотров 3,6 млн
iPhone 16 - КРУТЕЙШИЕ ИННОВАЦИИ
4:50