Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
mystes
May 31, 2006

CapnAndy posted:

So I'm playing with .NET 5 now that it's out, and you can make .dbml files again, but there's no System.Data.Linq, so as far as I can tell, they don't frigging do anything.

Do I really have to go back to data connections, writing every query out, and assigning each result to a variable manually? Because I can, but man, I don't wanna.
Isn't that LINQ to SQL which has been deprecated for years (for some reason)?

Adbot
ADBOT LOVES YOU

CapnAndy
Feb 27, 2004

Some teeth long for ripping, gleaming wet from black dog gums. So you keep your eyes closed at the end. You don't want to see such a mouth up close. before the bite, before its oblivion in the goring of your soft parts, the speckled lips will curl back in a whinny of excitement. You just know it.

mystes posted:

Isn't that LINQ to SQL which has been deprecated for years (for some reason)?
Yeah, and then it's suddenly an option for a file again when you upgrade to .NET 5, so I thought maybe it'd be coming back as part of the Core/Framework integration.

epswing
Nov 4, 2003

Soiled Meat
Say I have an ASP.NET WebAPI server, with a handful of WPF clients.

When a user opens a record and saves it, after the save operation is completed successfully, the server broadcasts "record with id=42 updated!" to all the clients. The clients then all request the latest copy of record with id=42.

This is turning out to be a bit "bursty". With a small number clients it's fine, but when the number of clients is high, and one saves a record, 20 or 40 or 60 other clients all request the latest copy of that record, at the same time, and basically DOS the server.

The EF query to get the record is pretty quick (a few ms). The network is fast (a few ms). We've played with RabbitMQ, and SignalR, we're not married to a particular message queue system. In a pub/sub environment like this, how does one avoid these bursts? We're considering a few things.

1. Spacing out the broadcast so they don't all ask at the same moment
2. Caching the record we know everyone is about to ask for, in memory on the server
3. Sending the whole object with the broadcast, but this seems wasteful because not all clients necessarily need it

Any advice?

Eldred
Feb 19, 2004
Weight gain is impossible.

epalm posted:

Say I have an ASP.NET WebAPI server, with a handful of WPF clients.

When a user opens a record and saves it, after the save operation is completed successfully, the server broadcasts "record with id=42 updated!" to all the clients. The clients then all request the latest copy of record with id=42.

This is turning out to be a bit "bursty". With a small number clients it's fine, but when the number of clients is high, and one saves a record, 20 or 40 or 60 other clients all request the latest copy of that record, at the same time, and basically DOS the server.

The EF query to get the record is pretty quick (a few ms). The network is fast (a few ms). We've played with RabbitMQ, and SignalR, we're not married to a particular message queue system. In a pub/sub environment like this, how does one avoid these bursts? We're considering a few things.

1. Spacing out the broadcast so they don't all ask at the same moment
2. Caching the record we know everyone is about to ask for, in memory on the server
3. Sending the whole object with the broadcast, but this seems wasteful because not all clients necessarily need it

Any advice?

Can you add a small amount of randomness to when the clients request the record? I know you can do that with a retry policy using Polly. Decent MS doc on the idea: https://docs.microsoft.com/en-us/do...l-backoff-polly

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
WPF continues.

I'm now trying to switch between "screens." Each screen is its own UserControl. I've been working on them in separate WPF windows for development but they'd ultimately be manipulated through a common control. I figured I needed a control with it's own view model containing which control to currently present., but it seems like a perversion to use a view model to represent literal GUI controls.

I also can't figure out how to plumb it. What I saw was to add a mention of each of my different screen user controls into my resource dictionary under data templates. I can extract the templates from the dictionary in code but I can't extract the actual user control because I don't know what to feed DataTemplate.FindName's templated parent argument. I'm not entirely convinced I even what a template because it sounds like it's not actually an instance. I think I want to actually instantiate some of this stuff at launch. My main use case here is to gray out loading a game if I don't have any saves, and to gray out or hide saving a game from the main menu if a game hasn't started yet.

Assuming I get past this, all of the screens I'm switching between having some notion of going back (main menu goes back to game, others go back to main menu). What's an appropriate way pass each of these some reference so that it knows how to change the screen?


