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
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample indicator shows how to use the API Application object nad display its properties data inside a chart control
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class ApplicationSample : Indicator
     {
         private TextBlock _userTimeOffsetTextBlock, _themeTextBlock;
         [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 += Application_ColorThemeChanged;
             Application.UserTimeOffsetChanged += Application_UserTimeOffsetChanged;
             DrawApplicationInfo();
         }
         private void Application_UserTimeOffsetChanged(UserTimeOffsetChangedEventArgs obj)
         {
             _userTimeOffsetTextBlock.Text = obj.UserTimeOffset.ToString();
         }
         private void Application_ColorThemeChanged(ColorThemeChangeEventArgs obj)
         {
             _themeTextBlock.Text = obj.ColorTheme.ToString();
         }
         private void DrawApplicationInfo()
         {
             var grid = new Grid(3, 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);
             Chart.AddControl(grid);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

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

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;