Difference between revisions of "HowTo:Inject UI into UBIK Studio"
| Line 38: | Line 38: | ||
[[File:InjectedButton.png|thumb|left|290px|Injected button]]<br><br><br><br><br><br><br><br><br><br><br> | [[File:InjectedButton.png|thumb|left|290px|Injected button]]<br><br><br><br><br><br><br><br><br><br><br> | ||
=== Implementation === | === Implementation === | ||
| − | 1. | + | 1. Create or reuse a .Net library (DLL) project - it doesn't have to be a {{UBIK}} Module.<br> |
| − | + | 2. Add the designated window as a class deriving from System.Windows.Window to the project.<br> | |
| + | 3. Create a new class.<br> | ||
| + | 4. Implement the inferface IUBIKWindowFactory for the new class.<br> | ||
| + | 5. For automatic injection, add the "Export" Attribute with the "IUBIKWindowFactory" type parameter to the designated class.<br> | ||
<syntaxhighlight lang="csharp"> | <syntaxhighlight lang="csharp"> | ||
[Export(typeof(IUBIKWindowFactory))] | [Export(typeof(IUBIKWindowFactory))] | ||
public class TestWindowFactory : IUBIKWindowFactory | public class TestWindowFactory : IUBIKWindowFactory | ||
{ | { | ||
| − | public Bitmap Icon => | + | public Bitmap Icon =>Properties.Resources.IntelligentAtelierImage; |
| − | public string Label => | + | public string Label => Properties.Resources.IntelligentAtelierLabel; |
public Window GetWindow(UBIKEnvironment env) | public Window GetWindow(UBIKEnvironment env) | ||
| Line 54: | Line 57: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | + | 6. The class now has a Icon and Label property.<br> | |
| − | 4. In the GetWindow | + | 7. Set the values for both properties. The icon and label can be loaded directly from the .NET project's resources. The button and the menu entry will then display these values. |
| − | + | 4. In the GetWindow method, return the window from step 2.<br> | |
| − | + | 7. Provide the updated DLL containing your UserControl in UBIK® Studio's [[Injection_Management#Injection_Folder.28s.29|Injection]] folder.<br> | |
| + | 8. After connecting to a database with UBIK® Studio, the new control can be accessed by the new button in the tool bar aswell as under menu entry "View".<br><br> | ||
<!-- DO NOT REMOVE THIS -->{{Template:HowTo/End}}<!-- DO NOT REMOVE THIS --> | <!-- DO NOT REMOVE THIS -->{{Template:HowTo/End}}<!-- DO NOT REMOVE THIS --> | ||
Revision as of 07:44, 17 June 2026
Since version 5.2 it is possible to inject UI into UBIK® Studio.
The injected UI can be displayed inside a User Control and or Window.
This article will help you to inject your UI!
See also
tbd.

