> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Class ApplicationHandler

Namespace: [VM.API.Post.Operations](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.API.Post.Operations)\
Assembly: VM.API.Post.Operations.dll

This is the class to operate the OperationAPI.

```csharp theme={null}
public class ApplicationHandler
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[ApplicationHandler](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.API.Post.Operations.ApplicationHandler.md)

## Constructors

### ApplicationHandler()

Initializes a new instance of the [ApplicationHandler](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.API.Post.Operations.ApplicationHandler.md) class, enabling the OperationAPI to function.

```csharp theme={null}
public ApplicationHandler()
```

#### Examples

The following example demonstrates how to create an instance of the `ApplicationHandler` class:

```csharp theme={null}
applicationHandler = new ApplicationHandler();
```

#### Remarks

This constructor sets up the necessary configurations to allow the OperationAPI to operate.

## Methods

### AddDocument(IList\<string>)

Imports results by adding documents to the UI.

```csharp theme={null}
public void AddDocument(IList<string> filepath)
```

#### Parameters

`filepath` [IList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)>

A list of file paths representing the results to be imported.

#### Examples

The following example demonstrates how to use the `AddDocument` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
```

#### Remarks

This method takes a list of file paths as input parameters and imports the corresponding results into the UI.

### AddPage(string)

Adds a new page with the specified name.

```csharp theme={null}
public IPage AddPage(string name = null)
```

#### Parameters

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the page to be added. If no name is provided, a default name is used.

#### Returns

IPage

An instance of [IPage](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IPage.md) representing the newly added page.

#### Examples

The following example demonstrates how to use the `AddPage` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
applicationHandler.AddPage("page2");
```

#### Remarks

This method adds a new page with the given name. If no name is provided, the page is created with a default name.

### AddPlotView()

Adds a new plot view by creating a chart.

```csharp theme={null}
[Obsolete]
public IOperationsLine2DViewModelBase AddPlotView()
```

#### Returns

IOperationsLine2DViewModelBase

An instance of [IOperationsLine2DViewModelBase](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IOperationsLine2DViewModelBase.md) representing the newly added plot view.

#### Examples

The following example demonstrates the deprecated `AddPlotView` method and the recommended `CreateChart` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
applicationHandler.AddPlotView();
```

#### Remarks

This method creates a new chart. However, this method is deprecated and should no longer be used.
Instead, use the CreateChart() method to create a chart.

### Close()

Closes an open application.

```csharp theme={null}
public void Close()
```

#### Examples

The following example demonstrates how to use the `Close` method:

```csharp theme={null}
applicationHandler = ApplicationHandler();
applicationHandler.Close();
```

#### Remarks

This method closes an open application.

### CloseDocument(string)

Closes an open document by its file path.

```csharp theme={null}
public void CloseDocument(string filepath)
```

#### Parameters

`filepath` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file path of the document to be closed.

#### Examples

The following example demonstrates how to use the `CloseDocument` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
applicationHandler.CloseDocument(filepath);
```

#### Remarks

This method closes an open document by its file path.

### ClosePage(Guid)

Closes an open page by its ID.

```csharp theme={null}
public void ClosePage(Guid id)
```

#### Parameters

`id` [Guid](https://learn.microsoft.com/dotnet/api/system.guid)

The ID of the page to be closed.

#### Examples

The following example demonstrates how to use the `ClosePage` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
document = applicationHandler.GetDocument(filepath);
page2 = applicationHandler.AddPage("page2");
page3 = applicationHandler.AddPage("page3");
activePage = applicationHandler.GetActivePage();;
applicationHandler.ClosePage(activePage.ID);
```

#### Remarks

This method closes an open page by its ID.

### ClosePage(string)

Closes an open page by its name.

```csharp theme={null}
public void ClosePage(string name)
```

#### Parameters

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the page to be closed.

#### Examples

The following example demonstrates how to use the `ClosePage` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
document = applicationHandler.GetDocument(filepath);
page2 = applicationHandler.AddPage("page2");
page3 = applicationHandler.AddPage("page3");
activePage = applicationHandler.GetActivePage();;
applicationHandler.ClosePage("page2");
```

#### Remarks

This method closes an open page by its name.

### ExportImage(IView, string, ImageFormat, double?, double?)

Exports the current image to a specified file format. This function saves the image to the given file path.

```csharp theme={null}
public void ExportImage(IView viewViewModel, string filepath, ImageFormat format, double? width = null, double? height = null)
```

#### Parameters

`viewViewModel` IView

Represents the target to be captured.

`filepath` [string](https://learn.microsoft.com/dotnet/api/system.string)

The path where the image file will be saved.

`format` ImageFormat

The format in which the image will be saved. Supported formats are Png, Jpeg, and Bmp.
The available options are:
<ul><li>Bmp</li><li>Jpeg</li><li>Png</li></ul>

`width` [double](https://learn.microsoft.com/dotnet/api/system.double)?

The optional width for the exported image. If not specified, the original width is used.

`height` [double](https://learn.microsoft.com/dotnet/api/system.double)?

The optional height for the exported image. If not specified, the original height is used.

#### Examples

The following example demonstrates how to use the `ExportImage` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
chartview = applicationHandler.AddPlotView();
applicationHandler.ExportImage(chartview, "image.png", ImageFormat.Png, 1920, 1080)
```

