Go ahead and program hangman for 2 players, C# newbies. :D
Go ahead and program hangman for 2 players, C# newbies. :D
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.
If you need some in-use examples feel free to look around this.
https://github.com/Tsume/Uguu/tree/master/Client
The folder Models is where majority of your code goes.
ViewModels is where ui updates go (more or less).
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.
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.