Difference between revisions of "Code Editor"
(→Start workflow snippet) |
|||
Line 4: | Line 4: | ||
When using the Code Editor, basic programming skills in [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) Microsoft's C#] are certainly beneficial. | When using the Code Editor, basic programming skills in [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) Microsoft's C#] are certainly beneficial. | ||
+ | |||
+ | |||
+ | |||
==Basics== | ==Basics== |
Revision as of 08:18, 23 April 2013
Contents
Purpose
The Code Editor is designed to display and edit the runtime behavior of a single UBIK® object. Technically, it reads the definition of overrideable properties and methods of the context object (directly from the context object if it is of type MetaClass, otherwise it gets the MetaClass of the context object and reads the definition from there).
When using the Code Editor, basic programming skills in Microsoft's C# are certainly beneficial.
Basics
Appearance
Code controls
The control reads the definition from the current context object and displays a code editing box for each eligible property or method, its appearance depending on status of the actual property/method:
Captions
Per default, each Code control shows the name of the respective property/method as its caption.
Tooltips
When hovering over the expand/collapse button of a code control, a Tooltip with its code will appear.
Drag & Drop
The Code Editor does not support Drag&Drop operations.
Toolbar
The Code Editor features a toolbar with the following items, from left to right:
Item | Purpose |
---|---|
View Style | Indicates or changes the View Style of the control; changing it will result in reloading of the control |
Insert code snippet... | Displays a sub menu with predefined UBIK® code snippets; selecting one will insert the respective code at the current caret position |
Navigate to context object | Attempts to navigate to the current context MetaClass |
Save | Saves the context object. |
Delete | Deletes the custom code and replaces it with the default code |
This control doesn't feature any context menu yet.
View Styles
The Code Editor has four different View Styles, each of them providing different views and functionality.
Events
In this view mode you can override certain events that are thrown by an UBIK® object. This means that custom code can be executed once the event raises.
Methods
In this view mode you can override certain methods that are exposed by an UBIK® object.
MetaProperties
In this view mode you can override the code that is executed within the accessors of a UBIK® MetaProperty
Custom
In this view mode it is possible to store code which is not related to events, methods or MetaProperties but shall still be assembled with a MetaClass or with the entire customizing. Use this if you want to provide a code library or classes that shall be used by your custom event or property/method code.
Code snippets
Start workflow snippet
This snippet will insert the code to execute an UBIK® workflow synchronously, meaning in the same thread as the rest of the code is executed. So code execution will only continue after the workflow is finished. Example:
Dictionary<string, object> args = new Dictionary<string, object>();
args.Add("UBIKObject", this);
UBIK.WorkflowBase.Invoker.InvokeWorkflow(this.MetaClass.AllWorkflows.Find(p => p.ID == "2bf8f8e9-156d-4914-bd25-fd133148638d"), args);
//*** End of calling UBIK Workflow
This code locates the workflow object at the MetaClass of the object using its UID, loads the declared XAML code and sends it to the invoker. The calling object will be passed as first and only parameter UBIKObject.
If you need the workflow to be executed conditionally, just wrap the conditions (e.g. and if block around the generated snippet! |