中的WhiteFramework对自动执行打印作业有多有用

中的WhiteFramework对自动执行打印作业有多有用

本文介绍了C#中的WhiteFramework对自动执行打印作业有多有用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用C#开发一个控制台应用程序,以自动执行大量文档的打印作业.下面我要提到我的发展计划和方法.

算法:

1)获取文档列表.
2)一张一张地处理文件清单.
a)启动应用程序.
b)等待应用程序完美启动.
c)取消打印作业.
d)出现等待打印"对话框.
e)触发"ENTER"键按下事件.
f)等到线轴完成.
g)关闭文档和应用程序.
3)使用打印作业信息更新XML.


代码:

Hi all,

I am developing a console application using C# to automate Print Job for a bulk of documents. Below I am mentioning my plan for developing and my approach.

Algorithm:

1)Fetch list of documents.
2)Process the document list one by one.
a)Launch the Application.
b)Wait till the application launched perfectly.
c)Fire the Print Job.
d)Wait for Print dialog appear.
e)Fire "ENTER" key press event.
f)Wait till spooling finish.
g)Close the document and application.
3)Update the XML with Print job info.


Code:

//Launch the file from the location specified in.
White.Core.Application application =White.Core.Application.Launch(@path);

Console.WriteLine("launch is done");

Thread.Sleep(3000);//Wait till Application Launched successfully.

//Sending Commands to Print(to press "Ctrl+P" button).
SendKeys.SendWait("^(p)");

Thread.Sleep(3000);//Wait till Print Dialog appear 

//Sending Commands to Print(to press "Enter" Button).
SendKeys.SendWait("{ENTER}");

//Get the current time as the document fired for print job.
_printedTime = DateTime.Now;

Thread.Sleep(3000);//Wait till spooling Finish.

//Closing the window.
SendKeys.SendWait("%{F4}");



现在的问题是等待的情况下,我盲目地使用Thread.Sleep(With Few seconds),这不是理想的选择.因此,我需要知道如何使用C#中的White Framework解决这些问题.

有人可以帮我解决此问题吗?任何帮助将不胜感激.
在此先感谢您



Now the problem is for waiting case I am blindly using Thread.Sleep(With Few seconds), which is not Ideal. So I need to know How I''ll fix these issues using White Framework in C#.

Can anybody help me to fix this issue please. Any help will be appreciated.
Thanks in advance

推荐答案


这篇关于C#中的WhiteFramework对自动执行打印作业有多有用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:26