MessageService change request

May 28, 2012 at 6:08 AM


I am looking into the feasibility of having the MessageService use a specific Window (rather than the application main window) as its owner.

I first though of subclassing MessageService & overriding the appropriate Show(...) method. Unfortunately this method calls methods that are private to MessageService, so I would have to pretty much replace MessageService altogether.

How feasible would it be to add a protected virtual Show() method which accepts a Window reference to be used as the owner in the messagebox.Show() call?

That would make subclassing MessageService feasible & allow me to centre the message on the appropriate window.

May 28, 2012 at 9:08 AM

There are 3 private static methods on the MessageService to translate a MessageButton to a MessageBoxButton, etc. I made these protected. The rest of the methods are all public virtual, so I actually don't know what you mean.

The new (3.2) messageservice already uses the active window instead of the main window (and that is probably what you want), so I would try that one out first.

May 28, 2012 at 10:54 AM

ok, I must be looking at obsolete code because the 3 static methods are all private (v3.0). If they are now protected, you have my request covered.

I actually went ahead & copied the 3 private static methods (v3.0) for some testing & whilst the messagebox window doesn't centre itself on its owner (I think that is a microsoft issue...), it at least prevents the main window from being 'pushed' ahead of the active window.

Using the active window by default (3.2) covers most of what I want. I set up my 'test' code to also be able to select the window by specifying the viewmodel, so I can put up a message on a window which is not the cative window.

Looks like I need to download the latest version....