Mayka
✅ Cannot Get Rid Of Individual Borders On TextBox Avalonia
Also, if you don’t necessarily want to apply a style to every instance of an element, style classes can be very helpful.
https://docs.avaloniaui.net/docs/basics/user-interface/styling/style-classes
11 replies
✅ Cannot Get Rid Of Individual Borders On TextBox Avalonia
@Mekasu0124 under styles you’re adding a style selector for Border. That’s gonna apply to anything with a border, including text boxes. If you want to target a border for a specific kind of object you would need to specify that in the style.
11 replies
✅ Lag after closing folder dialog in console application
@leowest after extensive troubleshooting, OneDrive seems likely to have been the culprit, possibly due to a corrupted SharePoint shortcut. Since removing it, File Explorer is auto-synching again with file system changes, and my C# code is no longer hanging after I’ve closed the folder dialog.
Thank you very much for your help with this! Determining it was a setup issue rather than a C# issue helped lead me down a path toward a solution.
18 replies
✅ Lag after closing folder dialog in console application
@leowest this is a work computer, but it’s definitely an issue with mine specifically. I had my coworker try the same exe and they didn’t have a delay either. UGH!! I hate when I chase my tail after the completely wrong thing. My hunch tells me it has to do with the same issue I experience where if I create a new folder or delete a file in File Explorer, the changes never seem to show up for me until I hit the Refresh button. I thought maybe it was my local icon cache, but deleting that didn’t fix the issue.
18 replies
ILogger Dependency Injection for Libraries
@TeBeCo, I like that a lot, it’s very clean. For internal classes which are only instantiated inside the library and not available to callers, would the best practice be for those to take the non-generic
ILogger
and have whichever class instantiates them pass in its own logger, since its type is meant to truly be internal and shouldn’t be leaking its context into logs anyhow?
e.g.,
75 replies
ILogger Dependency Injection for Libraries
@TeBeCo this code will be in a library with the only point of entry being FooFactory, so I would not be able to register FooRed or FooBlue. In that case are you saying I would want to inject a factory all the way down like this?
75 replies
Properly locking the console in async code
@cap5lut I did not know about Spectre.Console, that’s awesome info thanks! It doesn’t sound like their progress bar will work for my particular use case, per the below, but I may use some of the other features they offer.
The progress display is not thread safe, and using it together with other interactive components such as prompts, status displays or other progress displays are not supported.
16 replies
Properly locking the console in async code
@mtreit I think I have something working now, thanks to your pointers. Found out I can lock on
Console.Out
directly, which made things far simpler. Apparently with the move to .NET Core this feature got originally removed in favor of private locking objects, but it was added back in due to the common use case of needing to change the console color in a thread-safe manner. I’m sure this could be more efficient, but it works for now at least.
16 replies
Properly locking the console in async code
@mtreit ohhhhhhhh so I was thinking of it backwards, then. Thank you for the clarification! Sounds like perhaps I need to make a wrapper function for writing to the console that uses a semaphore slim and utilize that for any writing to console?
16 replies
Properly locking the console in async code
@mtreit I was trying to add a lock with this, maybe that’s not the correct way?
Trying to make it async so that I can have a progress bar that updates on a task running asynchronously while other things may be running and outputting to the console at the same time. Hence trying to make it just a bar at the bottom.
16 replies