|
I ran into another way you can probably do it - add System.Drawing.Common to your the project. It makes it the code Windows-specific, but it will compile in .Net Core.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
No matter what you specify for a title, the titlebar shows the name of the icon specified (or nothing at all if you didn't specify an icon. The fix is:
File: WPfMessageBoxEx.cs
Method: public static MessageBoxResult Show(string msg, param object[] args)
Method: public static MessageBoxResultEx ShowEx(string msg, params object[] args)
In both methods, this line:
if (item is string ttl && !string.IsNullOrEmpty(title)) { title = ttl; }
Should be:
if (item is string ttl && !string.IsNullOrEmpty(ttl)) { title = ttl; }
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Great, I found it, too -)). But I was incorrect, my change was
if (item is string ttl && string.IsNullOrEmpty(title)) { title = ttl; }
simply removing the !
|
|
|
|
|
FYI - I've tried to download the ZIP folder twice now and both times Win10 can't open it because it claims it's an invalid zip.
Kinda goes along with where I live. Out in the middle of nowhere. Invalid zip code and all...
Cheers
-Red
The madman is not the man who has lost his reason; the madman is the man who has lost everything except his reason.
--G.K. Chesterton
|
|
|
|
|
I zipped it up with the Windows (Win7) built-in zip compressor, and nobody else has complained (yet). I suspect you're going to tell me that you don't have problems with other zip files...
Can I get you to try a 3rd party tool, such as 7Zip or something like that, and let me know what happens?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Maybe since I'm the only one recently who has downloaded it has actually tried to use it?
Because:
1. It is not a ZIP archive, it's a GZIP archive. Subtle, but significant and means Windows 10 users will all get the same message that I received. (Invalid zip.)
2. When you open it as a GZip, (this is the option/information 7-Zip provides) all that's in the archive file is a single HTML file. There's no source, no VS project files, not even a mention of Messagebox() or so much as a whiff of c#. Just HTML from what appears to be a menu.
I mean I know I'm pretty clueless sometimes, but after 40 years in this industry you'd think I could at least open a Zip file, ha.
The madman is not the man who has lost his reason; the madman is the man who has lost everything except his reason.
--G.K. Chesterton
|
|
|
|
|
I downloaded the file and opened it, and it "works on my box".
I'm not sure why it would be seen as a gzip file if I used the Windows built in "Send to compressed file".
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
OK. This is really curious.
(Ya, sure, compiles fine on my box, blah blah. Lol.)
Ok, so I'll try a couple things. First, I'll try downloading it from a different box. If that doesn't work, I can switch ISP's (I have satellite and cellular) and see if that does anything.
Since you're in the southwestern US, I'm wondering if there's any possibility for the download to be corrupt on a mirror or regional storage provider. I just haven't run into this before, so it is a bit weird.
The only thing I can think of is that something on my end may be diddling with the incoming stream and may be why 7-Zip thinks its a GZip... and GZips don't natively support folders or nested items unless you use TAR, so this may be why I don't see anything in it except for the HTML.
I dunno. I just flip hamburgers and wash bottles.
The madman is not the man who has lost his reason; the madman is the man who has lost everything except his reason.
--G.K. Chesterton
|
|
|
|
|
Follow up:
OK, this *is* strange.
I switched to my satellite NIC and downloaded the file, and whala. As we'd say in the Navy, "It works fine, lasts a long, long time and drains to the bilge."
No problems - files are there, extracts like it should.
Switch back to my industrial cellular router on the Verizon network, and weird stuff again.
This time, the file is a partial download (appends, 'CRDOWNLOAD' to the filename) - only gets 328KB before declaring the download done.
The weird thing is, I haven't ever run into this before. Me thinks something is afoot...
The madman is not the man who has lost his reason; the madman is the man who has lost everything except his reason.
--G.K. Chesterton
|
|
|
|
|
Sounds like verizon is doinking with the stream. I don't do anything on cellular, so I have no experience with the weirdness.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
It probably is cellular. I have run into this while tethering. My research showed cell networks use a compression system that does not always yield an exact binary copy of the original. It is very tolerant to lost and corrupted data. Think of a voice stream or picture or video. Would a few misplaced bits really make a difference.
I have often wondered when you download an app does it use a different system. I would think it would have to. There is very little I can find on what they do. Probably buried very deep in the ?G specs.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
Ye olde farte!
Yes, finally I read an article written by someone obviously closer to my generation. And here I was thinking I was the only one who pondered the brazen ineptitude displayed by M$ when they more or less threw the MessageBox() functionality into WPF, as if WPF were some kind of leprous stew that needed an extra pinch of Interop stink.
Thank you for saving me a night of coding. While I do enjoy coding, coding around truly dumb things or to replace things that should work better, isn't coding I that I tend to enjoy all that much. Unless someone's paying me a truckload of cash. In that case, I'll write Interop all night, dumb databinding like the blind date it is and drive WPF with event delegates like a cheap.... oh never mind. I'll shut up now before I get into trouble.
Thanks for this.
-Red
The madman is not the man who has lost his reason; the madman is the man who has lost everything except his reason.
--G.K. Chesterton
|
|
|
|
|
It has been very interesting watching this develop. It really is a classic example of creeping featurism. In general I like it I am worried that with the new more complex features come new more complex bugs. It will be interesting over the next couple of months to see how this aspect of creeping featurism plays out.
In my group there is an even mix of cheers and raspberries. About half want me to strip all the features and go back to a simple replacement for the classical MessageBox. All most people really cared about to begin with is the size. If the bug list grows much I will be forced to ?????
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
You don’t have to use all the extended features. You can get by with just the larger font size if that’s what you want.
I’m done adding things to it, but I am working on a version that will work in powershell (different code base, so no chance of interfering with the current version.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Hi John,
Thank you a lot for your work. Looks really interesting.
I'll have a deeper look on it for sure (my only problem is the "when"... time lately is a real scarce good for me).
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
My overloaded show methods don't match the standard wpf message box AT ALL.
The right thing to do would be to go back and make them the same, so you have the same overloads.
Looks like this weeks update will be delayed...
EDIT ============================
Command decision - removed ALL of the existing Show methods, and replaced them with this:
Show(string msg, params object[] parameters)
This way, the show method can accept ANY parameter you pass it, keep what it needs, and throw the rest away. This solves the "endless list of overloads" problem.
The calls to the standard Show method should not need modification. At all.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 15-Jan-21 17:06pm.
|
|
|
|
|
But it breaks backward compatibility. To use the new one, all I had to do was replace all MessageBox with MessageBoxEX. If this will not work then you do not have a replacement for MessageBox.
Yes, I had to put Using MessageBoxEs int he header but that was just repeating a paste. I probably could have figured out how to do a replace all for that also.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
You can still specify the parameters in the same order as the standard message box.
Reasons for my decision:
0) When I put in the new method, none of my calls to the standard Show method broke, s no additional work was required.
1) Besides, this is not an extension of the original message box, it's a replacement, so I am automatically afforded some artistic license in terms of implementation.
2) I feel that the overloads provided in the standard message box are too restrictive.
3) I don't support the MessageBoxOptions parameter right now, but doing it the way I chose to do it allows anyone to add that without worrying about creating a crapload of overloads to do it themselves.
4) I left the old Show() methods in the code, but you have to define a compiler directive in the properties to include them. I personally think that's a pain in the ass, and I will not be maintaining the old overloads in the future.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 16-Jan-21 14:57pm.
|
|
|
|
|
Sorry, I can't seem to find the message, but I think I found out why. If you specify a custom template name that doesn't exist, you won't get any buttons. I made a fix for that (coming in the next update).
Update will be posted maybe today, maybe tomorrow.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Never thought I would care but running threw a bunch of tests today on my program sometime the test procedure gets very repetitious. It would be nice if there was a default button. The old messagebox has one. Not sure all the rules. There are two ways to set a default when you press "Enter"
1. Set Focus. Focus on these buttons do not show up well. Use the tab key to set focus and then hit "Enter". Having the mouse over does not set focus.
2. There is a setting for a wpf button called IsDefault. This is the button that is pressed when you press "Enter" and focus is not on that button.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
I don't think wpf has a concept of a "default button, but i'll check around.
EDIT ================
It does indeed have a IsDefault property. Would you expect to be able to specify the default button or just want it to use the same defaults as the standard messagebox?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I have pondered the same question about Default. The legacy MessageBox seems to always default to Yes or OK. I does it by setting focus and positioning the cursor when there is more than one answer. If only one answer it does not bother with the cursor (kind of weird).
I do not want to makes things more complicated so the current defaults would be alright. The legacy default method also sort of makes sense. Also, it makes the behavior of the message box more consistent to the operator.
I to was surprised that wpf had the concept of default button. I never noticed it until I Googled for "wpf default button". It is a check box in the properties. Like many properties you have to change proprieties to sort by name to find "IsDefault"
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
Merry Christmas.
Happy New Year.
Happy Easter.
Happy Thanksgiving.
Okay, that's enough.
Cheers.
|
|
|
|
|
Yes it's good idea. I deleted the title bar..
Since we are in WPF, can we make an animation during the opening / closing of the box (for example a box that opens)in the next update?
|
|
|
|
|
I will not be animating anything, but you have the source, so feel free to add it yourself.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|