Skip to content

Application

Summary

Represents the application.

Signature

1
public abstract interface Application

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 using cAlgo.API;
 namespace cAlgo;
 [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
 public class ApplicationSample : Indicator
 {
     private TextBlock _userTimeOffsetTextBlock, _themeTextBlock, _languageTextBlock;
     [Parameter("Horizontal Alignment", DefaultValue = HorizontalAlignment.Center)]
     public HorizontalAlignment HorizontalAlignment { get; set; }
     [Parameter("Vertical Alignment", DefaultValue = VerticalAlignment.Center)]
     public VerticalAlignment VerticalAlignment { get; set; }
     protected override void Initialize()
     {
         Application.ColorThemeChanged += args => _themeTextBlock.Text = args.ColorTheme.ToString();
         Application.UserTimeOffsetChanged += args => _userTimeOffsetTextBlock.Text = args.UserTimeOffset.ToString();
         Application.LanguageChanged += args => _languageTextBlock.Text = Application.Language.TwoLetterCode;
         DrawApplicationInfo();
     }
    private void DrawApplicationInfo()
    {
        var grid = new Grid(5, 2)
        {
            BackgroundColor = Color.Goldenrod,
            HorizontalAlignment = HorizontalAlignment,
            VerticalAlignment = VerticalAlignment
        };
        grid.AddChild(new TextBlock
        {
            Text = "Version",
            Margin = 5
        }, 0, 0);
        grid.AddChild(new TextBlock
        {
            Text = Application.Version.ToString(),
            Margin = 5
        }, 0, 1);
        grid.AddChild(new TextBlock
        {
            Text = "Theme",
            Margin = 5
        }, 1, 0);
        _themeTextBlock = new TextBlock
        {
            Text = Application.ColorTheme.ToString(),
            Margin = 5
        };
        grid.AddChild(_themeTextBlock, 1, 1);
        grid.AddChild(new TextBlock
        {
            Text = "User Time Offset",
            Margin = 5
        }, 2, 0);
        _userTimeOffsetTextBlock = new TextBlock
        {
            Text = Application.UserTimeOffset.ToString(),
            Margin = 5
        };
        grid.AddChild(_userTimeOffsetTextBlock, 2, 1);
        grid.AddChild(new TextBlock
        {
            Text = "Environment Type",
            Margin = 5
        }, 3, 0);
        grid.AddChild(new TextBlock
        {
            Text = Application.EnvironmentType.ToString(),
            Margin = 5
        }, 3, 1);
        grid.AddChild(new TextBlock
        {
            Text = "Language",
            Margin = 5
        }, 4, 0);
        _languageTextBlock = new TextBlock
        {
            Text = Application.Language.TwoLetterCode,
           Margin = 5
        };
        grid.AddChild(_languageTextBlock, 4, 1);
        Chart.AddControl(grid);
    }
    public override void Calculate(int index)
     {
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 import clr
 clr.AddReference("cAlgo.API")
 from cAlgo.API import *
 from System import Action
 def getTextBlock(text):
     textBlock = TextBlock()
     textBlock.Text = text
     textBlock.Margin = Thickness(5)
     return textBlock
 class Test():
     def initialize(self):
         api.Application.ColorThemeChanged += self.on_application_color_theme_changed
         api.Application.UserTimeOffsetChanged += self.on_application_user_time_offset_changed
         api.Application.LanguageChanged += self.on_application_language_changed
         self.draw_application_info()
     def draw_application_info(self):
         grid = Grid(5, 2)
         grid.BackgroundColor = Color.Goldenrod
         grid.HorizontalAlignment = HorizontalAlignment.Center
         grid.VerticalAlignment = VerticalAlignment.Center
         grid.AddChild(getTextBlock("Version"), 0, 0)
         grid.AddChild(getTextBlock(str(api.Application.Version)), 0, 1)
         grid.AddChild(getTextBlock("Theme"), 1, 0)
         self.themeTextBlock = getTextBlock(str(api.Application.ColorTheme))
         grid.AddChild(self.themeTextBlock, 1, 1)
         grid.AddChild(getTextBlock("User Time Offset"), 2, 0)
         self.userTimeOffsetTextBlock = getTextBlock(str(api.Application.UserTimeOffset))
         grid.AddChild(self.userTimeOffsetTextBlock, 2, 1)
         grid.AddChild(getTextBlock("Environment Type"), 3, 0)
         grid.AddChild(getTextBlock(str(api.Application.EnvironmentType)), 3, 1)
         grid.AddChild(getTextBlock("Language"), 4, 0)
         self.languageTextBlock = getTextBlock(api.Application.Language.TwoLetterCode)
         grid.AddChild(self.languageTextBlock, 4, 1)
         api.Chart.AddControl(grid)
     def on_application_user_time_offset_changed(self, obj):
         self.userTimeOffsetTextBlock.Text = str(obj.UserTimeOffset)
     def on_application_color_theme_changed(self, obj):
         self.themeTextBlock.Text = str(obj.ColorTheme)
     def on_application_language_changed(self, args):
         self.languageTextBlock.Text = api.Application.Language.TwoLetterCode

Properties

ColorTheme

Summary

Gets the color theme.

Signature

1
public abstract ColorTheme ColorTheme {get;}

Return Value

ColorTheme

Version

Summary

Gets the version.

Signature

1
public abstract Version Version {get;}

Return Value

Version

UserTimeOffset

Summary

Gets user time offset.

Signature

1
public abstract TimeSpan UserTimeOffset {get;}

Return Value

TimeSpan

DrawingColor

Summary

Gets current drawing color.

Signature

1
public abstract Color DrawingColor {get;}

Return Value

Color

EnvironmentType

Summary

Gets the environment type.

Signature

1
public abstract EnvironmentType EnvironmentType {get;}

Return Value

EnvironmentType

Language

Summary

Gets the current language.

Signature

1
public abstract Language Language {get;}

Return Value

Language

Draggables

Summary

Gets application draggables.

Signature

1
public abstract ApplicationDraggables Draggables {get;}

Return Value

ApplicationDraggables

Events

ColorThemeChanged

Summary

Occurs when color theme has changed.

Signature

1
public abstract event Action<ColorThemeChangeEventArgs> ColorThemeChanged;

UserTimeOffsetChanged

Summary

Occurs when user time offset has changed.

Signature

1
public abstract event Action<UserTimeOffsetChangedEventArgs> UserTimeOffsetChanged;

DrawingColorChanged

Summary

Occurs when DrawingColor has changed.

Signature

1
public abstract event Action<DrawingColorChangedEventArgs> DrawingColorChanged;

LanguageChanged

Summary

Occurs when Language has changed.

Signature

1
public abstract event Action<LanguageChangedEventArgs> LanguageChanged;