✅ Lost again
After entering password and hitting enter, another login window opens, if I close all login windows, if the password was correct, it opens 2 main windows instead of 1.
122 Replies
login.xaml.cs
app.xaml.cs
check if password is not ""
keypress to keydown is better fitting here
but not sure if its in c#
it isnt
password is test
holdpress enter for 10 secs
with or without the password?
tell me what happens after. I believe this will cause many windows to open
Yup
knew it
ignore enter, and add keydown
heydown u handle enter
eh?
Keydown is only called once per button click, this is common in most langs
that will fix the tons of windows
But work is not finished here
Yea, but where?
anywhere in thsi class ig
I have... multiple of them containing keypress
hmm
removing either of them gives error
Is this on github
no
should I commit?
if u do ill take a look via local
Ah but this meant for windows… damn i really dont want to have to run visual studio on my VM
Processing files
ah, a fellow mac user
nah linux
if i run windows i procrastinate too much
lmao
play too much fortnite
If its macos than i should have no issue running. Unless u do it outside of terminal
It's WPF
so...
WPF? Is that an IDE?
Sent ya invite on gh
Windows Something FOrms
Yeah i saw ill accept it
Oh. Hmm how odd. If this uses windows’ window api than it shouldnt run on mac os
Also yes, I am cretin, I should have chosen avalonia
Ye, I am doing it on my main pc
instead of mac book
oh. So it is windows. Ok, ill need to test my new hard drive and start setting up dual boot. I should have my investigation into ur code done sometime tomorrow
oof
I will probably get fix by then
I have deadline in 6 hours
oh damn
Had 12 hours to learn WPF and make a functional code
I guess i have to run this in my windows vm 🥲 with my 16 gb of ram
Gotta love when teachers forget we have personal life
Had to skip work too
16gb ain't that bad
I have 16 gb on my mac
But mac handles ram better overally
so I wouldn't know
My main has 128gb
for vms its not that good
Never had run VM
except parallel
You running a server?
No lmao
I am just a chrome user
lmao
Nothing is gonna limit my experience with chrome
Had a 16gb machine few years ago
I don;'t think it had ever struggled
Unless the situation changed dramatically
16 gb ram is still very good ram
just not for vm's or things that use alot of ram
Fair
My mac is usually using most of the ram
ok, vm is up. Now I need to install visual studio
💀
Just install notepad++
does it work with sln files?
No idea, I was half joking
but visual studio code works with sln files
oh, ok
though you gotta install the c# extension for it
but it's still way faster than download vs22
if you got slow internet
yeah i just cannot run
what are you using?
linux
I meant... which ide
vscode
Hm...
MainWindow mainWindow = new MainWindow();
mainWindow.Show();
this line should only exist once
if show removes the old text, than you should go with only having MainWindow once
I have a feeling something is wrong with this line ((Login)sender).Close(); // Close the login window
but it exists only once
no?
no
Where is it duplicated?
we just proved it here
MainWindow mainWindow = new MainWindow();
that's Login window
Not main window
Even though main window also gets duplicated
oh so you want login menu to be a seperate window from main?
No
I don't want it to get spammed
Gimme second
imma show a gif
(Login)sender).Close(); // Close the login window doesnt make much sense too. you arent closing mainwindow
unless the goal is to remove the last window
This weird crap happens
because of
MainWindow mainWindow = new MainWindow();
It's goal is to close Login window once enter is pressed
if (login.PasswordBox.Password == MasterKey)
{
MainWindow mainWindow = new MainWindow();
mainWindow.Show();
MainWindow.Close(); // Close the login window
}
try this
Nothing
oh right
hmm
The window that gets spammed is login window'
not mainwindow
ok, than do this. if more than one window is created than it is an issue with keypress
`
hah
even weirded shit happens
flickering screen is expected. What is happening on your end
yeah expected
I also put breakpoint on this line, it never occured
where is that code?
was just experiment
neither case reaches breakpoint there
This works
did you put the password in?
But it instantly closes the newly opened window
yea
than sender is Login login is never true
or password is never true
print the pass word above where you check
maybe you are adding the enterkeycode to login.passowrdBox.password
where do I print it
you can add a watch if you want
how
abve the if statement
ye, but what command is that
breakpoint than rightclick on the variable you want to watch
cw?
than click add quick watch
when you trigger a breakpoint you right click the variable you want to watch. this is done at runtime
Set a watch on variables and expressions - Visual Studio (Windows)
While you debug, see variables and expressions in Watch and QuickWatch. Watch can display several variables, QuickWatch only one, and only while in break.
login.PasswordBox.Password change it to this
It is
no
oh right
the password is correct
put a watch for master key too
hmmmmmmmmmmmm
than sender is Login login is never true
it breakpointed
put a breakpoint under it and try t
hmm
But I have to manually click on "close" for it to activate
replace with login.Close()
tried
try this
actually
now it doesn't open window
also gives error
what's the error
if I leave it the way you wrote it
mainWindow doesn't exist
MainWindow does
{
if (e.Key == Key.Return) // Check if Enter key is pressed
{
if (sender is Login login)
{
if (login.PasswordBox.Password == MasterKey)
{ login.Close(); // Close the login window } else { MessageBox.Show("Incorrect MasterKey.", "Error", MessageBoxButton.OK); } } } } do this its supposed to close, not display anything right? if the pass is right
{ login.Close(); // Close the login window } else { MessageBox.Show("Incorrect MasterKey.", "Error", MessageBoxButton.OK); } } } } do this its supposed to close, not display anything right? if the pass is right
Depends on how you mean it
If you mean when pressing enter
than old shit happens
lets get on vc 1
aye
<PasswordBox Name="PasswordBox" Width="300" Height="30" FontSize="30" HorizontalAlignment="Right" Margin="20" KeyDown="KeyPress" ></PasswordBox>