Edit: I still don't know what the answer really is, but I'm trying something using a template selector attached to a content template selector properly on a content control. I'm not at the point where I got to start switching it in and out so we'll see if that's actually the thing to do or not.

Rocko Bonaparte fucked around with this message at 09:31 on Dec 14, 2020

Nth Doctor
Sep 7, 2010

Darkrai used Dream Eater!
It's super effective!


Eldred posted:

Can you add a small amount of randomness to when the clients request the record? I know you can do that with a retry policy using Polly. Decent MS doc on the idea: https://docs.microsoft.com/en-us/do...l-backoff-polly

+1 for Polly. You can also protect on the server side with Polly to allow only a few requests at a time to enter critical parts, and having everything else wait it's turn.

https://github.com/App-vNext/Polly

E: Hell from your use case, it sounds like server side Bulkhead Isolation+cache policywrap with a relatively short lifetime may do exactly what you need.

Mata
Dec 23, 2003
So its possible to build a project for multiple target frameworks now, but there's no way to build a project with two or more SDKs right? Is the best way to achieve this to have two .csproj files?

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Mata posted:

So its possible to build a project for multiple target frameworks now, but there's no way to build a project with two or more SDKs right? Is the best way to achieve this to have two .csproj files?

This smells a lot like an X-Y problem. What do you need to achieve by building with multiple asks?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Is there a general way in WPF to tell where a view model of mine is actually getting decided to be constructed? The specific issue is that I'm creating an instance of the view model in question as part of the navigation for my main window.

I had to define the view model as a data template in the main window's xaml. I have a content control using a template selector that determines the current bound view model and returns that data template. I think that process creates its own instance of the view model I care about. I can kind of see it happening with breakpoints. I can see it returning the data template I want to use, and the next thing along the way is creating that view model. I guess I should also add that this generally does work. The initial menu does get shown correctly but that's with the defaults.

The problem is the new one I want to show needs a little more information to work correctly. In particular, it needs a reference back to the main window to tell it to show itself. Alternately, the main window needs to know to do the change instead. Since this view model instance that came from an anonymous default constructor is the one the runtime actually has, it finds this back reference is null.

I suppose if anybody has any general idea how I might plumb this, then I'd like to know. Architecturally, I have a view model for the overall presentation of the screen. It basically just contains which view model is currently active. This parent view model is aware of the children and vice versa... if I can actually introduce them in the code. Right now, the children are getting independently created by the framework. I don't know how I can get them in touch with each other. I sense that some of you deal with these view model relationships a lot and have been talking about dependency injection for this kind of situation.

Mata
Dec 23, 2003

NihilCredo posted:

This smells a lot like an X-Y problem. What do you need to achieve by building with multiple asks?

