Click here to Skip to main content
15,896,154 members
Home / Discussions / C#
   

C#

 
AnswerRe: SQL Data Base Update - Best approach nested implementation Pin
Rob Graham2-Apr-10 8:18
Rob Graham2-Apr-10 8:18 
QuestionRectangle.Intersect() or Rectangle.Contains() ? Pin
venomation2-Apr-10 1:57
venomation2-Apr-10 1:57 
AnswerRe: Rectangle.Intersect() or Rectangle.Contains() ? Pin
Luc Pattyn2-Apr-10 2:24
sitebuilderLuc Pattyn2-Apr-10 2:24 
QuestionRedirecting an output stream Pin
Lutosław2-Apr-10 1:24
Lutosław2-Apr-10 1:24 
AnswerRe: Redirecting an output stream Pin
Luc Pattyn2-Apr-10 2:33
sitebuilderLuc Pattyn2-Apr-10 2:33 
GeneralRe: Redirecting an output stream Pin
Lutosław2-Apr-10 3:50
Lutosław2-Apr-10 3:50 
GeneralRe: Redirecting an output stream Pin
Luc Pattyn2-Apr-10 3:54
sitebuilderLuc Pattyn2-Apr-10 3:54 
GeneralRe: Redirecting an output stream Pin
Lutosław2-Apr-10 4:39
Lutosław2-Apr-10 4:39 
Luc Pattyn wrote:
That does not fit well with the code you have shown.

I meant I hadn't forgotten to add apriopriate lines after reading your post, of course Roll eyes | :rolleyes: . Here is the full code.
public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
{
	handled = false;
	if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
	{
		if(commandName == "LatexAddin.Connect.LatexAddin")
		{
		    Document doc = _applicationObject.ActiveDocument;
            if (Path.GetExtension(doc.Name) == ".tex")
            {
                var p = new System.Diagnostics.Process();
                var pinfo =new ProcessStartInfo
                           {
                               WindowStyle=ProcessWindowStyle.Hidden,
                               CreateNoWindow = true,
                               FileName = "pdflatex",
                               Arguments = string.Format("\"{0}\" -c-style-errors", doc.FullName), //-shell-escape \"{0}\" 
                               WorkingDirectory = Path.GetDirectoryName(doc.FullName),
                               RedirectStandardError = true,
                               RedirectStandardOutput = true,
                               UseShellExecute = false
                           };

                
                p.StartInfo = pinfo;

                p.OutputDataReceived += p_OutputDataReceived;
                p.ErrorDataReceived += p_ErrorDataReceived;
                p.EnableRaisingEvents = true;
                p.Exited += p_Exited;

                p.Start();

                //_applicationObject.ToolWindows.OutputWindow.ActivePane.OutputString(p.StandardOutput.ReadToEnd());
            }
		    //handled = true;
			return;
		}
	}
}

void p_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
    Console.WriteLine("out:" + e.Data);  // NOT WORKING
}

void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
    Console.WriteLine("out:" + e.Data);  // NOT WORKING
}


void p_Exited(object sender, EventArgs e)
{
    // IT WORKS WHEN OUTPUT IS NOT REDIRECTED
    Console.Beep();
    ((Process) sender).Exited -= p_Exited;
    ((Process)sender).OutputDataReceived -= p_OutputDataReceived;
    ((Process)sender).ErrorDataReceived -= p_ErrorDataReceived;
}

Greetings - Jacek

AnswerRe: Redirecting an output stream Pin
PIEBALDconsult2-Apr-10 4:06
mvePIEBALDconsult2-Apr-10 4:06 
GeneralRe: Redirecting an output stream Pin
Lutosław2-Apr-10 4:40
Lutosław2-Apr-10 4:40 
News[Solved!] Redirecting an output stream Pin
Lutosław2-Apr-10 4:44
Lutosław2-Apr-10 4:44 
GeneralRe: [Solved!] Redirecting an output stream Pin
Luc Pattyn2-Apr-10 4:49
sitebuilderLuc Pattyn2-Apr-10 4:49 
GeneralRe: [Solved!] Redirecting an output stream Pin
Lutosław2-Apr-10 5:21
Lutosław2-Apr-10 5:21 
GeneralRe: [Solved!] Redirecting an output stream Pin
Luc Pattyn2-Apr-10 5:24
sitebuilderLuc Pattyn2-Apr-10 5:24 
AnswerRe: Redirecting an output stream Pin
Mirko19802-Apr-10 6:12
Mirko19802-Apr-10 6:12 
Questionwho handles error while writing the source code???. Pin
Isaac Gordon1-Apr-10 21:42
Isaac Gordon1-Apr-10 21:42 
AnswerRe: who handles error while writing the source code???. Pin
OriginalGriff1-Apr-10 21:45
mveOriginalGriff1-Apr-10 21:45 
GeneralRe: who handles error while writing the source code???. Pin
Isaac Gordon2-Apr-10 0:58
Isaac Gordon2-Apr-10 0:58 
GeneralRe: who handles error while writing the source code???. Pin
Not Active2-Apr-10 1:55
mentorNot Active2-Apr-10 1:55 
AnswerRe: who handles error while writing the source code???. Pin
Abhinav S1-Apr-10 22:11
Abhinav S1-Apr-10 22:11 
AnswerRe: who handles error while writing the source code???. Pin
Eddy Vluggen1-Apr-10 22:49
professionalEddy Vluggen1-Apr-10 22:49 
AnswerRe: who handles error while writing the source code???. Pin
dan!sh 1-Apr-10 23:23
professional dan!sh 1-Apr-10 23:23 
General[Edit] Re: who handles error while writing the source code???. Pin
Lutosław2-Apr-10 1:28
Lutosław2-Apr-10 1:28 
GeneralRe: who handles error while writing the source code???. Pin
Not Active2-Apr-10 1:58
mentorNot Active2-Apr-10 1:58 
GeneralRe: who handles error while writing the source code???. Pin
Lutosław2-Apr-10 2:50
Lutosław2-Apr-10 2:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.