Is there a PSA sample in Windows-universal-samples?

Woods Sea 5 Reputation points
2023-12-21T02:19:53.8866667+00:00

Is there a sample for PSA application development in Windows-universal-samples? https://github.com/Microsoft/Windows-universal-samples

I want to develop my PSA application starting with a sample. I read design guide and other documents, but it seems no PSA sample in sample code.

Can anyone help? thanks.

Windows Server Printing
Windows Server Printing
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Printing: Printer centralized deployment and management, scan and fax resources management, and document services
640 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Karlie Weng 14,106 Reputation points Microsoft Vendor
    2023-12-25T01:38:13.35+00:00

    Hello,

    I'm not sure if it is helpful to you:

    According to the article Print support app design guide - Windows drivers | Microsoft Learn

    C# sample code for activation of the Settings UI when launched from any print dialog (MPD/CPD or custom print dialog) or from system settings:

    namespace PsaSampleApp

    {

    sealed partial class App : Application

    {

    Deferral settingsDeferral;

    protected override void OnActivated(IActivatedEventArgs args)

    {

    if (args.Kind == ActivationKind.PrintSupportSettingsUI)

    {

    // Get the activation arguments

    var settingsEventArgs = args as PrintSupportSettingsActivatedEventArgs;

    PrintSupportSettingsUISession settingsSession = settingsEventArgs.Session;

    // Take deferral

    this.settingsDeferral = settingsEventArgs.GetDeferral();

    // Create root frame

    var rootFrame = new Frame();

    // Choose the page to be shown based upon where the application is being launched from

    switch (settingsSession.LaunchKind)

    {

    case SettingsLaunchKind.UserDefaultPrintTicket:

    {

    // Show settings page when launched for default printer settings

    rootFrame.Navigate(typeof(DefaultSettingsView), settingsSession);

    }

    break;

    case SettingsLaunchKind.JobPrintTicket:

    {

    // Show settings page when launched from printing app

    rootFrame.Navigate(typeof(JobSettingsView), settingsSession);

    }

    break;

    }

    Window.Current.Content = rootFrame;

    }

    }

    internal void ExitSettings()

    {

    settingsDeferral.Complete();

    }

    }

    }

    1 person found this answer helpful.

  2. Woods Sea 5 Reputation points
    2024-01-05T00:57:25.6+00:00

    Hi Karlie Weng,

    Thank you very much.

    According to MS guide documentation, In my sample, OnActivated(IActivatedEventArgs args) is NOT called when I open the print dialog by clicking More Settings in MPD or Preferences in CPD.

    And, Package.appxmanifest file is blew.

    <Package  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"  xmlns:printsupport="http://schemas.microsoft.com/appx/manifest/printsupport/windows10"  IgnorableNamespaces="uap mp printsupport">  
    
    ......  
    
    <Extensions>
      <printsupport:Extension Category="windows.printSupportSettingsUI"          
         EntryPoint="MyPSADemo.App"                  
         uap11:SupportsMultipleInstances="true"/>   
    </Extensions>
    
    ......  
    

    Where am I missing?

    0 comments No comments