#### Remarks

This method allows you to export an image to a desired file path in a specified format. Supported formats are
Png, Jpeg, and Bmp. You can also specify the desired dimensions for the exported image. If width or height is
not provided, the original dimensions of the image will be used.

### ExportImage(IView, string, ExportType, double?, double?)

Exports the current image to a specified file format. This function saves the image to the given file path.

```csharp theme={null}
[Obsolete]
public void ExportImage(IView lineViewModel, string filepath, ExportType exportType, double? width = null, double? height = null)
```

#### Parameters

`lineViewModel` IView

The view model to be exported.

`filepath` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file path where the image will be saved.

`exportType` ExportType

The type of export format (e.g., PNG, JPEG).

`width` [double](https://learn.microsoft.com/dotnet/api/system.double)?

The optional width of the exported image. If not specified, the default width is used.

`height` [double](https://learn.microsoft.com/dotnet/api/system.double)?

The optional height of the exported image. If not specified, the default height is used.

#### Examples

The following example demonstrates how to use the deprecated `ExportImage` method:

```csharp theme={null}
```

#### Remarks

This method exports the current view to an image file. However, this method is deprecated and should no longer be used.

### GetActiveAnimationView()

Retrieves the active animation view from the current page.

```csharp theme={null}
[Obsolete]
public IOperationsAnimation GetActiveAnimationView()
```

#### Returns

IOperationsAnimation

An instance of [IOperationsAnimation](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IOperationsAnimation.md) representing the active animation view if it exists; otherwise, `null`.

#### Examples

The following example demonstrates how to use the deprecated `GetActiveAnimationView` method and the new method in `IPage`:

```csharp theme={null}
```

#### Remarks

This method retrieves the active animation view from the current page if it exists. However, this method is deprecated and should no longer be used.
Instead, use the new method provided in the [IPage](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IPage.md) interface.

### GetActivePage()

Retrieves the active page.

```csharp theme={null}
public IPage GetActivePage()
```

#### Returns

IPage

An instance of [IPage](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IPage.md) representing the active page if one exists; otherwise, `null`.

#### Examples

The following example demonstrates how to use the `GetActivePage` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
document = applicationHandler.GetDocument(filepath);
page2 = applicationHandler.AddPage("page2");
page3 = applicationHandler.AddPage("page3");
activePage = applicationHandler.GetActivePage();;
```

#### Remarks

This method searches for the currently active page among all pages. If no active page is found, the method returns `null`.

### GetActivePlotView()

Retrieves the active chart view from the current page.

```csharp theme={null}
[Obsolete]
public IOperationsLine2DViewModelBase GetActivePlotView()
```

#### Returns

IOperationsLine2DViewModelBase

An instance of [IOperationsLine2DViewModelBase](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IOperationsLine2DViewModelBase.md) representing the active chart view if it exists; otherwise, `null`.

#### Examples

The following example demonstrates how to use the deprecated `GetActivePlotView` method and the new method in `IPage`:

```csharp theme={null}
```

#### Remarks

This method retrieves the active chart view from the current page if it exists. However, this method is deprecated and should no longer be used.
Instead, use the new method provided in the [IPage](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IPage.md) interface.

### GetDocument(string)

Retrieves an open document by its file path.

```csharp theme={null}
public IOperationDocument GetDocument(string filepath)
```

#### Parameters

`filepath` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file path of the document to be retrieved.

#### Returns

IOperationDocument

An instance of IOperationDocument representing the document if it is open; otherwise, `null`.

#### Examples

The following example demonstrates how to use the `GetDocument` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
document = applicationHandler.GetDocument(filepath);
```

#### Remarks

This method searches for an open document with the specified file path. If no such document is found, the method returns `null`.

### GetPage(string)

Retrieves a page by its name.

```csharp theme={null}
public IPage GetPage(string name)
```

#### Parameters

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the page to be retrieved.

#### Returns

IPage

An instance of [IPage](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IPage.md) representing the page if it is found; otherwise, `null`.

#### Examples

The following example demonstrates how to use the `GetPage` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
document = applicationHandler.GetDocument(filepath);
applicationHandler.AddPage("page2");
applicationHandler.AddPage("page3");
page2 = applicationHandler.GetPage("page2");
```

#### Remarks

This method searches for a page with the specified name. If no such page is found, the method returns `null`.

### GetPage(Guid)

Retrieves a page by its ID.

```csharp theme={null}
public IPage GetPage(Guid id)
```

#### Parameters

`id` [Guid](https://learn.microsoft.com/dotnet/api/system.guid)

The ID of the page to be retrieved.

#### Returns

IPage

An instance of [IPage](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IPage.md) representing the page if it is found; otherwise, `null`.

#### Examples

The following example demonstrates how to use the `GetPage` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
document = applicationHandler.GetDocument(filepath);
page2 = applicationHandler.AddPage("page2");
page3 = applicationHandler.AddPage("page3");
page = applicationHandler.GetPage(page2.ID);
```

#### Remarks

This method searches for a page with the specified ID. If no such page is found, the method returns `null`.

### GetPages()

Retrieves all currently created pages.

```csharp theme={null}
public IPage[] GetPages()
```

#### Returns

IPage\[]

An array of [IPage](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IPage.md) instances representing all currently created pages.

#### Examples

The following example demonstrates how to use the `GetPages` method:

```csharp theme={null}
filepath = r'';
filepaths = List[str](1);
filepaths.Add(filepath);
applicationHandler = ApplicationHandler();
applicationHandler.AddDocument(filepaths);
document = applicationHandler.GetDocument(filepath);
page2 = applicationHandler.AddPage("page2");
page3 = applicationHandler.AddPage("page3");
activePage = applicationHandler.GetActivePage();;
pages = applicationHandler.GetPages();
```

#### Remarks

This method retrieves all currently created pages.

### GetView(int)

Retrieves a view by its ID.

```csharp theme={null}
[Obsolete]
public IView GetView(int id)
```

#### Parameters

`id` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The ID of the view to be retrieved.

#### Returns

IView

An instance of [IView](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IView.md) representing the view if it is found; otherwise, `null`.

#### Examples

The following example demonstrates how to use the deprecated `GetView` method and the new `GetView` method in `IPage`:

```csharp theme={null}
```

#### Remarks

This method retrieves a view by its ID. However, this method is deprecated and should no longer be used.
The functionality has been moved to the GetView() method.

### GetView(string)

Retrieves a view by its name.

```csharp theme={null}
[Obsolete]
public IView GetView(string name)
```

#### Parameters

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the view to be retrieved.

#### Returns

IView

An instance of [IView](https://developer.synopsys.com/docs/motion/motion-standalone-postprocessor-c-sharp-library/2025-r1/lib/VM.Operations.Post.Interfaces.IView.md) representing the view if it is found; otherwise, `null`.

#### Examples

The following example demonstrates how to use the deprecated `GetView` method and the new `GetView` method in `IPage`:

```csharp theme={null}
```

#### Remarks

This method retrieves a view by its name. However, this method is deprecated and should no longer be used.
The functionality has been moved to the GetView() method.

### ImportNumeric(IOperationsLine2DViewModelBase, string, List\<INumericParameter>)

Import the numeric data from the file.​

```csharp theme={null}
public void ImportNumeric(IOperationsLine2DViewModelBase lineViewModel, string filepath, List<INumericParameter> targets)
```

#### Parameters

`lineViewModel` IOperationsLine2DViewModelBase

The target plot view of the curve to import a numeric data​.

`filepath` [string](https://learn.microsoft.com/dotnet/api/system.string)

The path to the file containing the exported curves.

`targets` [List](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)\<INumericParameter>

A list of INumericParameter objects that specify the parameters for the curves to be created.

#### Examples

The following example demonstrates how to use the `ImportNumeric` method:

```csharp theme={null}
filepath = "result file path"
applicationHandler = ApplicationHandler();
page = applicationHandler.GetPage("page1");
chart = page.CreateChart("CurveChart");
chart.ExportAllCurves(r"D:\exportaAllCurves.txt");
parameters = List[INumericParameter](2);
parameter = NumericParameter();
parameter.Name = r'Curve2 : X(Hz)';
parameter.TargetX = r'X(sec)';
parameter.TargetY = r'Y(Hz)';
parameters.Add(parameter);
applicationHandler.ImportNumeric(chart, r"D:\exportaAllCurves.txt", parameters);
```

#### Remarks

This method reads curve data from the specified file and adds the corresponding curves to the chart view.
Each INumericParameter in the `targets` list contains the following properties:
<ul><li>NameThe name of the curve to be created.</li><li>TargetXThe path to the data for the X-axis.</li><li>TargetYThe path to the data for the Y-axis.</li></ul>

### RemoveDocument(string)

Closes an open document by its file path.

```csharp theme={null}
[Obsolete("This method is considered outdated and its use is discouraged. It may be removed in future versions, so it is advisable to use the CloseDocument function instead.", true)]
public void RemoveDocument(string filepath)
```

#### Parameters

`filepath` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file path of the document to be closed.

#### Examples

The following example demonstrates how to use the deprecated `RemoveDocument` method and the new `CloseDocument` method:

```csharp theme={null}
```

#### Remarks

This method closes an open document by its file path. However, this method is deprecated and should no longer be used.
Instead, use the CloseDocument() method to close documents.

### RemoveView(string)

Removes a view by its name.

```csharp theme={null}
[Obsolete("This method is considered outdated and its use is discouraged. It may be removed in future versions, so it is advisable to use the CloseView function of the Page class instead.", true)]
public void RemoveView(string viewName)
```

#### Parameters

`viewName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the view to be removed.

#### Examples

The following example demonstrates how to use the deprecated `RemoveView` method and the new `RemoveView` method in `IPage`:

```csharp theme={null}
```

#### Remarks

This method removes a view by its name if it exists. However, this method is deprecated and should no longer be used.
The functionality has been moved to the CloseView() method.
