You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/apidocs-mxsdk/apidocs/studio-pro-10/extensibility-api/csharp/extensibility-api-howtos/create-modal-web-view.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,13 @@ weight: 7
7
7
8
8
## Introduction
9
9
10
-
This how-to describes how you can create a new web view hosted inside a modal dialog. You will then open the modal from a new menu item.
10
+
This how-to describes how to create a new web view hosted inside a modal dialog, and how to open the modal from a new menu item.
11
11
12
12
You can download the example in this how-to in [this GitHub repository](https://github.com/mendix/ExtensionAPI-Samples)
13
13
14
14
## Adding a View Model for Your New Modal
15
15
16
-
Add a view model for your new model. The view model takes care of the messages and the overall lifecycle of the modal web view.
16
+
Create a view model for your new model to manage the lifecycle and messaging of the modal web view.
17
17
18
18
```csharp
19
19
namespaceMyCompany.MyProject.MendixExtension;
@@ -55,7 +55,7 @@ class MyModalWebViewViewModel(
55
55
56
56
## Adding a Controller Class
57
57
58
-
You are creating a controller to delegate specific tasks, allowing you to keep the menu item free of unrelated business logic, for instance, conducting basic setup and displaying the web view. This approach is recommended, but not mandatory.
58
+
Create a controller to delegate tasks, allowing you to keep the menu item free of unrelated business logic (for example, conducting basic setup and displaying the web view). This approach is recommended, but not mandatory.
59
59
60
60
{{% alert color="info" %}}
61
61
Specify both `Height` and `Width` properties; otherwise, they will default to 0,0.
@@ -82,7 +82,7 @@ class MyModalWebViewController(IDialogService dialogService, IMessageBoxService
82
82
83
83
## Adding a Content Server
84
84
85
-
To open static pages, you need to source them from either a file system path or via the `WebServerExtension` route. This document covers the latter, as this is the preferred way to provide static web content to an extension.
85
+
Use the `WebServerExtension` routeto provide static web content to the extension.
86
86
87
87
```csharp
88
88
namespaceMyCompany.MyProject.MendixExtension;
@@ -150,7 +150,7 @@ class ContentServer : WebServerExtension
150
150
151
151
## Adding a Menu Item That Opens the Modal Dialog
152
152
153
-
Finally, you need to add a menu item to open the dialog. Replace the contents of `MyMenuExtension.cs` with the code below:
153
+
Replace the contents of `MyMenuExtension.cs` with the code below to add a menu item to open the dialog:
154
154
155
155
```csharp
156
156
namespaceMyCompany.MyProject.MendixExtension;
@@ -166,6 +166,8 @@ class MyMenuExtension(MyModalWebViewController myModalWebViewController) : MenuE
166
166
}
167
167
```
168
168
169
-
These changes inject your new controller class into the `MyMenuExtension` class. Then you add a new menu item called `Create Entity From Dialog` and call the controller's `ShowDialog` method.
169
+
This code injects your controller class into the `MyMenuExtension` class. It adds a new menu item called `Create Entity From Dialog` and calls the controller's `ShowDialog` method.
170
170
171
-
Note that in this example, the parameter `currentApp` will be necessary, if the dialog needs to interact with the model. Additionally, `WebServerBaseUrl` is crucial, because, without the base path, navigating to the route you defined in the web server extension would not be possible.
171
+
{{% alert type="info" %}}
172
+
In this example, the `currentApp` parameter is required if the dialog needs to interact with the model. Additionally, `WebServerBaseUrl` is crucial; without the base path, navigating to the route defined in the web server extension would not be possible.
0 commit comments