C
C#β€’7mo ago
Max

βœ… Auto Updating WPF applications options and best practices

So I'm building an internally facing application for a client, I've spent some time getting to know WPF and C# as this is my first major project. My main issue is how to handle auto updates, I've researched a bit online but struggling to understand what the best options are as most of them see pretty limiting. The application is being hosted with GitHub in a private repository, I initially had planned to handle updates entirely by using GitHub releases however open to suggestions on better/alternative ways to handle this. I come from a background of Full Stack development so have made heavy use of workflows and releases in the past but for Javascript and Python mainly so this is very much new teritory for me. Any help would be greatly appreciated thanks πŸ™‚
77 Replies
leowest
leowestβ€’7mo ago
GitHub
GitHub - velopack/velopack: Installer and automatic update framewor...
Installer and automatic update framework for cross-platform desktop applications - velopack/velopack
Max
MaxOPβ€’7mo ago
That looks amazing, exactly what I was looking for thanks a lot mate If I use velopack, when users install the application (and use it to update) will this then require admin privileges, it isn't necessarily a deal breaker but would make life slightly easier if not. And if it does not, what are some of the limitations of setting it up to not require admin privileges
leowest
leowestβ€’7mo ago
it does not unless u have features that demand admin access
Max
MaxOPβ€’7mo ago
Okay perfect thanks πŸ™‚
leowest
leowestβ€’7mo ago
and you can also include it on AfterBuild events in your csproj so when u publish or build release it also builds the pack
Max
MaxOPβ€’7mo ago
oh perfect so I don't need to manually run the velopack command it'll do it automatically in the github release?
leowest
leowestβ€’7mo ago
never tried integrating it on github but I suppose its possible
leowest
leowestβ€’7mo ago
Integrating Overview | Velopack
To integrate Velopack into your application, you must initialise the Velopack as early as possible in app startup, and you should add update checking code somewhere.
Max
MaxOPβ€’7mo ago
I'll take a look into it. Just out of curiosity, do you recommend any IDE over Visual Studio for WPF development.
leowest
leowestβ€’7mo ago
no rider is nice but I prefer sticking to visual studio
Max
MaxOPβ€’7mo ago
damn, was thinking of checking out jet brains 'rider' ah I see, I'll stick to the old but reliable
leowest
leowestβ€’7mo ago
rider is a nice alternative yes, its just my personal preference to stick with vs
Max
MaxOPβ€’7mo ago
yeah I mean I can't go wrong with it being free, just need to get used to it having only used VSCode the change is similar and so different at the same time
leowest
leowestβ€’7mo ago
also I do a lot of maui and avalonia stuff and last I heard rider doesn't do as well with those
Max
MaxOPβ€’7mo ago
oh nice, how have you found avalonia, I looked into using it instead but wasn't entirely sold
leowest
leowestβ€’7mo ago
well yeah its a massive change since you're coming from a text editor into a full ide getting used to take time but imo for c# in general its better experience
Max
MaxOPβ€’7mo ago
oh yeah, I've only really done Java and C++ before this with full IDEs and used JetBrains for it also, do you have any recommendations for wpf control suites, I hate ui design so simple is better in my opinion
leowest
leowestβ€’7mo ago
$wpfuilibs
Max
MaxOPβ€’7mo ago
damn I really am a novice here, thanks again.
leowest
leowestβ€’7mo ago
:Ok: $close
MODiX
MODiXβ€’7mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Max
MaxOPβ€’7mo ago
Final question I promise. I've setup like a basic login for the application but I hate my implementation, and I know it's going to become a pain in the ass later on
leowest
leowestβ€’7mo ago
:Hmm:
Max
MaxOPβ€’7mo ago
can you recommend any tutorials for handling authentication or guides
leowest
leowestβ€’7mo ago
it depends how you're handling it, whether u use MVVM or not, services, di, etc normally the flow for me is asp.net or php backend and then I have services that communicate with my back end and delivery information to my viewmodel which fullfils my view needs as for the flow
Max
MaxOPβ€’7mo ago
Yeah I'm using MVVM, currently have the User setup as a service
leowest
leowestβ€’7mo ago
I usually use UserControl as pages, depending on the scenario I have side bar menu sure, so: - user inputs credentials, click button, fire command, - command calls method from service which verifies the credentials and returns a token - viewmodel redirects user to the proper page
Max
MaxOPβ€’7mo ago
yeah so my setup is slightly weird as the application communicates directly with an oracle database, so I have a data access layer which the services then interact with to pull data directly, just because it's an internal application and reasonably full scale I didn't see the need for an API.
leowest
leowestβ€’7mo ago
you see I prefer not doing that because then I have to worry about database concurrency at the client level, its much easier to handle it in the middle man among other issues but your scenario is valid, its just a lot more work to handle concurrency, among other things
Max
MaxOPβ€’7mo ago
true, unfortunately the company wanted a proof of concept without giving me any access to a server, then once I have the POC I can progress with setting up an authentication server and more.
leowest
leowestβ€’7mo ago
I mean u can still write a POC with a backend without having access to the db but either way is valid, its just more work the way your approaching it and more headaches
Max
MaxOPβ€’7mo ago
How so, the POC still requires displaying data from the database, I guess I more mean a MVP than a POC oh dear, well at some point I'll aim to change it I think then just need to show them what's possible, how it looks and then progress from there
leowest
leowestβ€’7mo ago
wanted a proof of concept without giving me any access to a server
I understood this as u have 0 access to the db as well. But either way u can have the api (backend) running on the same machine of the app for demonstration purpose
Max
MaxOPβ€’7mo ago
oh no I have access to the database, just a read only version as I won't be updating any values just using it to display and export the data to excel ohhh I see what you mean, that may be an idea
leowest
leowestβ€’7mo ago
sure that is more than enough for the API I suppose the beckend is mainly asp.net api that leverages all the db access so your WPF is a shell that obtain and fullfill data to the api which in its turn save/query/w/e from the db
Max
MaxOPβ€’7mo ago
no, so the WPF literally just displays the data, has and will never have the ability to change any of the data
leowest
leowestβ€’7mo ago
it does I mean not with a readonly db but it can
Max
MaxOPβ€’7mo ago
no but as in, the application I'm building will never need to, and they don't want me to
leowest
leowestβ€’7mo ago
ah ok so its literally readonly then yeah I can see it not needing a backend like this
Max
MaxOPβ€’7mo ago
yeah exactly, would definitely be using an API otherwise. It's just giving visibility to things that aren't visibile usually
leowest
leowestβ€’7mo ago
there is no risk to lock anything this looks fine then in this use case nothing weird there unless you're using efcore and making repositories
Max
MaxOPβ€’7mo ago
with authentication being the only thing the API will be used for, where each user will have certain permission (Admin, and a list of objects they can see what's the best way to go about it with C#
leowest
leowestβ€’7mo ago
that is a hard question it depends a lot on the app layout some do ACL based, it also depends the granularity of access like if its just the menu options that would be limited of if say user A can access Orders and inside orders there are certain things they cannot see as in fields and whatnot then it becomes more complex and involving if the access granularity its not too complex it could be as simple as setting up datatriggers
Max
MaxOPβ€’7mo ago
So yeah it’s basically like user A can access one or many Orders, they select an order and can see a load of details on that order. The select menu displays only the orders they can see then I will have an admin account which can see all orders and create/delete/edit new accounts and assign them orders. My initial plan was just to have each account link to a list of order numbers and display from there. (User A can see order number 1, so when they go to select it filters all available orders with the order number 1 and only gives that option)
leowest
leowestβ€’7mo ago
I mean u wont find anything tailored for that, u will have to wire things your self specially if u dont have any rules already define of who can access what like u said u would have to assign oders to a user as opposed to orders having certain access levels that is not so common normally if u have a sales rep, which sold order abc it would have a connection so it would make sense, but the way ur saying u would need to manually map already existing orders to users
Max
MaxOPβ€’7mo ago
I mean it shouldn't be too bad to map, the order number never change and new orders are rare (I'm using orders as the example it's not actually orders that I'm showing so they actually don't add new ones frequently at all). I was thinking of literally just having the UID stored, and sort the mapping of the UID's to the orders within the admin part of the application. so the actual api would never map itself. and then when pulling data the SQL call used which define that the returned 'orders' must be in the array of ones they have access to which should mean that if an order isn't present it shouldn't affect anything So for the API authentication ASP.NET is the best to go for, any packages you would suggest that takes some of the headache out of sorting the auth side?
leowest
leowestβ€’7mo ago
Identity should be all, it also gives u roles etc
Max
MaxOPβ€’7mo ago
ok cool, and if I were to move into using the API to get the data this could be expanded to that without complications I'm guessing
leowest
leowestβ€’7mo ago
u would use Identity if you're making an asp.net api https://learn.microsoft.com/en-us/aspnet/core/security/authorization/secure-data?view=aspnetcore-8.0 I dont think you can standalone it directly in a WPF app
Max
MaxOPβ€’7mo ago
oh no sorry I mean, for now it will just be purely for authentication, but in the future if I wanted to also use it to supply data instead of accessing the database directly through WPF this would be possible?
leowest
leowestβ€’7mo ago
the link above also mentions abou the create delete etc yes its just adding endpoints
Max
MaxOPβ€’7mo ago
oh yes that's perfect. Yeah sorry just only ever built apis in Python and JS
leowest
leowestβ€’7mo ago
the concept is the same really, I mainly do in PHP
Max
MaxOPβ€’7mo ago
damn never touched PHP and hoping to not aha, what's it like compared to C#
leowest
leowestβ€’7mo ago
eh its a cheap alternative that easily fits any hosting for the most part I rather do it in asp.net if I can but unhappily I dont always hold the decisions
Max
MaxOPβ€’7mo ago
ah yeah I feel you there. Was forced to use WPF because of this whereas was hoping to build it using Electron or Tauri but here we are
leowest
leowestβ€’7mo ago
well at least you're learning xaml that is plus IMO you can easily jump into MAUI, Avalonia, etc
Max
MaxOPβ€’7mo ago
Yeah true, it's actually not nearly as bad as I thought it was going to be Is there any advantasges of Avalonia over WPF other than the cross platform capability?
leowest
leowestβ€’7mo ago
it being heavily under development customizing it being easier it already have plenty of controls $avaloniauilibs
leowest
leowestβ€’7mo ago
the look and feel being seamless between platforms I would say its pretty young for mobile/web side of things but for desktop it has been very strong
Max
MaxOPβ€’7mo ago
does it work on older versions of windows like WPF does? wait does WPF even work for windows 11?
leowest
leowestβ€’7mo ago
how old we talking about? unsupported windows versions?
Max
MaxOPβ€’7mo ago
windows 8 and XP
leowest
leowestβ€’7mo ago
should be just fine then
Max
MaxOPβ€’7mo ago
I don't think I have anyone using Windows 11 that needs the application, but I think a couple are using 7/8 and possibly XP
leowest
leowestβ€’7mo ago
I mean 7 might run unsupported but beyond that...
Max
MaxOPβ€’7mo ago
how come 7 would run unsupported?
Max
MaxOPβ€’7mo ago
oh okay I see thanks You're insanely knowledgeable man thank you
leowest
leowestβ€’7mo ago
I wish, im no where close some of the dudes around here
Max
MaxOPβ€’7mo ago
I mean going the way you are you'll definitely get there. Thanks for responding so quickly every time πŸ™‚ if I close this chat do I lose the message history?
leowest
leowestβ€’7mo ago
nope its stays but u might need to open the mmm thread thingy to actually see it
Max
MaxOPβ€’7mo ago
ah I see thanks πŸ™‚
leowest
leowestβ€’7mo ago
either way after a few days of inactivity it automatically closes it self or hours I dont remember
Max
MaxOPβ€’7mo ago
oh I see
Want results from more Discord servers?
Add your server