β WPF Application, renaming
So i'm currently going through an assignment and creating the necessary classes which our WPF program should have. However i got a question...
It says i should rename the initial MainWindow to GameWindow. Does that mean i rename
MainWindow.xaml.cs
to GameWindow.xaml.cs
? The problem is if i do that i get an error..58 Replies
you should use the rename function of vs (ctrl r r or you other preferred way)
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
Hmm i think i managed to do it. I had to enter Mainwindow.xaml, Mainwindow.xaml.cs and App.x.xaml and change everything there
or use the rename tool in VS
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
I'd like to try that method
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
Teach a man to fish etc Tebe
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
Well i FUCKED it again
i renamed it back to mainwindow
sure but renaming a class or variable or method or property etc uses the exact same thing, and that works pretty well
and it got dragged outisde the mainwindow.xaml file..
look at the xaml
yea
And i can't revert it either
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
so yeah, for this particular case, TeBe is right. Delete and recreate, then update the reference in
app.xaml
and you're doneEverytime i create the project it gets named Mainwindow.xaml
There was no option to specify the name to GameWindow.xaml
Thus i assume i just have to do it manually ?
there is nothing special about MainWindow
its just a window
so you can rightclick and do
Add... Window
and name it "GameWindow"If i have made a lot of classes such as
Is there a way to simultaniously move them to their own file location? Or do i have to manually make them?
By right clicking, quick actions etc
dunno if there is a "do this for all" for that
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
Ahhhhh i see what you mean
completely missunderstood what she meant in the assignment
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
I kind of already renamed it since she requires me to
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
But i get what you mean
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
I had some weird ass errors earlier
but gpt solved it for me lmfao
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
I assume dialogs are windows?
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
And yes GPT is shit a coding
but it's nice to ask questions
Unknown Userβ’2mo ago
Message Not Public
Sign In & Join Server To View
Ok
thanks for the help!
I don't think all should be windows?
The red ones should be windows since they are of type / subclass Window
While the Green and blue ones are just basic .cs files?
However she does mention "All the above classes engine in Dialog are dialogues"
And afaik dialogues are windows?
because when i creater Player with the Add -> Window it got automatically put the subclass Window
green and blue should not be windows
they are just normal classes.
I thing "engine in" is supposed to be "ending in"
ahhh okay!
iβm not sure if iβm stupid but arenβt the instructions a little unclear ? :(
i feel like if i didnβt have gpt or this server iβd not understand what to do
wdym? this isnt a tutorial, they dont tell you exactly what to do
its just a brief outline
programming is problem solving, you need to practice that skill by actually solving problems
if someone hands you a solution, you cant do that
Yeah i know, i just meant the creation of the mandatory classes
and windows
uh, I think thats plenty clear.
all window classes are marked in red, and it explicitly states that they are of type Window
model is green, so we can assume all green classes are "models"
I see.
Would that imply that model is not a subclass but in fact just the logic behind my program?
Considering it's not a type such as WinnderDialog, GameWindow etc
yea
Player
is just a class. Probably baseclass to HumanPlayer
and ComputerPlayer
Β΄.I did notice that we could use a
MVVM
architecture, as in Model-View-ViewModel. I.e create appropriate forlders for these three and place them into these
Yeah! I would assume so
Considering they'd most likely want us to use inheritance and polymorphism and that would be the ideal place to make itMVVM is pretty different from just placing things in the right folders
Is it? We worked with MVC in our last project and it was pretty simple?
MVC != MVVM
I made a video about it a few years ago, https://www.youtube.com/watch?v=AOjTIkG5BwE
the big thing is the modelbinding
Yeah i know, i'm just stating that that the idea is the same. Make folders for Model, View and ViewModel and place the files appropriately
45 minutes long about MVVM :harold:
If you already understand
ICommand
, INotifyPropertyChanged
and {Binding}
then absolutely feel free to skip that videoFairly sure those are out of the scope of my course, mainly revolves around working with MVVM and keeping the files organized
Yeah i take it back
Okay i did some research, and apparently
App.xaml
is where the startup is located. So i changed the MainWindow.xaml
into the full path of my locaation of what window i want to start first. But that didn't seem to workStartupuri specifically
yippie i managed to solve it :>
View/GameWindow.xaml
i had to use that instead of the full path? I'm not entirely 100% sure why tho