Thank you for actually explaining what the Binding and Converter were and how they actually worked, I get so annoyed when people introduce these abstractions and just brush them off as magic especially when I might actually need to use a similar concept later.
Great episode, thanks Tim. Though I was shouting at the screen trying to tell you where the issue was. Glad you found it eventually and pointed it out - Run time issues are some of the worse to spot since you don't get actual errors!
Yay, I found the error before u :D Thanks, for leaving that in. I really need some debugging practice. I see myself making such a video and cutting it out because of petty pride
Hi Tim, first of all, thanks very much for all your great videos. One thing I would love to see, is how you would handle Internationalization, at least of the basic application text. This is something that is almost never touched on in tutorials, but for some of us, is a hard requirement (I'm in Canada, so English and French are required).
I learnt a great tip with regards to dealing with a tricky debugging process. The tip is to "Make a list of assumptions of what causes the program to be working correctly" and then you know that at least one of them is not correct.
I made a mistake with mixing the public and private ErrorMessage and that made me go crazy. Ended up noticing that you pressed the login button twice so when i finally noticed my mistake i just went to fix that annoyance of pressing login twice before continuing the video. Funny that i did not get your error message whahaha. Good to see i'm actually learning 😊😊 Hope i learn enough to migrate my Laravel PHP webapp in a standalone executable. Laravel is super easy to use because it's a box of puzzle pieces that are made to fit in anyway you want, but i need more hardware level access than PHP can provide 😉 Already so many checkboxes checked, database, frontend, Auth, api AND Swagger. Plenty video's to go in this playlist, so far i like it a lot Thanks!
Yes - I was in the "noticed straight away" camp, even before the bad behaviour became a discussion point. But not because I'm superior - I've actually battled that same problem in my own project previously. One of those bugs that's easy to accidentally insert (especially when you're being lazy with copy and paste) but not so easy to see straight away afterwards.
Same but when he first did the property I was thinking surely that wrong order will throw up problems later for him... but then completely forgot about it, so I was completely stumped when his didn't work and mine worked correctly, sat there rewatching the video scratching my head until I finally watched his answer, I think that actually makes me the most inferior!
Same camp as Oliver. Saw the backing being set after the notify when you first wrote it, thought “Hmm, I wonder if this is an intentional mistake to showcase how to debug again?” Then ENTIRELY forgot about it and was a stumped for a good bit about what was causing the issue once you were testing it out.
I made a bug by mistake that helped me practice debugging. I set up IsErrorVisible to private... I have been struggling with that for some time. I could not catch first value to check and therefor i could not load off error message of the collapsed state. Used your methods of debugging step by step and find out where problem was. Thanks for all the hard work and for the videos that you share. Keep up the good work !
Whew!!! Sure couldn't proceed with the video unless had found the solution to the problem by coincidentally hitting the button twice. Great debugging man! Besides a single line's location being changed, BooleanToVisibilityConverter also takes time to make the response the first time the app launches.
Just wanted to say enjoying the warts and all approach which is refreshing and good. Also the Cliburn Micro approach is quite a lot easier than using say Prism with Delegate Commands.
Just a quick message for everyone. After you hit the log in button wait a while if the error message doesn't show up. I spent half a day troubleshooting and the only issue was my impatience. Maybe my internet is a little slower, but the error message takes a little while to show up. 5 more seconds of waiting would have saved my numerous hours of troubleshooting.
Great video. Never had the chance to learn how to pull from an api. Now I am. This video series is going to help me with something I need to know for my job. Just one question: Why didn't you use a visibility property with a tertiary operator? Public Visibility IsErrorVisible = (ErrorMessage.Length > 0) ? Visibility. Visible : Visibility,Collapsed
I tend to avoid one-liners and collapsed logic because it is not scannable. If you are reading down through my code, the attempt is that you can quickly read each line and understand it. Lines that have multiple pieces of logic in one take you time to pause and review. That slows down your ability to scan the document for what you are looking for. It also can be more difficult on a newer developer. Code is meant to be read by humans, not the compiler. So, anything I can do to make the job of reading the code easier is something I try to do. That's why. It doesn't mean that you can't do what you are doing. Go for it. It all depends on your environment and who is working on your code (and who you want to hire).
@@IAmTimCorey I understand what you are saying. Since, I will be the only one developing this app, it makes I should use what I can read. In a more diverse environment, I definitely see why your code would be easier to read.
Fun quirk, the setting of the ErrorMessage is synchronous inside the async task. So if you watch carefully even if ErrorMessage comes after the await for the result, the message goes away while it waits.
I was strugling problem with displaying error message. It wasnt work with flaabackvalue, but once i removed it then its start work. After one hr i Just go to sleep and sit to code next Day. After Reading comments here what might be a problem i just look to code in loginview.xaml then immediately looked for literal, IsErrorBissible inseat IsErrorVissible😁 but it help me better understand connection betwen this and method loginviewmodel. Thanks Tim. And as always Great course!!!
The moral of the story is don't notify of property change before you actually changed the property! I saw you do this when you initially entered the code and had no idea why you were doing that.
Thanks for these tutorials, Tim. I would be keen to see how you add user password changing, as the user authentication records are handled separately as well as done manually, so all the hashing is done magically. Even with manual setups, you wouldn't be able to manually change a users password/hash??
I will set up password reset, but there won't be any manually handling of passwords. We want to keep that in the users' hands. We don't want to have access to passwords for any longer than we have to. We will make one call to reset it and that is it.
Enjoying the course - trying NOT to download source code and get it right on my own understanding and work - as an ex FoxPro coder and in my 60's - Sometimes means repeating lesson - phew )-: Obviously, I'm 2 years late from the start of your project - so some updates change things around, example: last lesson - my local was https by default. Just a note - it would be nice if you included the Lesson Number on the Title Screen, says Lesson 12 of 60 - just so us oldies can get around! Cheers from Perth, Western Australia 😊.
I'm two years late as well, and I'm just about to start this lesson. I had to figure out how to disable SSL on the Web API project just like you did since Visual Studio sets it to use HTTPS by default. Not sure how you're watching the videos, but I went to Tim's playlist's, and started watching the "TimCo Retail Manager Course" from the beginning. Since I started watching from the playlist, it shows that it's 12/60 in the playlist pane on the right (outside of the video). Not sure if you didn't see that, or you did but just thought it would be nice to also see the lesson number in the title screen. But just in case you haven't seen it, I figured I would mention it. I admire people who don't use the "can't teach an old dog new tricks" excuse to avoid learning something new. I have to imagine that FoxPro is significantly different from C#, so there's a big learning curve. But best of luck my friend!
Our company's core system was developed 30+ years ago in Visual FoxPro any we are finally getting serious about building a new system from scratch. I have also been doing fringe projects in c# for the past 8 years, but if we are going to build a core system I knew I needed to learn from Tim. This course is excellent so far. I am learning so much. Until now I didn't understand MVVM or dependency injection at all. It's a lot of up front setup, but after that it seems like it will make the entire lifecycle of the project so much easier. Totally different animal than Fox. No pun intended!
That was frustrating. I autopilot fixed the ErrorMessage property when I wrote it and then was panicking about why my version was working when yours wasn't.
I don't have a planned end date for it. Part of the purpose of this course is to build out an ecosystem that we can use for future discussions on technologies. We can upgrade the application just like you would a real application at your job.
Hello Tim quick question. Rather than have the BooleanToVisibilityConverter, could we also not just switch the text in ErrorMessage from a blank string (" ") to whatever message the API returns? I accidentally came across this during my troubleshooting and it makes sense seeing as the textblock will basically collapse all on its own when there's no text for it to display
The self-closing tag is used when you don't need anything inside the element as a child. The full close tag is used when you want to put something inside the element as a child element.
hi tim , i keep learning from yours videos , and i'd give useful idea i't can simplified writing (full property) and less errors in code , you can use (Fody/PropertyChanged) lib , it's very simple just installl it because i use in this tutorials and i'm not facing the issues that you discused thanx you so much for your tutorial , and i hope donate you soon when i found a jobe
I added pass/fail error messaging after the last video -- so even though I re-did everything to match your example I avoided the notify sequence issue (lucky me for once!). My question: Is there a place where you say "Hey, this is a perfect place to save off all this work and make it a WPF/API/MVVM template for my next project." It seems like after the login, that is where all the "custom" work begins. Next project, I just load the starter project, rename directories/projects as required and get rolling. (I hope that makes sense).
That's a bit of a different animal. What you are looking for is how to create a new template. Otherwise, your naming will all be for this project and renaming things to that extent will be messy. Unfortunately, that is a more complicated topic. It is on my list of topics to cover at some point though.
I don't recall how to do this in VIsual Studio proper, I know in VS Code, you can copy an existing template and then add in the JSON for pieces. That could be quite an involved project though. Sounds cool.
Hi Tim, I know you are executing an async task to auhtenticate, however my authentication takes a few seconds... Unfortunately, the is thinking he hasn;t clicked on the Login button... Is there anyway, unless the async task, you can show a waitcursor. A login dialog should have a wait cursor though? No?
A quick google says you want to use Mouse.OverrideCursor, setting it to a value of System.Windows.Input.Cursors.Wait. This will most likely need to be executed/invoked via the main thread when you want to call it from an async task. This means that you'll need to use Application.Current.Dispatcher.Invoke method to execute/invoke it on the correct thread. Make sure that you use a finally statement to remove the override cursor by setting the property to null, and invoking it on the correct thread.
Not sure about a wait cursor, but you could perhaps disable the Login button until the request failed, I suppose, thereby preventing double auth. Another thing to simulate, you could add in a Sleep call in the api to make it take a bit more time and feel like a real app for testing purposes. (you wouldn't want it in the prod deploy though.)
Hi Tim. Great video as usual! But strange thing - in your xaml file, inside strings, dot character is not visible. So "Binding.ErrorMessage" looks like "Binding ErrorMessage"
Daniel, the line is supposed to be: Visibility="{Binding IsErrorVisible, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}" We are binding the "ErrorMessage" visibility to the IsErrorVisible property, so there is no "Binding.ErrorMessage"... at least that is how it works in my version...
Hi Tim I am really enjoying this tutorial. But I have a issue I cant figure out. the error on the log in screen only shows after I hit login 2 times. It shows in the code first hit but does nut update the screen the second hit. any ideas
My guess is that you are not triggering a NotifyOfPropertyChanged event when you change the error message. It doesn't show until the second attempt because the second attempt includes you hitting a button, which triggers a screen refresh.
hey Tim i got i little suggestion for future videos. I've done some Udemy courses before and i found that i learnt a lot more from the ones that has like a little challenge (or quiz) at the end of the video summarizing what the topic of the video was about. do you think you could implement something like that in future videos ( :
I do that in my Foundation in C# course series. I don't do that here just because of how much extra work it takes. I do offer a Weekly Challenge every Thursday, though, where you can make sure you are keeping your C# skills sharp.
I started the next lesson (13), I'm 10 minutes in and then it dawned on me that I never committed this lesson. I have already created the class library in lesson 13, should I include it in my git commit? If not do I just not stage my class library?
Nope. You can select just what you want to commit so don't include something from the next task in your commit. Just leave it in your working directory (not staged), make your commit, then continue working on the next lesson.
Hey Tim, I've gone through the comments here and tried to see if anyone had a similar error. I still get a "Bad Request" even when I enter the correct details. I've tried creating a new user, restarted VS, checked the spelling and gone through both of the WPF Login videos to see if I've missed something but to no avail. I don't know what I could have missed. As far as my debugging went, it seems to me as if the PostAsync method in the APIHelper always returns bad request.
Hi Tim! Your videos helps me a lot in my carrier of programming i came from java and now really like C#. I'm now in a project which is to create a web API, and as always i see on your tutorials and not in these, you create a class library for Data Access and i'm trying to follow the same approach, and i don't know if i must select .Net Core or .Net Standard class library. Can you please help me? Thank you and don't stop (I'm saving money to buy one of your courses).
Well, if you are following along with this application, you will see me build a class library (probably in our next video) in .NET Framework. That is because this application is simulating an existing business's source code. Moving forward with new code, you have the option of staying with the .NET Framework or going with .NET Core. It is an additional learning curve but .NET Core is faster and modern. As a result, I would recommend .NET Standard, since a .NET Standard library has the ability to work with .NET Framework projects, .NET Core projects, and more. It does limit what you can do somewhat but that usually isn't an issue. I do have a video on .NET Standard here on UA-cam: ua-cam.com/video/Ph_jSGq6vIA/v-deo.html
I instinctivly made the ErrorMessage equal to null instead of empty string because I learned that when working with ? you should use null more often to reduce code complexity, make the garbage collector more efficient, and to reduce memory overhead requirements. @IAmTimCorey I wonder what you think of that? I know its an isolated instance, but in a larger application it could add up.
That's what Caliburn Micro uses to know when a value has changed for a property. When you fire off that event, it tells CM to update the screen for that object. Without it, CM does not know when a value has changed.
I thought that the Bad Request message wasn't showing due to a typo as some had noted below. But after triple checking everything I realised my API was just sluggish on the first attempt, so wait 5 seconds after clicking the button and see if that's the issue.
Yep, the server takes a few seconds to warm up. That's why when you use Azure in production you want to pay for your web apps and turn off the feature that shuts down unused servers.
I personally would clear the errormessage also in the Set Password/Username and put the message below the button so it doesn't create a large distracting visual change. Also I wouldn't want the errormessage row NOT showing in the editor as I want everything visible that might be visible so I don't forget about it when the screen gets a bit more controls. And why not use "return (ErrorMessage?.Length > 0)" directly instead of first using a variable? Personally I only use a variable in such cases if there's more checks which can change the 'output' Also not really a fan of just plugging a property/method anywhere in the class, but that's just the autist in me, I like a bit of order, so properties first, then methods and all in alphabetical order (Only thing I really hate about C#(++) is why they just didn't name the constructor 'Constructor' instead of the name of the class or the even more awful destrcutor/finalizer(~), it still baffles me why they ever choose that, but that's a whole different discussion, haha). But thanx again for the great tutorials.
I use a variable to make debugging simpler. You can put a breakpoint on the output and see the value of the variable before it is returned. That is simpler than trying to capture the state of the value being returned before it is returned.
@@IAmTimCorey thanx, that could be a valid reason. Haven't actually checked if the compiler will optimize it itself, otherwise I would not recommend it in regard to performance, you can always add it when needed for debugging (yes I know one spot doing this doesn't matter in performance, but if you have thousands spots like this, it does impact the performance, and IMHO software these days are getting really sluggish compared to their older counterparts, we do get speedier hardware but that's no reason to stop optimizing as I like to actually use the new speed of the hardware and not have a speedier hardware to have it run just as slow as before because people were using slow developmentlanguages in their new versions)..
I used to just return a Boolean expression in most of my bool properties, but after watching this series, I’ve definitely been trying to switch over the the output variable style, as debugging and having the variable show up right in the window that shows the methods stack is incredibly useful for quickly being able to see what is happening ( and if they’re complex logical checks with multiple nested if statements, it’d be exponentially easier)
@@IAmTimCorey We all do them from time to time. I was one of the people shouting at the screen, but I guess you couldn't hear me. Though it's a good lesson for everyone else ;)
Hi Tim I am really enjoying this tutorial. But I have a issue I cant figure out. the error on the log in screen only shows after I hit login 2 times. It shows in the code first hit but does nut update the screen the second hit. any ideas
Thank you for actually explaining what the Binding and Converter were and how they actually worked, I get so annoyed when people introduce these abstractions and just brush them off as magic especially when I might actually need to use a similar concept later.
You are most welcome. Thanks for watching.
Great episode, thanks Tim. Though I was shouting at the screen trying to tell you where the issue was. Glad you found it eventually and pointed it out - Run time issues are some of the worse to spot since you don't get actual errors!
Next time, shout louder. :-)
Yay, I found the error before u :D Thanks, for leaving that in. I really need some debugging practice. I see myself making such a video and cutting it out because of petty pride
Excellent! Nice work.
Hi Tim, first of all, thanks very much for all your great videos.
One thing I would love to see, is how you would handle Internationalization, at least of the basic application text. This is something that is almost never touched on in tutorials, but for some of us, is a hard requirement (I'm in Canada, so English and French are required).
That is on my priority list to do. I just haven't gotten the time yet. Thanks for the suggestion.
I learnt a great tip with regards to dealing with a tricky debugging process. The tip is to "Make a list of assumptions of what causes the program to be working correctly" and then you know that at least one of them is not correct.
Very true. Assumptions are the mother of all screw-ups.
I made a mistake with mixing the public and private ErrorMessage and that made me go crazy.
Ended up noticing that you pressed the login button twice so when i finally noticed my mistake i just went to fix that annoyance of pressing login twice before continuing the video.
Funny that i did not get your error message whahaha.
Good to see i'm actually learning 😊😊
Hope i learn enough to migrate my Laravel PHP webapp in a standalone executable.
Laravel is super easy to use because it's a box of puzzle pieces that are made to fit in anyway you want, but i need more hardware level access than PHP can provide 😉
Already so many checkboxes checked, database, frontend, Auth, api AND Swagger.
Plenty video's to go in this playlist, so far i like it a lot Thanks!
Excellent! I am glad you are learning as you go.
Yes - I was in the "noticed straight away" camp, even before the bad behaviour became a discussion point.
But not because I'm superior - I've actually battled that same problem in my own project previously. One of those bugs that's easy to accidentally insert (especially when you're being lazy with copy and paste) but not so easy to see straight away afterwards.
Experience is a great teacher. Glad you spotted it.
Same but when he first did the property I was thinking surely that wrong order will throw up problems later for him... but then completely forgot about it, so I was completely stumped when his didn't work and mine worked correctly, sat there rewatching the video scratching my head until I finally watched his answer, I think that actually makes me the most inferior!
Same camp as Oliver.
Saw the backing being set after the notify when you first wrote it, thought “Hmm, I wonder if this is an intentional mistake to showcase how to debug again?” Then ENTIRELY forgot about it and was a stumped for a good bit about what was causing the issue once you were testing it out.
Great video, Tim! I think I found that same error "way back when" in Access with VBA. Thanks for the reminder ;-)
You are welcome.
I made a bug by mistake that helped me practice debugging. I set up IsErrorVisible to private...
I have been struggling with that for some time. I could not catch first value to check and therefor i could not load off error message of the collapsed state.
Used your methods of debugging step by step and find out where problem was.
Thanks for all the hard work and for the videos that you share.
Keep up the good work !
Awesome! I am glad it was helpful.
Whew!!! Sure couldn't proceed with the video unless had found the solution to the problem by coincidentally hitting the button twice. Great debugging man! Besides a single line's location being changed, BooleanToVisibilityConverter also takes time to make the response the first time the app launches.
Glad you enjoyed it.
Just wanted to say enjoying the warts and all approach which is refreshing and good. Also the Cliburn Micro approach is quite a lot easier than using say Prism with Delegate Commands.
Thank you!
Just a quick message for everyone. After you hit the log in button wait a while if the error message doesn't show up. I spent half a day troubleshooting and the only issue was my impatience. Maybe my internet is a little slower, but the error message takes a little while to show up. 5 more seconds of waiting would have saved my numerous hours of troubleshooting.
Timeouts on the web can be long (30 seconds is the default usually) so errors can take a bit to come back. Thanks for sharing.
And that's why you add a spinning animation to stuff like this, so the user knows it's still trying to get things done.
Tim, really appreciated work
Glad to be the first one to comments
Thank you very much
You are welcome.
Great video. Never had the chance to learn how to pull from an api. Now I am. This video series is going to help me with something I need to know for my job.
Just one question:
Why didn't you use a visibility property with a tertiary operator?
Public Visibility IsErrorVisible = (ErrorMessage.Length > 0) ? Visibility. Visible : Visibility,Collapsed
I tend to avoid one-liners and collapsed logic because it is not scannable. If you are reading down through my code, the attempt is that you can quickly read each line and understand it. Lines that have multiple pieces of logic in one take you time to pause and review. That slows down your ability to scan the document for what you are looking for. It also can be more difficult on a newer developer. Code is meant to be read by humans, not the compiler. So, anything I can do to make the job of reading the code easier is something I try to do. That's why. It doesn't mean that you can't do what you are doing. Go for it. It all depends on your environment and who is working on your code (and who you want to hire).
@@IAmTimCorey I understand what you are saying. Since, I will be the only one developing this app, it makes I should use what I can read.
In a more diverse environment, I definitely see why your code would be easier to read.
Fun quirk, the setting of the ErrorMessage is synchronous inside the async task. So if you watch carefully even if ErrorMessage comes after the await for the result, the message goes away while it waits.
Interesting.
I was strugling problem with displaying error message. It wasnt work with flaabackvalue, but once i removed it then its start work. After one hr i Just go to sleep and sit to code next Day. After Reading comments here what might be a problem i just look to code in loginview.xaml then immediately looked for literal, IsErrorBissible inseat IsErrorVissible😁 but it help me better understand connection betwen this and method loginviewmodel. Thanks Tim. And as always Great course!!!
Way to stick with it.
The moral of the story is don't notify of property change before you actually changed the property! I saw you do this when you initially entered the code and had no idea why you were doing that.
lol, yep. I show you my mistakes so you can avoid them. I just wish I was pretending to make mistakes. :-)
Thanks for these tutorials, Tim. I would be keen to see how you add user password changing, as the user authentication records are handled separately as well as done manually, so all the hashing is done magically. Even with manual setups, you wouldn't be able to manually change a users password/hash??
I will set up password reset, but there won't be any manually handling of passwords. We want to keep that in the users' hands. We don't want to have access to passwords for any longer than we have to. We will make one call to reset it and that is it.
Great tutorial. Thanks, Tim!
Thank you!
Enjoying the course - trying NOT to download source code and get it right on my own understanding and work - as an ex FoxPro coder and in my 60's - Sometimes means repeating lesson - phew )-:
Obviously, I'm 2 years late from the start of your project - so some updates change things around, example: last lesson - my local was https by default.
Just a note - it would be nice if you included the Lesson Number on the Title Screen, says Lesson 12 of 60 - just so us oldies can get around! Cheers from Perth, Western Australia 😊.
Thanks for sharing your story and good luck on that code!
I'm two years late as well, and I'm just about to start this lesson. I had to figure out how to disable SSL on the Web API project just like you did since Visual Studio sets it to use HTTPS by default.
Not sure how you're watching the videos, but I went to Tim's playlist's, and started watching the "TimCo Retail Manager Course" from the beginning. Since I started watching from the playlist, it shows that it's 12/60 in the playlist pane on the right (outside of the video). Not sure if you didn't see that, or you did but just thought it would be nice to also see the lesson number in the title screen. But just in case you haven't seen it, I figured I would mention it.
I admire people who don't use the "can't teach an old dog new tricks" excuse to avoid learning something new. I have to imagine that FoxPro is significantly different from C#, so there's a big learning curve. But best of luck my friend!
Our company's core system was developed 30+ years ago in Visual FoxPro any we are finally getting serious about building a new system from scratch. I have also been doing fringe projects in c# for the past 8 years, but if we are going to build a core system I knew I needed to learn from Tim. This course is excellent so far. I am learning so much. Until now I didn't understand MVVM or dependency injection at all. It's a lot of up front setup, but after that it seems like it will make the entire lifecycle of the project so much easier. Totally different animal than Fox. No pun intended!
More atomic commits really help with debugging. Can see what you changed since the last working point.
Agreed.
That was frustrating. I autopilot fixed the ErrorMessage property when I wrote it and then was panicking about why my version was working when yours wasn't.
😂
Hello, Tim. When do you think this course will be finished?
I don't have a planned end date for it. Part of the purpose of this course is to build out an ecosystem that we can use for future discussions on technologies. We can upgrade the application just like you would a real application at your job.
Hello Tim quick question. Rather than have the BooleanToVisibilityConverter, could we also not just switch the text in ErrorMessage from a blank string (" ") to whatever message the API returns? I accidentally came across this during my troubleshooting and it makes sense seeing as the textblock will basically collapse all on its own when there's no text for it to display
I believe it still uses the height, and it applies the margins or padding that you have on the block.
hey tim i was wondering why for some things you close with '/>' and other times you will close with the actual element like '' ?
The self-closing tag is used when you don't need anything inside the element as a child. The full close tag is used when you want to put something inside the element as a child element.
Later down the road is there any way to improved the aspect of this WPF UI? Can some material design be added?
Yep, I've got that on the task list. Thanks for the suggestion.
hi tim ,
i keep learning from yours videos , and i'd give useful idea
i't can simplified writing (full property) and less errors in code ,
you can use (Fody/PropertyChanged) lib , it's very simple just installl it
because i use in this tutorials and i'm not facing the issues that you discused
thanx you so much for your tutorial , and i hope donate you soon when i found a jobe
Thanks for the suggestion.
@@IAmTimCorey
you welcome
you'll still the best ever
Hi Tim , thanks for share. Im looking for caliburn navigation. I want to create a link to create a new user. Regards
I'm not sure exactly what you are referring to. You want to see how to move between pages?
@@IAmTimCorey Yes !
It is coming very soon. We just need to wire up getting additional data and then we will be opening up our main form.
I added pass/fail error messaging after the last video -- so even though I re-did everything to match your example I avoided the notify sequence issue (lucky me for once!).
My question: Is there a place where you say "Hey, this is a perfect place to save off all this work and make it a WPF/API/MVVM template for my next project." It seems like after the login, that is where all the "custom" work begins. Next project, I just load the starter project, rename directories/projects as required and get rolling. (I hope that makes sense).
That's a bit of a different animal. What you are looking for is how to create a new template. Otherwise, your naming will all be for this project and renaming things to that extent will be messy. Unfortunately, that is a more complicated topic. It is on my list of topics to cover at some point though.
I don't recall how to do this in VIsual Studio proper, I know in VS Code, you can copy an existing template and then add in the JSON for pieces. That could be quite an involved project though. Sounds cool.
Hi Tim, I know you are executing an async task to auhtenticate, however my authentication takes a few seconds... Unfortunately, the is thinking he hasn;t clicked on the Login button... Is there anyway, unless the async task, you can show a waitcursor. A login dialog should have a wait cursor though? No?
Yep. Another solution is to change the login button's text to "Processing..." and disable it or something similar. I'll add it to the suggestion list.
A quick google says you want to use Mouse.OverrideCursor, setting it to a value of System.Windows.Input.Cursors.Wait. This will most likely need to be executed/invoked via the main thread when you want to call it from an async task. This means that you'll need to use Application.Current.Dispatcher.Invoke method to execute/invoke it on the correct thread.
Make sure that you use a finally statement to remove the override cursor by setting the property to null, and invoking it on the correct thread.
Not sure about a wait cursor, but you could perhaps disable the Login button until the request failed, I suppose, thereby preventing double auth. Another thing to simulate, you could add in a Sleep call in the api to make it take a bit more time and feel like a real app for testing purposes. (you wouldn't want it in the prod deploy though.)
Hey Tim , im really interested in dependency injection on mvc asp.net site if you can cover? Thanks
That should be coming down the road soon. Thanks for the suggestion.
@@IAmTimCorey Cool ,thanks
Would !ErrorMessage.isNullOrEmpty() be better than length>0
Yes. Actually, I would go with String.IsNullOrWhitespace(ErrorMessage) == false when I refactored the code probably.
Hi Tim.
Great video as usual!
But strange thing - in your xaml file, inside strings, dot character is not visible. So "Binding.ErrorMessage" looks like "Binding ErrorMessage"
Daniel, the line is supposed to be:
Visibility="{Binding IsErrorVisible, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}"
We are binding the "ErrorMessage" visibility to the IsErrorVisible property, so there is no "Binding.ErrorMessage"... at least that is how it works in my version...
Steve is correct. There is no dot there.
Uff, I messed ErrorMessage with IsErrorVisible of course. But I was pretty conviced that there should be dot. Thanks, and sorry for the mess :)
No worries. You've seen how much of a mess I can make and I'm the "expert". Just learn from it and you've made valuable progress.
How do I add the same authenticate on Enter key event for textbox(username and password)?
Just create that event method and have it call the same call as the button.
Hi Tim I am really enjoying this tutorial. But I have a issue I cant figure out. the error on the log in screen only shows after I hit login 2 times. It shows in the code first hit but does nut update the screen the second hit. any ideas
My guess is that you are not triggering a NotifyOfPropertyChanged event when you change the error message. It doesn't show until the second attempt because the second attempt includes you hitting a button, which triggers a screen refresh.
hey Tim i got i little suggestion for future videos. I've done some Udemy courses before and i found that i learnt a lot more from the ones that has like a little challenge (or quiz) at the end of the video summarizing what the topic of the video was about. do you think you could implement something like that in future videos ( :
I do that in my Foundation in C# course series. I don't do that here just because of how much extra work it takes. I do offer a Weekly Challenge every Thursday, though, where you can make sure you are keeping your C# skills sharp.
I started the next lesson (13), I'm 10 minutes in and then it dawned on me that I never committed this lesson. I have already created the class library in lesson 13, should I include it in my git commit? If not do I just not stage my class library?
Nope. You can select just what you want to commit so don't include something from the next task in your commit. Just leave it in your working directory (not staged), make your commit, then continue working on the next lesson.
Hey Tim, I've gone through the comments here and tried to see if anyone had a similar error. I still get a "Bad Request" even when I enter the correct details. I've tried creating a new user, restarted VS, checked the spelling and gone through both of the WPF Login videos to see if I've missed something but to no avail.
I don't know what I could have missed. As far as my debugging went, it seems to me as if the PostAsync method in the APIHelper always returns bad request.
When I use swagger and enter the credentials under the Auth tab it works fine
It sounds like you aren't sending over the token correctly or you have an incorrect URL path.
@@IAmTimCorey I'm sure it worked previously. Will double check and get back to you.
@@IAmTimCorey found the error. Thanks for the great tutorial series by the way. Keep them coming.
Hi Tim! Your videos helps me a lot in my carrier of programming i came from java and now really like C#.
I'm now in a project which is to create a web API, and as always i see on your tutorials and not in these, you create a class library for Data Access and i'm trying to follow the same approach, and i don't know if i must select .Net Core or .Net Standard class library. Can you please help me? Thank you and don't stop (I'm saving money to buy one of your courses).
Well, if you are following along with this application, you will see me build a class library (probably in our next video) in .NET Framework. That is because this application is simulating an existing business's source code. Moving forward with new code, you have the option of staying with the .NET Framework or going with .NET Core. It is an additional learning curve but .NET Core is faster and modern. As a result, I would recommend .NET Standard, since a .NET Standard library has the ability to work with .NET Framework projects, .NET Core projects, and more. It does limit what you can do somewhat but that usually isn't an issue. I do have a video on .NET Standard here on UA-cam: ua-cam.com/video/Ph_jSGq6vIA/v-deo.html
@@IAmTimCorey Thank you!
I instinctivly made the ErrorMessage equal to null instead of empty string because I learned that when working with ? you should use null more often to reduce code complexity, make the garbage collector more efficient, and to reduce memory overhead requirements.
@IAmTimCorey I wonder what you think of that? I know its an isolated instance, but in a larger application it could add up.
That works. It is a preference thing rather than a savings thing, but it is a fine choice to make.
How are you hiding the blue grid lines?
found it.
Great!
Click in the Design Pane window and press F9, or click in the Design Pane window, then click the Design menu option and unselect 'Show Handles'.
i don't know if i missed something but can someone tell me how "NotifyOfPropertyChange(() => x);" works or what its for ( :
That's what Caliburn Micro uses to know when a value has changed for a property. When you fire off that event, it tells CM to update the screen for that object. Without it, CM does not know when a value has changed.
I thought that the Bad Request message wasn't showing due to a typo as some had noted below. But after triple checking everything I realised my API was just sluggish on the first attempt, so wait 5 seconds after clicking the button and see if that's the issue.
Yep, the server takes a few seconds to warm up. That's why when you use Azure in production you want to pay for your web apps and turn off the feature that shuts down unused servers.
I personally would clear the errormessage also in the Set Password/Username and put the message below the button so it doesn't create a large distracting visual change. Also I wouldn't want the errormessage row NOT showing in the editor as I want everything visible that might be visible so I don't forget about it when the screen gets a bit more controls.
And why not use "return (ErrorMessage?.Length > 0)" directly instead of first using a variable? Personally I only use a variable in such cases if there's more checks which can change the 'output'
Also not really a fan of just plugging a property/method anywhere in the class, but that's just the autist in me, I like a bit of order, so properties first, then methods and all in alphabetical order (Only thing I really hate about C#(++) is why they just didn't name the constructor 'Constructor' instead of the name of the class or the even more awful destrcutor/finalizer(~), it still baffles me why they ever choose that, but that's a whole different discussion, haha).
But thanx again for the great tutorials.
I use a variable to make debugging simpler. You can put a breakpoint on the output and see the value of the variable before it is returned. That is simpler than trying to capture the state of the value being returned before it is returned.
@@IAmTimCorey thanx, that could be a valid reason. Haven't actually checked if the compiler will optimize it itself, otherwise I would not recommend it in regard to performance, you can always add it when needed for debugging (yes I know one spot doing this doesn't matter in performance, but if you have thousands spots like this, it does impact the performance, and IMHO software these days are getting really sluggish compared to their older counterparts, we do get speedier hardware but that's no reason to stop optimizing as I like to actually use the new speed of the hardware and not have a speedier hardware to have it run just as slow as before because people were using slow developmentlanguages in their new versions)..
I used to just return a Boolean expression in most of my bool properties, but after watching this series, I’ve definitely been trying to switch over the the output variable style, as debugging and having the variable show up right in the window that shows the methods stack is incredibly useful for quickly being able to see what is happening ( and if they’re complex logical checks with multiple nested if statements, it’d be exponentially easier)
I don't no Wpf but , couldn't you just build more generic on that about Error Handling for us?
Not sure what "more generic" error you want. That's a pretty generic form.
@@IAmTimCorey I don't no, maybe some user control for error shows error. Forget it, no problem.
Are you starting both the API and WPF app with the start button?
Yes I am.
Hi tim :)
Hello.
You just add the value setting after the the notification that was the issue
Thanks for sharing.
Finally
Been waiting for Monday, huh?
@@IAmTimCorey Yep, i've spotted that NotifyOfPropertyChanged missplaced right when you typed it. :)
Stupid little mistakes make a big difference. Nice job spotting it. Speak up next time, huh? :-)
@@IAmTimCorey We all do them from time to time. I was one of the people shouting at the screen, but I guess you couldn't hear me. Though it's a good lesson for everyone else ;)
Hi Tim I am really enjoying this tutorial. But I have a issue I cant figure out. the error on the log in screen only shows after I hit login 2 times. It shows in the code first hit but does nut update the screen the second hit. any ideas
I took a deep breath found a typo and another issue caused all problems. so thanks but fixed
I'm glad you figured it out.
Hi, can you let me know what you did wrong? I am having the same problem, thank you!
Hi, I have resolved the issue, but thanks anyway!