0

i am running a c# wpf application as a console application so i have both ,a wpf and console window .

i want the console window to hide on a button click in wpf window and reappear on another click .i don't want the window to close and open again,i just want to show/hide the window on button click so that i can see the debug messages when i click on the button .

I asked the question about how to open/close the console window programatically , and here is the solution How to open/close console window dynamically from a wpf application? . But opening and closing gives me a exception every-time when the console window is cloase and a console.writeline function is called .

Community
  • 1
  • 1
rajat
  • 3,415
  • 15
  • 56
  • 90
  • Do you mind posting your code? – Saul Jul 22 '12 at 14:23
  • The code is too large and the question is not related to any specific portion of the code . – rajat Jul 22 '12 at 14:29
  • 1
    Could you not wrap your calls to Console.WriteLine, etc. So that if you don't have a console window displayed the wrapper either does not pass the call along to the (now non-existent console) or it catches the exception and either swallows it, or queues all the writes for a time when the console is available again. – Colin Mackay Jul 22 '12 at 14:32
  • 1
    See this different solution to the same question: http://stackoverflow.com/questions/3571627/show-hide-the-console-window-of-a-c-sharp-console-application – Saul Jul 22 '12 at 14:37
  • @ColinMackay i tried to do that , but there are so many console.writeline calls in the application . – rajat Jul 22 '12 at 14:42
  • @rajat live in Zuari Nagar :) – Anirudha Gupta Jul 22 '12 at 14:46

1 Answers1

0

This solution seems to work ,i ignored it as it was for console application and not for wpf applications.

Community
  • 1
  • 1
rajat
  • 3,415
  • 15
  • 56
  • 90