❔ So I've created a downloader, how do I link a progress bar to it? Winform, .NET framework
here's my code (website down rn):
if I understand correctly, it doesn't really have a way to keep track of this. It's just not there then suddenly it is. how would I go about linking this to my progress bar?
64 Replies
why make a program that downloads something a whole winforms app?
why not just a simple console?
aren't consoles not really user friendly?
they can be made to be
$spectre
Spectre.Console is a .NET library that allows for easy creation of console UIs, text formatting in the console, and command-line argument parsing.
https://spectreconsole.net/
Spectre.Console - Welcome!
Spectre.Console is a .NET library that makes it easier to create beautiful console applications.
spectre also has progress bars
a console app will also be cross platform, unlike a winforms app
this does look very cool, but it seems like it'd be a bit too late to switch now, I already have the downloader working (you wouldn't believe how long that took, I'm code illiterate and a slow learner)
are you under some time constraint?
no, but I think I would rather have it done in the next few hours, otherwise I don't feel productive
i'd say learning some new concepts is being pretty damn productive
well yeah but that's not the new concept I came here to learn
I wanted to learn the concept of adding a progress bar to my application
i don't use webclient, so no idea if it has any of the capabilities httpclient does
i can recommend learning the concept of not using out of date frameworks and types ;)
jesting of course
you know what, I'll entertain the idea. do you think it'll be easier to achieve what I want using console?
mhh... no!
i assume you're more of a beginner in c#?
THEN WHY SUGGEST IT? 😭
i mean if you weren't a beginner then it would undoubtedly be easier
you don't have a UI to deal with
spectre takes care of most of the logic
you're able to basically write your entire code in 1 single file
and it looks good too
but spectre.console introduces a lot of concepts that might be very new to you
and it requires reading up a bit
i think its API is pretty intuitive
for the progress bar... just copy the code from somewhere else, honestly :p
long as you try to understand what's happening, that's fine
(yes spectre has progress bars)
do you have an example of the code I should be copying?
because I did spend a few hours before asking here, this wasn't my first idea
oh i only have code for spectre
like i said, i don't use webclient (nor winforms, but that's another story)
so i don't know its capabilities
okay if you can show me spectre code for a progress bar and download I will switch over, but otherwise it's just a massive step backwards
hold on I'll just share with you my simple vision for what this'd be as a terminal program, you tell me if it's got what I'm after
if you press [V] for instance
if you press [I] it'd change to
would this be possible using spectre?
i'm not sure about the pause/cancel during the download
everything else is easy
alright that kinda sucks but I mean, if everything else can be done that's more than I have, and that makes interface design a lot simpler.
about aesthetics though, I'm sure I can choose fun wacky colors for the text, but can I change font size?
my vision is weak and I don't want tiny text that's hard to read
a console app chooses whatever design you have for your preferred terminal
so you're telling me that can't be configured without each user specifically configuring it for their whole terminal?
how about auto updaters? I've got an autoupdate application written for my winform app
terminal programs can do that?
depends on how you implemented it i guess?
hey doesn't this seem like a direct download in every possible category to you?
hm?
like, if you show me that it's really easy to code in, and actually it's really intuitive to work in, and it's super easy to format in etc then yeah I'm on board, but all you've said really is "well yeah but it can do atleast half or maybe a third of what you want, but that thing you want to do? that's easy" and I'm skeptical to rewrite everything I've done just because of that claim, because you've not really shown me that it even is easier to make a progress bar in spectre. Winforms is as far as I'm aware designed to be easy, and the user interface has never held me back, it's only been helpful. Can you please show an example of a progress bar on a download in spectre, and show me an example of page navigation in spectre?
obviously there's many many ways to handle the prompts, i've sorta hard coded the branches here
what i usually do is have a
Steps
or Stages
folder where i split up the logic
https://github.com/just-ero/Unity-PDB-Downloader
https://github.com/just-ero/asl-utilsokay you seem knowledgeable, how would I even create a window for this? like, do I just paste it into a text file with a certain extension and save it? will it need dependencies to run? if I distribute this, will it require the user install anything other than the program?
what do you mean "create a window for this"?
"paste it into a text file"?
what have you been coding in up to now?
like, I use visual studio, and I use winforms in visual studio
so like, what do I do with this?
it's a console app
you create a new console app project, install the spectre.console nuget, and you're done
I just open the console app preset on vs? gotcha
$newproject
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework.
.NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended.
https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
try to use .net 7
install it if you don't have it yet
I would but I've got certain limitations
hm?
I have to use 4.0 only
why?
the game I'm working on was made in XNA in 2013
is wow not on linux or mac?
no no that's something different
I'm talking about charlier murder, I want my experience to translate though
i still don't really see how that has to do with the framework this installer is made in though
it doesn't
I want my experience to translate though
i don't understand
I don't want to spend all year coding in .net 7, go to work on the game and be like "WOW THIS IS ALL VERY FOREIGN TO ME I SURE WISH I KNEW A SINGLE THING ABOUT .NET 4!"
it's not that big of a difference lol
c# is c#
if c# is c# I wouldn't have a million and one errors with FNA
hard to believe that's a modern .net issue
it might not be, but I do not that the lib it's built on REFUSES TO WORK if not 4.0
alright well, i'll let someone else take over then. someone that knows more about webclient and how to use it to make a progress bar in winforms
okay I'm looking at your code for the terminal thing, I didn't know you could use arrow keys in a terminal, this is pretty cool actually
is there not the
System.Net.Http.HttpClient
type in the framework that you're using @SynthGirlClip ? its as simple to use as WebClient but it is highly recommended over WebClient, the type WebClient is deprecated. your webclient code should translate very easily over to HttpClient.
use that type as @Ero also suggestedit's not deprecated in 4.0...
ohh mhmm
but they dont have HttpClient?
would be better to use either way right?
they don't
kk
then forget what i said
I'll just translate everything to spectre 🤷♀️
why anyone would want to stick to a framwork that's been out of support for over 7 years is beyond me
which is why i don't really feel like helping any further
yeah especially in a new project
not even any ressources to respect
or money
in old project old version is fine
but new project = new version @SynthGirlClip
shmeep shmop "i need to use the same framework as the other project because otherwise i won't know how the other framework version works 😭 "
invalid argument
Wish me luck, I'm gonna try to make the whole extract file thing in the spectre thing
This btw
It was answered before the new fella showed up
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.