Qwerz
Blazor Forms and Different Sessions
This is my first Blazor project, so I'll have to look into services and concern separation as a whole, I assume they work similar to WPF. Right now, my main focus is to get things working in a stable manner. Thank you for your help so far!
14 replies
✅ How do you handle countdowns of objects?
This basically decribes your example from above, right? I just finished implementing it this way in my project and it works like a charm! The best thing is, it still feels MVVM conform and I can definitely see myself using something similar in many future situations. MVVM is straightforward...to those who already excel at it it seems 😉 I've been learning the pattern for this past year and I still find myself trapped in simple problems like these. Thanks again for taking the time to help me out, very much appreciated!
33 replies
✅ How do you handle countdowns of objects?
Thanks for expanding on this. I'm confused because I can't quite identify why using two ViewModels is necessary or solved the problem at hand (periodically updating collection of objects in an items control). I have a very similar setup, the difference being that I don't have a child VM but only a ViewModel for my View.
Thus I'm still stuck on implementing a solution using a single timer instead of one for each object in the list. I'm also curious to understand whether using two VMs is beneficial / the "correct" way? Thank you!
33 replies
✅ How do you handle countdowns of objects?
I guess I deviated from the norm a little then. I’m using a single viewmodel and view, where I have a listbox with data template that binds to a collection in the viewmodel. And yes, I would like to show the countdown in the list. Do you have an idea where I could get an example for the timer per object implementation? It would really help to see how others have gone about doing this.
33 replies
✅ How do you handle countdowns of objects?
So you’d have two views (one used as a component) and two corresponding nested view models? Why not just use one view model? I’m, sorry but I’m a bit confused by having a collection of viewmodels. Could you explain this please? I’m always eager to learn if there’s a better way!
33 replies
✅ How do you handle countdowns of objects?
My problem with the approach of having a separate collection that is refreshed via a timer is that I’m not sure how to reference it in my View and bind to it, because it’s a different datacontext than the viewmodel I’m using. I can’t wrap my head around how to structure this in a meaningful way, how to keep track of each objects expiration. I’m a bit surprised there’s no easy example because I thought this was something relatively commonly implemented.
33 replies
Adding items to an observable collection from 'outside' (MVVM)
Alright, I get the approach but I'm still not sure how to call this from the BL in a static context? I see you're using a relay command, but that doesn't help me when I want to add an event from an otherwise completely unrelated class, right? Could you please include an example of how I would call the AddEvent() function from "somewhere" else?
14 replies
Adding items to an observable collection from 'outside' (MVVM)
Thank you so much for taking the time to help me out, I really really appreciate it!
It will take me some time to test this out and work around community tool kit - I will get back as soon as I have come around to doing that.
14 replies
Adding items to an observable collection from 'outside' (MVVM)
Oh I can relate...😅 Without spilling too much salt; I also find it quite difficult to outsource features in the team. My favourite: new views are not implemented into the MVVM navigation, but are opened using dialogs -.- .
I'm having a tough time to pass anything UI related onto one of my coworkers, because what's produced rarely fits the projects structure. Anyways, I can't do everything on my own, and vast parts of the BL are unbeknown to me. I'm also not really in a leading position, but I'm charged to oversee the GUI aspect and UX decisions. Hence my preference to produce a static function. In the mid-term I plan on suggesting everyone (myself included) take an extensive course, but right now we have to focus on getting the work done.
14 replies