Iterating through Open Documents

www.altova.com Imprimir este apartado Página anterior Subir un nivel Página siguiente

Inicio >  Referencia del programador > Application API > Overview > Programming Languages > C# >

Iterating through Open Documents

The code snippet below (from the AutomateAuthenticDesktop example; see the file Form1.cs) shows how to iterate through open documents. A condition is then tested within the iteration loop, and the document view is switched between Text View and Authentic View.

 

 

 // Handler for the "Toggle View Mode" button

      private void toggleView_Click(object sender, EventArgs e)

       {

          // Make sure there's a running Authentic Desktop instance, and that it's visible

           StartAuthenticDesktop_Click(null, null);

 

          // Iterate through all open documents and toggle the current view between Text View and Authentic View.

          foreach (XMLSpyLib.Document doc in AuthenticDesktop.Documents)

              if (doc.CurrentViewMode == XMLSpyLib.SPYViewModes.spyViewAuthentic)

                   doc.SwitchViewMode(XMLSpyLib.SPYViewModes.spyViewBrowser);

              else

                   doc.SwitchViewMode(XMLSpyLib.SPYViewModes.spyViewAuthentic);

       }

 

 

 

The AutomateAuthenticDesktop example example is located in the C# folder of the API Examples folder:

 

Windows 7, Windows 8, Windows 10

C:\Users\<usuario>\Documentos\
Altova\Authentic2019\Authentic

 

You can compile and run the project from within Visual Studio 2008 or Visual Studio 2010.

 


© 2019 Altova GmbH