Click here to Skip to main content
15,905,607 members
Home / Discussions / C#
   

C#

 
AnswerRe: workflow question : need wfmc standard tables definitions. Pin
Richard MacCutchan2-Apr-10 4:18
mveRichard MacCutchan2-Apr-10 4:18 
GeneralRe: workflow question : need wfmc standard tables definitions. Pin
Abhinav S2-Apr-10 5:01
Abhinav S2-Apr-10 5:01 
QuestionForm data printing problem Pin
Mark F.2-Apr-10 3:54
Mark F.2-Apr-10 3:54 
AnswerRe: Form data printing problem Pin
Luc Pattyn2-Apr-10 3:59
sitebuilderLuc Pattyn2-Apr-10 3:59 
GeneralRe: Form data printing problem Pin
Mark F.2-Apr-10 4:11
Mark F.2-Apr-10 4:11 
GeneralRe: Form data printing problem Pin
Luc Pattyn2-Apr-10 4:20
sitebuilderLuc Pattyn2-Apr-10 4:20 
GeneralRe: Form data printing problem Pin
Mark F.2-Apr-10 4:26
Mark F.2-Apr-10 4:26 
Questionvscrollbar Pin
v17.poornima2-Apr-10 3:17
v17.poornima2-Apr-10 3:17 
AnswerRe: vscrollbar Pin
Ravi Bhavnani2-Apr-10 7:06
professionalRavi Bhavnani2-Apr-10 7:06 
QuestionSQL Data Base Update - Best approach nested implementation Pin
boreland2-Apr-10 2:26
boreland2-Apr-10 2:26 
AnswerRe: SQL Data Base Update - Best approach nested implementation Pin
Not Active2-Apr-10 2:40
mentorNot Active2-Apr-10 2:40 
GeneralRe: SQL Data Base Update - Best approach nested implementation Pin
boreland2-Apr-10 4:59
boreland2-Apr-10 4:59 
GeneralRe: SQL Data Base Update - Best approach nested implementation Pin
Not Active2-Apr-10 5:48
mentorNot Active2-Apr-10 5:48 
AnswerRe: SQL Data Base Update - Best approach nested implementation Pin
boreland2-Apr-10 5:00
boreland2-Apr-10 5:00 
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 

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.