简体   繁体   English

如何在Metro风格的应用程序中选择打印机

[英]How to choose printer in Metro-style app

I'm trying to convert an existing desktop app into metro style app (Win8 & VS12). 我正在尝试将现有的桌面应用程序转换为metro风格的应用程序 (Win8和VS12)。 but i'm having a hard time dealing with the printing. 但是我很难处理打印。

my software has two users - "Admin" and "User". 我的软件有两个用户 - “管理员”和“用户”。 I want the "Admin" to be able to choose printer and printer settings, and the "User" need to press on "Print" button, and that's it. 我希望“管理员”能够选择打印机和打印机设置,“用户”需要按“打印”按钮,就是这样。

the troubles are: 麻烦是:

  1. I can't find how to get all connected printers. 我找不到如何获得所有连接的打印机。 ( DeviceInformation.FindAllAsync() requires DeviceClass which has these options only - All, AudioCapture, AudioRender, PortableStorageDevice, VideoCapture ). DeviceInformation.FindAllAsync()需要DeviceClass ,它只有这些选项 - All, AudioCapture, AudioRender, PortableStorageDevice, VideoCapture )。 [in my original app (WPF), i'm using PrinterSettings.InstalledPrinters ] [在我的原始应用程序(WPF)中,我正在使用PrinterSettings.InstalledPrinters ]

  2. I can't find a way to print to a selected printer (even if I already know the name). 我找不到打印到选定打印机的方法(即使我已经知道了名字)。 since (as far as i understand), the only way to print is to open (using code or registration) the "charms" bar, and let the user to choose the printer. 因为(据我所知),打印的唯一方法是打开(使用代码或注册)“魅力”栏,让用户选择打印机。 What if i don't want the user to use a specified printer ? 如果我不希望用户使用指定的打印机怎么办?

  3. Is there a way to reference a "normal" C# dll that will do the "dirty stuff" for the metro-style app ? 有没有办法引用一个“正常”的C#dll来为Metro风格的app做“脏东西”? When i'm trying, i'm getting "Unable to add reference to project 'Try1'". 当我正在尝试时,我得到“无法添加对项目'Try1'的引用”。 is there's a way to bypass it ? 是否有办法绕过它?

thank you very much in advance ! 非常感谢你提前!

Printing in a Windows Store app is now handled by a task . Windows应用商店应用中的打印现在由任务处理 You don't have to do all the work of finding the printers and making the user select one, that's now handled by Windows. 您不必完成查找打印机和让用户选择打印机的所有工作,现在由Windows处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM