D H said:
As I explained, I used an incredibly simple example - make a beep()
function. One that works at all times. Regardless of winexe or exe.
I don't see anything "peculiar" or unreasonable about asking if something
so basic and simple is possible.
I think what Tim was trying to get across is that generally, if you are
targetting both Console and WinForms, you have two separate codebases
handling the presentation tier, and then you business and data tiers behind
them. Therefore, each codebase would only require the code it needs. The
console application would not use MessageBoxes, and the WinForms exe would
not use console I/O. Thus, the "something peculiar" you're doing is
approaching this from the wrong side. Rather than try to create a cross-UI
system library, it is far easier to simply have 2 presentation layers. Many
things in Windows UI do not cross well as concepts into Console UI and vice
versa. So the approach is "peculiar", not this specific instance (beep).
(and if it's not, just say so, don't tell me I must be doing something
wrong or peculiar for even asking).
He didn't say that, he said that you're doing something peculiar for trying
to have a single codebase crossing Console and Winforms. I don't understand
how you get from his first sentence above to an attack on you for asking
your question?
I found an alternative in this one specific case is to call
microsoft.visualbasic.interaction.beep() which works on Mono and .NET and
in console or winexe apps. Of course that's not a very generalizable
solution for other cases, is it?
No, it's not.
Console Apps and Windows Apps are fundamentally
It's a beep. It couldn't be more simple. There is no common code. What's
uncommon about a beep?
Um, you actually said "Of course that's not a very generalizable solution
for other cases, is it?". This implies that you're looking at something more
extensive than a beep. You've already pointed out that you have a solution
for beep, and now Tim is quite delicately pointing out that your overall
approach is flawed, not the beep solution.