Yeah it does, doesn't it?
Specifically I got a Monogame passion project (Yes I'm using .NET recreationally) which can be built to target DirectX or OpenGL. The GL one is cool because it uses SDL to handle window creation and input, the only issue is poor GL support on older radeon cards, and for this reason I want to also build a version of my game using the DirectX DLL, but the DX version of Monogame uses System.Windows.Forms for windows and input. Using System.windows.forms in .NET5 means I have to use the net5.0-windows SDK (and set a few properties in the .csproj, but this can be done conditionally. The SDK can not).
There's a few different approaches I could use to tackle the X problem, such as trying to generate radeon-compatible GLSL shaders, or simply using the SDL window to host the DirectX context as well. But building out two separate versions (of which one references System.Windows.Forms) seemed like the easiest way forward.

Mata fucked around with this message at 12:16 on Dec 17, 2020

GoodCleanFun
Jan 28, 2004

Rocko Bonaparte posted:

Is there a general way in WPF to tell where a view model of mine is actually getting decided to be constructed? The specific issue is that I'm creating an instance of the view model in question as part of the navigation for my main window.

I had to define the view model as a data template in the main window's xaml. I have a content control using a template selector that determines the current bound view model and returns that data template. I think that process creates its own instance of the view model I care about. I can kind of see it happening with breakpoints. I can see it returning the data template I want to use, and the next thing along the way is creating that view model. I guess I should also add that this generally does work. The initial menu does get shown correctly but that's with the defaults.

The problem is the new one I want to show needs a little more information to work correctly. In particular, it needs a reference back to the main window to tell it to show itself. Alternately, the main window needs to know to do the change instead. Since this view model instance that came from an anonymous default constructor is the one the runtime actually has, it finds this back reference is null.

I suppose if anybody has any general idea how I might plumb this, then I'd like to know. Architecturally, I have a view model for the overall presentation of the screen. It basically just contains which view model is currently active. This parent view model is aware of the children and vice versa... if I can actually introduce them in the code. Right now, the children are getting independently created by the framework. I don't know how I can get them in touch with each other. I sense that some of you deal with these view model relationships a lot and have been talking about dependency injection for this kind of situation.

I would recommend defining all viewModels in code rather than the view itself. I like to disable startup in app.xaml and override a method to do it from app.xaml.cs where I can load my mainViewModel using a DialogService to open the window. This service is also used to open any other windows I may need. This is the key method:

code:
bool? ShowDialog<T>(BaseViewModel viewModel) where T : Window
{
    var dialog = (Window)Activator.CreateInstance(typeof(T));
    dialog.DataContext = viewModel;
    return dialog.ShowDialog();
}
You can define additional viewModel properties in this mainViewModel class that you can bind up to xaml to other UserControls. I do this for tabs, one viewModel property for each tabbed UserControl. This allows you to control all logic from mainViewModel. If you need to access another viewModel you can pass mainViewModel into the constructor and store as a field to allow access from within.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

GoodCleanFun posted:

I would recommend defining all viewModels in code rather than the view itself.
Is that "define" or "declare?" I'm trying to shove instances of view models into my resources, so I would guess that counts as a declaration instead of definition. But that only matters based on what you meant.

I'm nonetheless still trying to figure out how I could use a manually created view models to get around these phantom ones that are getting created in the stead. I am actually getting thwarted throwing them in the resource dictionary; they're not resolving when I try to look them up and I don't see anything like them in the application's resource dictionary. It's a mystery. I'm still trying stuff though so I'm not totally lost again.

GoodCleanFun
Jan 28, 2004

Rocko Bonaparte posted:

Is that "define" or "declare?" I'm trying to shove instances of view models into my resources, so I would guess that counts as a declaration instead of definition. But that only matters based on what you meant.

I'm nonetheless still trying to figure out how I could use a manually created view models to get around these phantom ones that are getting created in the stead. I am actually getting thwarted throwing them in the resource dictionary; they're not resolving when I try to look them up and I don't see anything like them in the application's resource dictionary. It's a mystery. I'm still trying stuff though so I'm not totally lost again.

Declare, thanks for catching that.

Stop setting DataContext in xaml and do it in C# as mentioned. If you create and control all the viewModels in code there should not be confusion.

Chrungka
Jan 27, 2015

Mata posted:

Yeah it does, doesn't it?
Specifically I got a Monogame passion project (Yes I'm using .NET recreationally) which can be built to target DirectX or OpenGL. The GL one is cool because it uses SDL to handle window creation and input, the only issue is poor GL support on older radeon cards, and for this reason I want to also build a version of my game using the DirectX DLL, but the DX version of Monogame uses System.Windows.Forms for windows and input. Using System.windows.forms in .NET5 means I have to use the net5.0-windows SDK (and set a few properties in the .csproj, but this can be done conditionally. The SDK can not).
There's a few different approaches I could use to tackle the X problem, such as trying to generate radeon-compatible GLSL shaders, or simply using the SDL window to host the DirectX context as well. But building out two separate versions (of which one references System.Windows.Forms) seemed like the easiest way forward.
I hope this might help: You can make SDK conditional by rearranging the .csproj little bit. Following .csproj files are functionally equivalent - can reference System.Windows.Forms and can build as winforms application
code:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0-windows</TargetFramework>
    <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>
</Project>
code:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0-windows</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
  </ItemGroup>
</Project>
Then you can make FrameworkReference conditional, let's say by using $(TargetPlatformIdentifier) in this example
code:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFrameworks>net5.0;net5.0-windows</TargetFrameworks>
  </PropertyGroup>
  <ItemGroup>
    <FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" Condition=" '$(TargetPlatformIdentifier)' == 'Windows' " />
  </ItemGroup>
</Project>
and in code you can differentiate between target frameworks by checking for WINDOWS defined constant:
code:
#if WINDOWS
using System.Windows.Forms;
#endif
You might need to use different conditions, maybe have separate build $(Configuration)s, but you get the general idea, right?

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
What is the best way to take HTML and transform it into valid XML? I have some web pages I want to scrape and turn into something I can use System.Xml.Linq on but it doesn't start out in a form that XElement.Parse() will tolerate, loads of stuff that's not valid in XML. Stack Overflow has a question about this but the answers are mostly dead links. This seems like the most "alive" project linked from the SO post: https://html-agility-pack.net/ Has anyone used that?

LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer
I've used HTML Agility Pack for a cursed module that converts rich text back and forth between XAML and HTML. It worked well for me, but I can trust the input HTML to be well-formed and have a very simple structure, so I can't say how good it is at handling nonconformant markup and whatnot. The project is definitely alive, judging by how often they release new versions.

raminasi
Jan 25, 2005

a last drink with no ice

Hammerite posted:

What is the best way to take HTML and transform it into valid XML? I have some web pages I want to scrape and turn into something I can use System.Xml.Linq on but it doesn't start out in a form that XElement.Parse() will tolerate, loads of stuff that's not valid in XML. Stack Overflow has a question about this but the answers are mostly dead links. This seems like the most "alive" project linked from the SO post: https://html-agility-pack.net/ Has anyone used that?

Do you actually need well-formed XML, or are you just trying to scrape a page? Because if you’re just trying to scrape HTML, adding a step where you generate XML is probably unnecessary, and you can just use that library directly. (The last time I checked it was the go-to .NET scraping library.)

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost
If you need to do HTML parsing, use Anglesharp. IMO it's so much better than HTML Agility Pack: Its API makes way more sense and easier to set up and use, it's fast, it's easy to run Javascript commands on the parsed HTML, and it supports DOM querySelector. So you can test selecting elements inside the browser and pluck them out much easier than what you would have to do in HTML Agility Pack.

spaced ninja
Apr 10, 2009


Toilet Rascal

Drastic Actions posted:

If you need to do HTML parsing, use Anglesharp. IMO it's so much better than HTML Agility Pack: Its API makes way more sense and easier to set up and use, it's fast, it's easy to run Javascript commands on the parsed HTML, and it supports DOM querySelector. So you can test selecting elements inside the browser and pluck them out much easier than what you would have to do in HTML Agility Pack.

This looks awesome. I’ve never used it but I’d recommend it anyway. Agility pack was a hot mess to use the last time I tried it a few years back.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Drastic Actions posted:

If you need to do HTML parsing, use Anglesharp. IMO it's so much better than HTML Agility Pack: Its API makes way more sense and easier to set up and use, it's fast, it's easy to run Javascript commands on the parsed HTML, and it supports DOM querySelector. So you can test selecting elements inside the browser and pluck them out much easier than what you would have to do in HTML Agility Pack.

I don't want to run JavaScript on it, and I don't care what a browser would make of the HTML I download. The pages contain tables of data. I want to read some data out of the tables and then further transform the data. I want to do that using the tools provided in the System.Xml.Linq namespace, because I'm comfortable with those tools.

insta
Jan 28, 2009
HAP exposes the DOM via IEnumerable<HtmlElement>, so you can write LINQ against that. It will be regular LINQ-to-Objects, but I don't know if that's missing anything that System.Xml.Linq has.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Hammerite posted:

I don't want to run JavaScript on it, and I don't care what a browser would make of the HTML I download. The pages contain tables of data. I want to read some data out of the tables and then further transform the data. I want to do that using the tools provided in the System.Xml.Linq namespace, because I'm comfortable with those tools.

I just realised this came across really arsey, which I didn't mean for it to. Sorry.

I actually ended up making my own little class that fucks around with the HTML to turn it into something the XML parser will accept. There are about half a dozen faults that the HTML can have as XML, and I'm just manually fixing them*. But I appreciate the suggestions and I know about them for the future now.

* "fixing" usually means changing the HTML into something not equivalent to the original, because it's in a part of the page I know I don't care about.

mystes
May 31, 2006

Since people in this thread like AngleSharp so much, could someone give an example of how you're supposed to use the default configuration but set headers in the current version? The documentation seems to be astonishingly bad.

Or does everyone just make the requests separately and feed the result to AngleSharp because it's not worth the trouble to use the built in functionality?

Edit: If I google it looks like there should be a Configuration.WithRequestors method which seems like it should be an extension method defined in AngleSharp.Io but it doesn't seem to exist in the version of AngleSharp I'm getting from nuget?

Edit 2: Oh my god there's a separate AngleSharp.Io package even though the AngleSharp.Io namespace is also defined in the main AngleSharp package just to be confusing jesus christ. Why the heck isn't this documented on https://anglesharp.github.io/ which just links to the main nuget package?

Edit 3: I'm still just getting null from OpenAsync whatever I do with no error message, lol.

mystes fucked around with this message at 17:24 on Dec 27, 2020

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

mystes posted:

Since people in this thread like AngleSharp so much, could someone give an example of how you're supposed to use the default configuration but set headers in the current version? The documentation seems to be astonishingly bad.

This is how I have it set up:

1. Handle all requests myself through HttpClient.

2. Create a new AngleSharp.Html.Parser.HtmlParser

3. Parse the HttpClient results with HtmlParser.ParseDocumentAsync, keeping the IHtmlDocument it creates.

4. Handle that document in other classes.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Oh man I found out the NoesisGUI theme is a default that highlights defaults in hot pink to compel you to use your own theme. So I'm supposed to actually define a theme for all the controls I'm using. My brain melts.

mystes
May 31, 2006

Thanks. I got fed up with it and just ended up using HTML Agility Pack for what I was doing but maybe next time I'll try AngleSharp again and just skip having it make the requests for me.

munce
Oct 23, 2010

Does anyone know why System.Drawing.Graphics.CopyFromScreen would run slow in the current (or close to - 6.8.0.105) version of Mono on linux? It's 10-100 times slower than it should be.

Normal time to capture a frame should be a few milliseconds, increasing slightly with resolution. Easily fast enough for real time video capture when run in Windows on the .NET runtime (not Mono), and through an old version of Unity with whatever really old version of the Mono runtime that ships with.

Using the new Mono runtime:
Running in Monodevelop takes 435 ms to capture 1 frame at 1920x1080. Running in Godot gets about this speed too. Unuseable for real time.
Running the exe of the same code takes 38 ms to capture 1 frame at 1920x1080. Better but still too slow.

Using .NET runtime on a Windows machine, windows virtual machine, or through Unity with the old Mono runtime:
3.75ms to capture 1 frame at 1920x1080.

It's really annoying that the performance of a basic old function would get worse like that.

Nth Doctor
Sep 7, 2010

Darkrai used Dream Eater!
It's super effective!


Rocko Bonaparte posted:

Oh man I found out the NoesisGUI theme is a default that highlights defaults in hot pink to compel you to use your own theme. So I'm supposed to actually define a theme for all the controls I'm using. My brain melts.

Counterpoint: lean into it and have your app be Barbie-mode by default.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Nth Doctor posted:

Counterpoint: lean into it and have your app be Barbie-mode by default.

Unfortunately, not everything has that color or I would really be pondering that right now!

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
So baby's first foray into styles. I think the typical thing grown-ups do is define them completely as resources, but I believe I should also be able to define a style with the component I'm creating. This seems to work in my standalone WPF application but not in Noesis GUI in Unity. I'm checking with them on their forums, but I wanted a sanity check from the regular .NET side. Is something like this a normally okay thing to do?

code:
    <DataTemplate x:Key="SaveGameButton" DataType="local:SaveData">
        <Button Name="SaveButton" HorizontalContentAlignment="Stretch" Command="{Binding RunCommonButtonCommand}" CommandParameter="{Binding ElementName=TopmostWindow}">
        ...
            <Button.Style>
                <Style TargetType="Button">
                    <Setter Property="BorderBrush" Value="Yellow"/>
                    <Setter Property="Background" Value="Chartreuse"/>
                </Style>
            </Button.Style>
        </Button>
    </DataTemplate>
I do get a yellow border with a chartreuse body when doing this in the .NET application, but I wonder if it's a certain robustness it is doing to support that which is out-of-spec or something.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Rocko Bonaparte posted:

So baby's first foray into styles. I think the typical thing grown-ups do is define them completely as resources, but I believe I should also be able to define a style with the component I'm creating. This seems to work in my standalone WPF application but not in Noesis GUI in Unity. I'm checking with them on their forums, but I wanted a sanity check from the regular .NET side. Is something like this a normally okay thing to do?

code:
    <DataTemplate x:Key="SaveGameButton" DataType="local:SaveData">
        <Button Name="SaveButton" HorizontalContentAlignment="Stretch" Command="{Binding RunCommonButtonCommand}" CommandParameter="{Binding ElementName=TopmostWindow}">
        ...
            <Button.Style>
                <Style TargetType="Button">
                    <Setter Property="BorderBrush" Value="Yellow"/>
                    <Setter Property="Background" Value="Chartreuse"/>
                </Style>
            </Button.Style>
        </Button>
    </DataTemplate>
I do get a yellow border with a chartreuse body when doing this in the .NET application, but I wonder if it's a certain robustness it is doing to support that which is out-of-spec or something.

From https://www.noesisengine.com/docs/Gui.Core.StylingTutorial.html

quote:

Controls can only have one style set in its Style property, so if a few properties need to be locally overridden remember to define BasedOn in local style to inherit the rest of properties from the style defined in application dictionary. If BasedOn is omitted, property values will fallback to the debug default style defined by Noesis theme.

WPF controls can only have one style - the styles don't cascade out of the box (to get that effect, there's a property 'basedOn'). So I think if you don't define BaseOn property, it'll just use the debug style and ignore what you put inline. The documentation for noesis seems to be strongly encouraging you to put some kind of style in the app dictionary, and then override it inline using based-on property.

(I've never used noessis I just googled this)

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Bruegels Fuckbooks posted:

(I've never used noessis I just googled this)

Do you remember what you googled to get that? I wasn't getting anything and I want to figure out the magic words. I would not be surprised that's the thing since all their examples looked like resource dictionary stuff. So I guess I'll toy around with it in Visual Studio to get the effect using a resource dictionary and then transplant it over.

Edit: Apparently they came to me in a post in their own forum about it. I have to set the Template property for anything to actually take effect. Well, I'll be trying that and then moving to the resource dictionary since it seems like the hip thing to do.

Rocko Bonaparte fucked around with this message at 17:49 on Dec 30, 2020

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Rocko Bonaparte posted:

Do you remember what you googled to get that? I wasn't getting anything and I want to figure out the magic words. I would not be surprised that's the thing since all their examples looked like resource dictionary stuff. So I guess I'll toy around with it in Visual Studio to get the effect using a resource dictionary and then transplant it over.

Edit: Apparently they came to me in a post in their own forum about it. I have to set the Template property for anything to actually take effect. Well, I'll be trying that and then moving to the resource dictionary since it seems like the hip thing to do.

I started off googling "inline style wpf" just to get a refresher on how that worked - then I remembered you mentioning something about that hot pink theme, wondered how that would work, and googled "multiple style wpf" because I didn't know which would win, resource style or "inline" style (I didn't remember it was called "local" style, I should've looked that up). This led to a stackoverflow article about "how to apply multiple styles in WPF", which said https://stackoverflow.com/questions/16096/how-to-apply-multiple-styles-in-wpf

quote:

I think the simple answer is that you can't do (at least in this version of WPF) what you are trying to do.

That is, for any particular element only one Style can be applied.

However, as others have stated above, maybe you can use BasedOn to help you out. Check out the following piece of loose xaml. In it you will see that I have a base style that is setting a property that exists on the base class of the element that I want to apply two styles to. And, in the second style which is based on the base style, I set another property.

Remembering that stuff about the hot pink theme, it occurred to me that since last style applied wins, if they were applying that style programmatically, it would blow out the inline style. So this led me to think this problem was related to the handling in noesis somehow.

I then thought "hey, you know, this Noesis gui thing probably has some kind of documentation." :downs:

So I googled "noesisgui style" - and that lead to the article I linked, which gave an overview of how the styling worked. I figured that whatever was going on with the styles was something done by the framework, so I did a control-F for "pink" - and it showed up in that document. I found the stuff about the local styles (I didn't remember it was called "local style") by reading around the places that mentioned how that theme worked.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I was feeling better about myself until "noesisgui style" because I was trying that search term too and probably saw that page as well, but I wouldn't have been able to tell the significance of it.

Regardless, setting the template is what got it to take effect, but I think I should move it into my resources. I can't put that directly in an App.xaml due to how it integrates with Unity. NoesisGUI does have an App.xaml for standalone usage but not for Unity integration. I have a separate resources XAML that I've been using and merging into my various controls. Is the normal thing here to create a dedicated "theme" XAML that merge in as a part of my resources? Do people normally keep that decoupled from resource XAML that does structural stuff?

raminasi
Jan 25, 2005

a last drink with no ice
Can anyone recommend a markdown -> HTML renderer?

e: I'm assuming that anything decent offers separate parsing and rendering operations, but if not, I need one that does.

raminasi fucked around with this message at 22:44 on Jan 2, 2021

Riot Bimbo
Dec 28, 2006


I am so unhappy with the resources I have available to me.

I have been poking around with ASP.Net stuff, entity framework, and all of that, but the course that was guiding me is so garbage that I just can't deal with it anymore, and the resources that come up from my googling (microsoft tutorials, stuff like https://www.learnentityframeworkcore.com) are very general. They help a bit, like hey it's neat that I can write a basic context class on my own now. I wasn't getting that poo poo at all before. But I guess I'm looking for freely available course-level stuff, if anything like that is out there. I simply lack enough of a knowledge base to be able to say, "I want to make x project" and then just sort of consume whatever I need to get there.

I have a book on C# 8.0 by Ian Griffiths, and it's an okay resource, but again not really useful by itself it seems.

I really wish I could just afford proper paid courses GDI

Anyway if any of y'all have those kinds of recommendations or resources to share, I'd love to get my hands on them.

epswing
Nov 4, 2003

Soiled Meat

Riot Bimbo posted:

I am so unhappy with the resources I have available to me.

There's definitely a lot of mediocre (or just outdated) material out there.

Are you learning just to learn, or are you working on a project? "Learning just to learn" is a bit like learning music notation without actually playing an instrument. I can learn what all these symbols mean, in depth, but unless I actually make some noises with an instrument (and fail a lot, and stick with it, and slowly get better) I'm not getting any meaningful work done.

LongSack
Jan 17, 2003

Riot Bimbo posted:

I am so unhappy with the resources I have available to me.

I have been poking around with ASP.Net stuff, entity framework, and all of that, but the course that was guiding me is so garbage that I just can't deal with it anymore, and the resources that come up from my googling (microsoft tutorials, stuff like https://www.learnentityframeworkcore.com) are very general. They help a bit, like hey it's neat that I can write a basic context class on my own now. I wasn't getting that poo poo at all before. But I guess I'm looking for freely available course-level stuff, if anything like that is out there. I simply lack enough of a knowledge base to be able to say, "I want to make x project" and then just sort of consume whatever I need to get there.

I have a book on C# 8.0 by Ian Griffiths, and it's an okay resource, but again not really useful by itself it seems.

I really wish I could just afford proper paid courses GDI

Anyway if any of y'all have those kinds of recommendations or resources to share, I'd love to get my hands on them.

Might want to check out IAmTimCorey on YouTube. He’s got a ton of C# material, and while I’m not a fan of some elements - his use of Dapper for database access, and Caliburn Micro for MVVM in particular - he’s got a lot of (IMHO) decent content.

redleader
Aug 18, 2005

Engage according to operational parameters
dapper is real good how dare you

Adbot
ADBOT LOVES YOU

GoodCleanFun
Jan 28, 2004
Seconding Tim Corey. He has a ton of great free content.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply