Jump to: navigation, search

Difference between revisions of "HowTo:Inject UI into UBIK Studio"


Line 6: Line 6:
 
<!-- DO NOT REMOVE THIS -->{{Template:HowTo/Begin}}<!-- DO NOT REMOVE THIS -->
 
<!-- DO NOT REMOVE THIS -->{{Template:HowTo/Begin}}<!-- DO NOT REMOVE THIS -->
 
= User Control =
 
= User Control =
=== Overview ===
+
===Goal===
The existing User Control list can be extended to provide additional controls.<br>
+
The goal is to extend the existing user control list with the injected user control.<br>
[[File:ControlDropDown.png|thumb|left|220px|Extended user control list]] <br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+
Every time you drag an instance to a new window, the list with the new control will show up
 +
 
 +
[[File:InjectedUserControl.png|thumb|left|735px|Extended user control list]] <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 
=== Implementation ===
 
=== Implementation ===
 
1. Paste your UserControl in the plugin solution.<br>
 
1. Paste your UserControl in the plugin solution.<br>
Line 32: Line 34:
 
=== Overview ===
 
=== Overview ===
 
A additional button can be added to the tool bar
 
A additional button can be added to the tool bar
[[File:InjectedButton.png|thumb|left|290px|Injected button]]<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. Paste your Window in the plugin solution.<br>
 
1. Paste your Window in the plugin solution.<br>

Revision as of 13:44, 16 June 2026

Wiki Under Construction Start.PNG

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!

[edit]

User Control

Goal

The goal is to extend the existing user control list with the injected user control.
Every time you drag an instance to a new window, the list with the new control will show up

Extended user control list





















Implementation

1. Paste your UserControl in the plugin solution.
2. Make your UserControl implements IUBIKEnvironmentControl and add the export.

[Export(typeof(IUBIKControl))]
public partial class TestUserControl: UserControl, IUBIKEnvironmentControl

3. The user control now has a property Description and Image.
4. Set the properties in the constructor of the User Control. The text of description and the image will show up in the User Control List.

  public TestUserControl()
  {
      InitializeComponent();
      Description = "test control";
      Image = image;
  }

5. After making the changes make sure to update the plugin in the injection folder.
6. When starting UBIK® Studio the new user control will show up in the list.

Window

Overview

A additional button can be added to the tool bar

Injected button











Implementation

1. Paste your Window in the plugin solution.
2. Create a new class that implements IUBIKWindowFactory.

[Export(typeof(IUBIKWindowFactory))]
public class TestWindowFactory : IUBIKWindowFactory
{
    public Bitmap Icon => Image;

    public string Label => "Test";

    public Window GetWindow(UBIKEnvironment env)
    {
        return new TestWindow(env);
    }
}

3. Assign values to the "Icon" and "Lable" properties they will be used for the button.
4. In the GetWindow Method return the window that you moved to the solution.
5. After making the changes, make sure to update the plugin in the injection folder.
6. When starting UBIK® Studio the new button will show up in the tool bar.