Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7435847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:08:36+00:00 2026-05-29T10:08:36+00:00

I have designed a system that is made up of 3 separate applications: Web

  • 0

I have designed a system that is made up of 3 separate applications:

  1. Web Application
  2. WCF Service application that receives requests from the web app, does the appropriate action and prints the result using the SendKeys class SendKeys.SendWait("^p"); (this send a Ctrl + P command that prints whats on the screen).
  3. Console application that intercepts printer output (virtual printer via redmon) via the Console.In (as suggested here

The WCF Service app and Web application can communicate easily, but there is no direct communication between the service app and console application. The console app only starts when there is a printer job and the WCF app doesn’t know the result of the print job.

Is there a way to make the WCF Service app recieve feedback from the printed job (whether it was ok or not), so it can send appropriate response back to the web application, without doing Thread.Sleep() each second until the printer app finishes printing and saves the result in a file or database?

Is there a way i could pause the thread in the WCF service app, and resume it (whilst sending information back) from the printer console application when the printing process is done?

Edit:

I managed to find a solution from Richard Blewett’s suggestions. The solution would make the WCF service app wait untill the print job is finnished, but it will cause the WCF app to be limited to only making one print job at a time.

I create an EventWaitHandle with some key in the WCF app like this:

EventWaitHandle ewh = new EventWaitHandle(false, EventResetMode.ManualReset, "unique-key");
WaitHandle.WaitAny(new WaitHandle[] { ewh });

And i can return to the thread from the Console app like this:

EventWaitHandle ewh = EventWaitHandle.OpenExisting("unique-key");
ewh.Set();

With Richard’s solution this will not be the case, and multiple WCF service calls can be done simultaneously.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:08:37+00:00Added an answer on May 29, 2026 at 10:08 am

    Assuming there is a unique identifier for the print job then the console app could call the WCF service to say the print job is either completed OK or failed.

    The WCF service would either have to block until the completion call came in (waiting on say a ManualResetEventSlim) or you would have to write the service as an async service so the request thread could be returned to the pool while the print job was in progress.

    The reason you need a unique identifier for the print job is you will have to hold a data structure in memory in the service mapping unique id to event so you can signal the correct waiting request when its job is complete

    When the WCF service creates a print job it puts an entry in, say, a ConcurrentDictionary mapping printJobId to a non signalled ManualResetEventSlim (one for each print job). It then waits for the event to signal.

    Now when the print job completes, the console app in turn calls the WCF service passing its printJobId. This operation does to the dictionary, grabs the event and signals it. The original call now wakes up knowing that the print job is complete.

    The status of the print job could also be passed via this dictionary data structure so you would have something like

    class PrintJob
    {
        public PrintJob()
        { 
            Event = new ManualResetEventSlim();
        }
    
        public ManualResetEventSlim Event {get; private set;}
    
        public int Status{ get; set;}
    }
    

    and the dictionary would map the printJobId to one of these for each print job. The console app called operation would set the status to the outcome of the print job

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a custom textbox that inherits from textbox. using System.Drawing; using System;
I have a content management system that I have designed which uses XML files
I have a Silverlight application that communications with an ASP.NET backend through WCF. I
Background : I have a C# Windows Forms application that contains a Windows service
I have a system application, that runs as a collection on 12 processes on
I have already designed an applications that is nothing more than a simple WinForm
Background: I'm working on an application that already has a thread system designed. It's
In my company, a system is designed to have 3 layers. Layer1 is responsible
I have designed a new web site. I have hosted it online. I want
I currently have designed a system for simple send message receive message using such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.