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

  Рет қаралды 7,116

SingletonSean

SingletonSean

Күн бұрын

Пікірлер: 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 2 жыл бұрын
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?
@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.
@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.
@ivandrofly
@ivandrofly Жыл бұрын
Diagram Store layer 4:53
@geocine
@geocine 3 жыл бұрын
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 3 жыл бұрын
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 3 жыл бұрын
@@SingletonSean Thank you for writing this up , this makes sense
@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: kzbin.info/www/bejne/a2W9npuYpc91o8k 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 (kzbin.info/www/bejne/a2W9npuYpc91o8k), I start getting into edit popups.
Creating Reusable Controls - WPF TUTORIALS
17:10
SingletonSean
Рет қаралды 33 М.
Simplifying View Models (Best Practices) - EASY WPF (.NET 5)
16:54
SingletonSean
Рет қаралды 10 М.
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
Stores - WPF MVVM TUTORIAL #7
14:25
SingletonSean
Рет қаралды 24 М.
Better Java Streams with Gatherers - JEP Cafe #23
1:13:32
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 285 М.
All Rust features explained
21:30
Let's Get Rusty
Рет қаралды 340 М.
Feedback (Loading, Validation, Error Messages) - WPF MVVM TUTORIAL #8
19:49
Account State Management - FULL STACK WPF (.NET CORE) MVVM #18
16:50
SingletonSean
Рет қаралды 3,8 М.
Google I/O 2012 - Go Concurrency Patterns
51:27
Google for Developers
Рет қаралды 827 М.
CppCon 2014: Mike Acton "Data-Oriented Design and C++"
1:27:46