Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[REL] [C#] [WPF] Simple Program

Elite Diviner
Joined
Jul 25, 2013
Messages
466
Reaction score
55
If you need some in-use examples feel free to look around this.



The folder Models is where majority of your code goes.
ViewModels is where ui updates go (more or less).

Thanks alot!
 
• ♠️​ ♦️ ♣️ ​♥️ •
Joined
Mar 25, 2012
Messages
909
Reaction score
464
Get out of the habit of writing code in the UI's code behind. Look up MVVM when working with WPF.
It'll save you a lot of headache in the future.

Well writing code that controls the UI itself has to be placed there, but the only thing. No matter you use WPF, Windows.Forms, ASPX, whatever. Always code with a more tier architecture. Split managing logic off the UI. And split data access logic off the managing login.
 
It won't fit
Loyal Member
Joined
May 18, 2007
Messages
1,789
Reaction score
291
Well writing code that controls the UI itself has to be placed there, but the only thing. No matter you use WPF, Windows.Forms, ASPX, whatever. Always code with a more tier architecture. Split managing logic off the UI. And split data access logic off the managing login.

No, it doesn't. I've halfway through with the program I linked to above, and I haven't written anything at all in the UI's code behind.

Done correctly, you shouldn't have anything at all in that file. If you're altering the ui from that file, you're doing it wrong and you're also opening yourself up to some headaches down the road.
Mostly UI blocking/locked threads.
 
• ♠️​ ♦️ ♣️ ​♥️ •
Joined
Mar 25, 2012
Messages
909
Reaction score
464
No, it doesn't. I've halfway through with the program I linked to above, and I haven't written anything at all in the UI's code behind.

Done correctly, you shouldn't have anything at all in that file. If you're altering the ui from that file, you're doing it wrong and you're also opening yourself up to some headaches down the road.
Mostly UI blocking/locked threads.

I see what you are doing there, but I wonder for what you got your MainWindow.xaml.cs then? Microsoft made it this way by clicking on events in the designer it adds the subscription method in the xaml.cs file automatically, for a good reason.
Now you just go out and write your own View controller/Model or what ever it is ... I can clearly see you mix UI events with business logic that does not belong there inside of the MainViewModel.cs. But about that there is always a grey zone between right and wrong.
 
Back
Top