midora Posted February 17, 2022 Share Posted February 17, 2022 Because ControlInfoPropertyNames.Description is used to set the text of the UriProperty allow ControlInfoPropertyNames.Footnote (as used by BooleanProperty). Or maybe allow Footnote for all properties (in addition to Description just o be consistent). In general I would prefer that .ButtonText sets the text of BooleanProperty and UriProperty and Description would only be used for the description. But it's a little bit late now 😉  Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted February 17, 2022 Share Posted February 17, 2022 wait why is this in the Translation and Localization section? Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
midora Posted February 17, 2022 Author Share Posted February 17, 2022 Because I did a mistake... Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted February 17, 2022 Share Posted February 17, 2022 I've filed a bug for v4.4.x, I may be able to get a look at this, or maybe @toe_head2001Â or @BoltBait will grab the task. I'm also willing to pull it in for 4.3.9 if it's simple enough (which it should be). 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
midora Posted February 17, 2022 Author Share Posted February 17, 2022 I was surprised that switch allows to test for a class type... Â public void SetPropertyDescription(Property property) { ControlInfoPropertyNames cipn; switch (property) { case BooleanProperty: case UriProperty: cipn = ControlInfoPropertyNames.Footnote; break; default: cipn = ControlInfoPropertyNames.Description; break; } var descriptionText = Context.MapKeyToText(property.Name + ".Description", ""); Info.SetPropertyControlValue(property.Name, cipn, descriptionText); } Â Quote Link to comment Share on other sites More sharing options...
otuncelli Posted February 17, 2022 Share Posted February 17, 2022 @midoraThis is a feature of C# 9.0.  If you use variables it works in C# 7.0 as well  switch (property) { case BooleanProperty _: case UriProperty _: cipn = ControlInfoPropertyNames.Footnote; break; default: cipn = ControlInfoPropertyNames.Description; break; }  Quote Link to comment Share on other sites More sharing options...
midora Posted February 17, 2022 Author Share Posted February 17, 2022 VS proposes to use a switch expression             var cipn = property switch            {                BooleanProperty or UriProperty => ControlInfoPropertyNames.Footnote,                _ => ControlInfoPropertyNames.Description,            };  I guess I should take the time to have a look to all the new c# features. But on the other side I have to debug now Xamarin code on iOS and should not forget the old stuff 😉  Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.