βœ… 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..
No description
No description
58 Replies
Omnissiah
Omnissiahβ€’2mo ago
you should use the rename function of vs (ctrl r r or you other preferred way)
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
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
Pobiega
Pobiegaβ€’2mo ago
or use the rename tool in VS
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
I'd like to try that method
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Pobiega
Pobiegaβ€’2mo ago
Teach a man to fish etc Tebe
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
Well i FUCKED it again
Merineth πŸ‡ΈπŸ‡ͺ
i renamed it back to mainwindow
No description
Pobiega
Pobiegaβ€’2mo ago
sure but renaming a class or variable or method or property etc uses the exact same thing, and that works pretty well
Merineth πŸ‡ΈπŸ‡ͺ
and it got dragged outisde the mainwindow.xaml file..
Pobiega
Pobiegaβ€’2mo ago
look at the xaml yea
Merineth πŸ‡ΈπŸ‡ͺ
And i can't revert it either
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Pobiega
Pobiegaβ€’2mo ago
so yeah, for this particular case, TeBe is right. Delete and recreate, then update the reference in app.xaml and you're done
Merineth πŸ‡ΈπŸ‡ͺ
Everytime 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 ?
Pobiega
Pobiegaβ€’2mo ago
there is nothing special about MainWindow its just a window so you can rightclick and do Add... Window and name it "GameWindow"
Merineth πŸ‡ΈπŸ‡ͺ
If i have made a lot of classes such as
private class SetupGameDialog : Window { }
private class WinnerDialog : Window { }
private class DrawnDialog : Window { }
private class Player { }
private class Humanplayer { }
private class CompueterPlayer { }
private class GameBoard { }
private class GameManager { }
private class SetupGameDialog : Window { }
private class WinnerDialog : Window { }
private class DrawnDialog : Window { }
private class Player { }
private class Humanplayer { }
private class CompueterPlayer { }
private class GameBoard { }
private class GameManager { }
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
Pobiega
Pobiegaβ€’2mo ago
dunno if there is a "do this for all" for that
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
Ahhhhh i see what you mean completely missunderstood what she meant in the assignment
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
I kind of already renamed it since she requires me to
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
But i get what you mean
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
I had some weird ass errors earlier but gpt solved it for me lmfao
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
I assume dialogs are windows?
No description
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
And yes GPT is shit a coding but it's nice to ask questions
Unknown User
Unknown Userβ€’2mo ago
Message Not Public
Sign In & Join Server To View
Merineth πŸ‡ΈπŸ‡ͺ
Ok thanks for the help! I don't think all should be windows?
Merineth πŸ‡ΈπŸ‡ͺ
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
Pobiega
Pobiegaβ€’2mo ago
green and blue should not be windows they are just normal classes. I thing "engine in" is supposed to be "ending in"
Merineth πŸ‡ΈπŸ‡ͺ
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
Pobiega
Pobiegaβ€’2mo ago
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
Merineth πŸ‡ΈπŸ‡ͺ
Yeah i know, i just meant the creation of the mandatory classes and windows
Pobiega
Pobiegaβ€’2mo ago
uh, I think thats plenty clear. all window classes are marked in red, and it explicitly states that they are of type Window
Pobiega
Pobiegaβ€’2mo ago
No description
Pobiega
Pobiegaβ€’2mo ago
model is green, so we can assume all green classes are "models"
Merineth πŸ‡ΈπŸ‡ͺ
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
Pobiega
Pobiegaβ€’2mo ago
yea Player is just a class. Probably baseclass to HumanPlayer and ComputerPlayerΒ΄.
Merineth πŸ‡ΈπŸ‡ͺ
I did notice that we could use a MVVMarchitecture, 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 it
Pobiega
Pobiegaβ€’2mo ago
MVVM is pretty different from just placing things in the right folders
Merineth πŸ‡ΈπŸ‡ͺ
Is it? We worked with MVC in our last project and it was pretty simple?
Pobiega
Pobiegaβ€’2mo ago
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
Merineth πŸ‡ΈπŸ‡ͺ
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:
Pobiega
Pobiegaβ€’2mo ago
If you already understand ICommand, INotifyPropertyChanged and {Binding} then absolutely feel free to skip that video
Merineth πŸ‡ΈπŸ‡ͺ
Fairly sure those are out of the scope of my course, mainly revolves around working with MVVM and keeping the files organized
Merineth πŸ‡ΈπŸ‡ͺ
Yeah i take it back
No description
Merineth πŸ‡ΈπŸ‡ͺ
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 work
Merineth πŸ‡ΈπŸ‡ͺ
Startupuri 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
Want results from more Discord servers?
Add your server