TUTORIAL C# WPF Design UI - #2 (2/2) - REST API Access
HTML-код
- Опубликовано: 16 фев 2019
- Hi, in this tutorial we will continue creating our user and start to create the persistence for RIOT API.
Buy me a coffee
www.buymeacoffee.com/abeldutraui
Github
github.com/Abel13/LoLGoal/tre...
I would like to thank you for the great work.
I've never seen anyone do it better. Great job !!
Olá, ando vendo seus videos sobre WPF e XAML, me amarrei mais ainda quando vi usando o lol como tema... porém eu to com problemas mesmo tendo feito tudo identicamente igual a ti, pretende fazer videos comentados?
Olá, fico feliz em saber que gostou :D
E sim, esse tipo de vídeo precisa ser comentado... Tentei fazer assim pra ver se ficava bom mas não gostei muito, estou pensando em alguns formatos de vídeo, e em breve devo fazer vídeos comentados
@@AbelDutraUI ta sendo de grande ajuda pro meu desenvolvimento em programação, tu é fera
Não sei como você sobrevive sem o ReSharper
kkkkk eu odeio ReSharper, acho que já acostumei hueheueh
Design com WPF eu não vivo sem
Realmente ajuda bastante, mas n consegui me acostumar rsrs
Só pra avisar, você deixou sua APIKey lá no seu gith, melhor apagar
Puts, vlw mano
How to get API key
You need to sign up here: developer.riotgames.com/
I'm sorry, but it's a complete garbage.
- First.
In HttpClient which you're using, there's a method called 'EnsureSuccessStatusCode' which is a good practice to use, instead of checking status codes in if/else statements. It removes diplication and its easier to read.
try {
// your stuff
response.EnsureSuccessStatusCode() // it throws httpException with additional information & status code
// deserialize if not thrown & do other stuff
}
catch (Exception ex)
{
return null;
}
- Second.
You complitely fucked up MVVM, by implementing your logic within Events, instead of Commands.
Also, you store Views & 'Controllers'-like entities in Windows, which is another bad practice. And oh boy...try to use less MessageBox'es.
- Third.
Dont store your stuff(api URLs/Keys/endpoints) in plain text files. You have 'App.config' for that. I suggest you to store main URL there & endpoints in static class.
Also, you are integrating with a external third party service & you have complitely NONE error handling, which means any exception will kill your app.
- Forth.
Do not, I repeat, DO NOT EVER USE HTTPCLIENT within 'using' statement. Make it static, use the static instance & dispose it when your app is closing. Disposing HttpClient in the middle of the running app with make your software unstable, since it wont close the socket you're using.
Things that you're teaching are either code smell or bad practice. Sometimes both. But the UI is great, though.
P.s. Not trying to be offensive here, only constructive.
Thank you! I appreciate your feedback and I'll improve it!
Oh, and if you like the layout please watch the next videos in this serie. Probably there are more code smells but I'm here to learn too. Thank you for watch :)
lol is cringe