|
gently caress, do I struggle with Form controls. I have a form which has a PictureBox in it. When the form loads initially, that picture box is a gray dot. When I hit a button, it needs to turn to a green dot. I can not for the life of me get this son of a bitch to change it's picture. Just to test it, I'm trying to get it to flip a color on startup, and it won't even do that and I'm way too stupid at code:
code:
code:
code:
|
# ¿ Dec 23, 2014 13:01 |
|
|
# ¿ May 17, 2024 17:26 |
|
Forgall posted:I don't see your button click event handler in code you posted, do you have one? Oh yeah. I removed pretty much all the functionality in the name of isolating where the problem is here. Complete code for main is: code:
code:
|
# ¿ Dec 23, 2014 14:15 |
|
Che Delilas posted:Yeah, you're passing in the form to your createHash function, which reeeealy shouldn't be necessary. Can you show us where you're calling createHash? Sure -- Just a quick note: I've made a mess of this code trying to fix this. I've restored it to where I left off before I said 'gently caress it'. First, the form class. This is the only form on the application, so that makes things a little easier: code:
code:
code:
Canine Blues Arooo fucked around with this message at 15:55 on Dec 23, 2014 |
# ¿ Dec 23, 2014 15:53 |
|
Che Delilas posted:Added stuff in bold. This is correct, you can't do that. But you are also doing it in your Reporting class: This is what I ended up doing and it works just fine. It seems so obvious but it never even crossed my mind until you mentioned it. Thanks!
|
# ¿ Dec 24, 2014 21:59 |
|
biznatchio posted:Well, you could do something like this, which reduces the amount of boilerplate you need to write, but still requires you to write a field, event, and one-line getter and setter for each property. Taking the INotify approach a bit further, you can use Prism and simplify it a bit since some of the boilerplate is just handled. The 'simple' version here still has you signing up for private/public locals, but the class is simple to read and maintain and it's a pretty reasonable amount of boilerplate, all things considered.
|
# ¿ Jul 13, 2020 05:50 |
|
Bruegels Fuckbooks posted:The whole experience with learning WPF and XAML is essentially trolling because most of the time if you try to use something like a UI tookit or a library to do something, you only need to understand the subset of the library necessary for what you want to do, and don't have to read article on article about the overarching philosophy of ***. With WPF, I initially approached it like "this is not cryptography, this is just putting a window with controls on it on a computer screen, why do I need to read all these articles or care about poo poo like view models?" Having that mindset will absolutely kill you with WPF because the framework will give you all the tools you need to hang yourself with monumentally lovely code, and actually taking the time to learn and understand the patterns makes the coding actually trivial. This is a gospel truth and it really, really sucks because some of those important patterns seem either estoric or needlessly verbose, especially on a first read. I actually really like WPF, but I've written some pretty trashy poo poo on my journey to writing slightly less trashy poo poo now, and almost all of it was borne from an attitude of, 'This seems needlessly complex/annoying to implement/boilerplate for the sake of boilerplate and I probably don't actually *need* it...
|
# ¿ Nov 1, 2020 09:46 |
|
insta posted:var is good Oh, I see we are going to have to fight today... (I jest ofc, but I usually insist on avoiding var)
|
# ¿ Nov 9, 2020 23:34 |
|
New Yorp New Yorp posted:Sure, do it consistently the way I like to do it. you goddamn right.
|
# ¿ Nov 10, 2020 00:39 |
|
My major beef with it is code readability / observing data flow, in addition to having a full understanding of how things work. For example, I just implemented language detection in a project with NTextCat. The code example provided looks like this: code:
We can easily identify factory as type RankedLanguageIdentifierFactory, but what the hell is identifier? Or languages...? We are calling FirstOrDefault on languages, so that's a clue, but it also doesn't narrow it down much. The point here is that if I were maintaining this code, understanding what I'm actually working with requires a bunch of extra time because I'm effectively eschewing one of the major advantages of a strongly typed language by not letting the reader know what these things actually are. Compare to: code:
This is also a fairly simple, self-contained example. The problem of readability and maintainability expands a lot as one expands the scope of a project.
|
# ¿ Nov 10, 2020 01:58 |
|
raminasi posted:While I am personally a var-everywhere guy, I have to admit that it can easily become a pain in the rear end when you don't have an IDE right there, like during code reviews. Code Reviews are definitely a common use case where it gets obnoxious, but for complex structures, constantly having to mouse over stuff is a mental drain. Do you really want to have to mouse over stuff to see it's type, or would you rather it always be right there?
|
# ¿ Nov 10, 2020 02:27 |
|
I don't disagree, but how you are going to descriptively name a Tuple<LanguageInfo, double> that implies it's type, or name something of an arbitrary type e.g. RankedLanguageIdentifier . I'd argue it's a 'both' kind of a thing, not one or the other.
|
# ¿ Nov 10, 2020 04:26 |
|
Rocko Bonaparte posted:I need to double check my thinking for extending my WPF GUI for the other use cases. I'd just merrily plod along if it were anything else, but WPF has that little habit of tacitly demanding things be done a certain way and just not render if you do it wrong, or it just somehow becoming a strange mess. With all my WPF projects, I have a custom Window that I maintain with specific functionality I desire, and then on top of that, I usually customize it more per-project. I don't think that's the best way to do what you want to do here, but it's an option. I think Cuntpunch's suggestion is superior.
|
# ¿ Nov 16, 2020 19:25 |
|
Does WinUI have the absurd restrictions that UWP does? I was luke warm on UWP until I learned that you didn't have first-class access to pretty anything useful in the OS. File System access, Registry access, meaningful hardware access - it's all locked off. I don't write software to look pretty. I need it do stuff. UWP doesn't not do stuff and I give negative fucks about 'Touch Support'. A high level glance looks like WinUI is making the same mistakes. I'm not moving off of WPF/Win32 until MS can actually deliver a feature set that makes a computer work like a computer.
|
# ¿ Jan 25, 2021 22:19 |
|
Hammerite posted:It makes me very happy that I can write "x is not null" in C# now. Seriously though. Null checks in C# did not need to be as goofy as they were at times.
|
# ¿ Feb 17, 2021 22:15 |
|
I feel like the major selling point of Blazor is, 'It's not Javascript!'. Honestly, that's a pretty compelling sales pitch.
|
# ¿ Apr 15, 2021 01:12 |
|
Drastic Actions posted:The point here though is unless you already know of things you want to use in .NET Framework that hasn't been ported to .NET Core / NET 5+, you should just target NET 5+ and not think about it. Edit: I looked into some of the concerns I thought I had about functionality that would be gained or lost in .NET 5 vs Framework, and they seem to be either incorrect or unfounded. I retract the above and label it a 'bad take'. Canine Blues Arooo fucked around with this message at 19:51 on Jun 4, 2021 |
# ¿ Jun 4, 2021 17:16 |
|
I don't think I've ever used OneWayToSource, but what an obnoxious edge case. Thanks for sharing! I feel like that's the kind of thing you'd Google forever and only find answers to if you got obscenely lucky.
|
# ¿ Jun 28, 2021 17:59 |
|
epswing posted:What's the Right Way to trigger some code frequently (every X seconds) in an ASP.NET site? While there are plans to move it to an Azure App Service, and maybe WebJobs is what I'm looking for, it's running as a Site on IIS for now. If this is on IIS, there is no reason to get a library or a service involved to get a computer to count to 5. You could use DispatchTimer if you don't need better than 1/10th a second of precision and are hosting it on a Windows box.
|
# ¿ Nov 17, 2021 20:40 |
|
Unless you are doing work on front end, there isn't a compelling reason to not be on Core. Conversely, all my projects with UI are still on Framework. Porting existing projects is of course very project specific.
|
# ¿ Dec 21, 2021 00:22 |
|
fps_nug posted:just spent my first serious 5 hours since high school learning programming, decided to start with c# for no other reason than accessibility. I learned on python and now that I have an incredibly rudimentary knowledge do you guys have any ideas of where to go from here? I simp hard for C# and would insist that it's both a strong starting language and a language that does basically All The Things™ well. Some of it's buttery smoothness is lost if you leave the Windows platform, but Core is honestly in a pretty good spot - it's less of a problem then it used to be (unless you want to build interface). If you want to build Desktop apps on Windows, WPF is pretty outstanding and is my favorite UI framework by a mile. If you want to just do general CLI tooling, just learning more about the C# language will give you great returns. If you want to do web stuff, you can go the ASP.NET route, but I'm unsure if that's the 'optimal play', but if you enjoy it, do that! For desktop apps, I think WPF can be intimidating as you start to learn it, but it's really not that bad once you start getting into it, and unlocking the ability to build apps is very powerful, both for personal tools and tools for others. I'd highly encourage it if you are interested. Regardless of the specifics of what you want to do, the answer is to find something you think you want to build and build it. Build *anything*. Solve the problems one at a time and be willing to suck at it for awhile. Canine Blues Arooo fucked around with this message at 19:53 on Feb 1, 2022 |
# ¿ Feb 1, 2022 19:50 |
|
aperfectcirclefan posted:Is there a market for WPF developers anymore? There definitely is. I get pretty frequent emails from all sorts of folks asking for WPF developers. It's definitely not as common as, say, React or [fotm frontend JS framework], but jobs certainly exist.
|
# ¿ Feb 3, 2022 22:55 |
|
Small White Dragon posted:If anyone else is doing .NET on OS X -- is the JetBrains IDE really that much better than Visual Studio, and if so, why? Rider is decidedly better than VS Code, but VS proper has way, way more features. It probably comes down to what features you want/use. If you use those features, then Rider is gonna fall short. If you do Interface development, then Rider is going to fall way short.
|
# ¿ Mar 12, 2022 09:09 |
|
zokie posted:I have to make a GUI application and distribute it internally. It looks like I can choose from WinUI 2, WinUI 3, WPF, and WinForms. I’ve used both WinForms and WPF before (5+ years ago). But what I care about the most except for easy installation and updates (ClickOnce looks like it’s still around) I would really like to make the application window me an exotic shape. So you can do this, but I kinda recommend against it, depending on what you mean by 'exotic'. Fundamentally, your window is going to be a box no matter how you spin it, but you can make portions of it transparent and click through and all that if you want and craft a shape however you please. The real problems start in window manipulation. Depending on your shape, resizing might not be very intuitive, or even possible. You have to make sure you are building it correctly to make it resize without problems like distortion or weird margin problems. You probably will need to build your own resizing handles (although maybe chrome lets you set offsets and positions?). You end up with a lot of goofy considerations. You'll have to override the default Title Bar(which is not hard, but another thing to do). Regardless, write it in WPF. WinUI loving sucks compared to WPF dont @ me. If you are writing your logic in C++ though, it's probably fine. Canine Blues Arooo fucked around with this message at 00:44 on Apr 29, 2022 |
# ¿ Apr 28, 2022 22:58 |
|
My favorite MS selling point of WinUI3 is that 'you can create modern looking apps'. That's a style preset my dude. Please just maintain WPF as your native win32 framework until you actually have a good reason not to. Stop with this 'new framework' nonsense. Drastic Actions posted:MAUI is hell. These are facts.
|
# ¿ Apr 29, 2022 00:49 |
|
I have what feels like a simple problem: In WPF: I have a DataGrid that is bound to an ObservableCollection<MyObject>, which can have up to hundreds of thousands of items in it. I frequently add to said ObservableCollection and the newest item is placed on the bottom of the DataGrid... But I want to place it on the top. DataGrid receives an Index from the OC to determine where it should be placed. Placing it on the bottom is really easy - appending to an OC is an O(1) operation and that makes me real happy. However, appending to the beginning isn't really an option. What I'm trying to do here is avoid something that's O(n) every time I add an item. The first option is pretty obvious: Don't use DataGrid. Build your own thing that reads from the back. The problem here is that that is still O(n) since you have to 'rebuild' from the back. To spare you some details, every thing I've thought of is *at least* linear time, and most of them are O(2n). My current implementation is to write to a 'holding OC', reverse it and use the reversed OC as my default search source, which means that the actual cost is O(3n) now. The nice thing is that this is very easy to write, but the perf has much to be desired. Perhaps unsurprisingly, this is actually quite performant on my computer. At 10,000 items, the time to do that entire block of operations is <3ms, so that's definitely acceptable and I'm willing to just let it ride for now. At this point, I'm more academically curious about this problem then I am for practical reasons. Is there a way to show the most recent item appended to an OC as the first item in a DataGrid (or any collection view) in less than O(n) time? Canine Blues Arooo fucked around with this message at 18:53 on Jun 1, 2022 |
# ¿ Jun 1, 2022 18:51 |
|
epswing posted:Not sure how to solve your specific problem offhand, but have you considered paging the collection? No human can 'browse' a list of 100,000+ records. Actually, you mentioned "search source", does that mean a user would search/filter the big list, and then edit the results? This software is a 'remote logging' solution. Any apps can just bring a logging library and call Write with parameters and it'll blast a message to an arbitrary address, or just localhost. The use case is that you can have persistent logs regardless of app state, and your can consume logs from any number of apps simultaneously. To that end, I'm not too interested in paging since that UX starts to suck under load. Yeah, a human doesn't really care about thousands of lines, but they generally care about the last dozen or so. Talking this out presents a pretty obvious idea. Store the last few hundred in the 'active' OC, but just discard anything not recent and stash it in an 'everything' OC. If you want to search everything, expose that as an option. It'd keep things snappy.
|
# ¿ Jun 1, 2022 19:53 |
|
raminasi posted:Have you considered creating a custom backing structure that implements INotifyCollectionChanged? I actually do, but it's based on OC. Since it needs to be thread safe, it's called ConcurrentObservableCollection. Maybe going back to the drawing board on that might be the way.
|
# ¿ Jun 1, 2022 21:26 |
|
zokie posted:Shouldn’t the list control be virtualized? Then if you are adding an item outside of the “viewing window” should that really cause new rendering? The DataGrid is temporary. It's a really easy to hand an object to something and say, 'draw data plz', but everything eventually will become a ListView. It probably should be Virtualized.
|
# ¿ Jun 1, 2022 23:20 |
|
epswing posted:Is MAUI still a nightmare or if one wanted to build a dead simple LOB (i.e. load list of records from API, open record, edit simple fields, save record) it’s kinda alright? I'm not a MAUI expert. I'm a huge WPF simp. With that said... If you know WPF and are targeting the the Windows desktop, there is absolutely no reason to not use WPF. If you must be xplatform, then you could do a lot worse.
|
# ¿ Jul 7, 2022 02:52 |
|
raminasi posted:I’m sad I’m leaving my .NET job before I get to play with this stuff I left .NET for a year and immediately missed it. I'm back in it now and am not anxious to leave. I'm so sorry I betrayed you - never again!
|
# ¿ Feb 6, 2023 22:42 |
|
My take would be that unless you are building something cross platform, there is no reason to not use WPF.
|
# ¿ Feb 23, 2023 23:51 |
|
Hughmoris posted:Broad question here from a novice: Tooling for game dev stuff, which is almost entirely WPF. And what isn't WPF should be
|
# ¿ Mar 5, 2023 18:41 |
|
ChocolatePancake posted:I agree completely about tuples. Very useful for a quick throwaway type, but if you'll be needing them any more than in the next couple of lines, make a proper type for it. Echoing this verbatim. I've used Tuple for this kind of typing less and less over time and basically only use it now for something extremely ephemeral. Just make a proper type 99% of the time.
|
# ¿ Jun 13, 2023 18:39 |
|
Surprise T Rex posted:What's the state of the art for creating PDFs in C# code now? Ideally one I can run from a serverless Azure Function or AWS Lambda. At work we do some of this using rendering Razor templates to HTML and feeding it to Puppeteer(?) to basically fake a print-to-PDF, but that requires us to run it as a docker container so we can bundle a headless Chrome with it and that seems like more effort than is necessary. If your document doesn't need complex elements, I'd just do it in PDFSharp/MigraDoc. I've used it in the past and it's been easy enough to use if a bit verbose. If you aren't actually interested in constructing a PDF, but just printing one, I guess you can use a service but then prepare for all the poo poo that comes with it. You don't need this mess of services and containers and all this poo poo just to run a browser so you can 'fake' print a PDF. Like, at some level of document complexity, that becomes an attractive solution, but holy poo poo this pipeline can begin and end at 'project code'. Canine Blues Arooo fucked around with this message at 03:56 on Jan 11, 2024 |
# ¿ Jan 11, 2024 03:35 |
|
I tried Rider for a bit, but it is missing a lot from VS. I still revisit it from time to time but their most recent redesign has put a nail in that. It looks like some stupid web idiot got to design productivity software. There is a hamburger menu in my IDE... No thanks...
|
# ¿ Mar 31, 2024 00:16 |
|
|
# ¿ May 17, 2024 17:26 |
|
Jen heir rick posted:I hate writing web apps and wish I could write native apps, but it seems like the world is moving to hybrid/web type apps. The economics are just too good. You can have a single team write an app that works on android iOS, macOS, Linux, and windows. You just can't beat that with native apps. You need a team or developer for each platform. The suits just aren't gonna pay for that. Even if the result is a shittier experience. People will get over it. poo poo sucks yo. This is a big reason I'm into proprietary tooling. gently caress that web bullshit. Build in WPF.
|
# ¿ Apr 26, 2024 06:53 |