blob: 86a9943df2e8db8d4db9e1381ed12a7386a19d00 (
plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.Core;
using Tango.Core.DI;
using Tango.FSE.BL;
using Tango.FSE.Common.Authentication;
using Tango.FSE.Common.Connection;
using Tango.FSE.Common.Notifications;
using Tango.PMR.Diagnostics;
namespace Tango.FSE.Diagnostics.Project
{
public abstract class DiagnosticsWidget : ExtendedObject
{
[JsonIgnore]
[TangoInject(TangoInjectMode.WhenAvailable)]
protected IAuthenticationProvider AuthenticationProvider { get; set; }
[JsonIgnore]
[TangoInject(TangoInjectMode.WhenAvailable)]
protected IMachineProvider MachineProvider { get; set; }
[JsonIgnore]
[TangoInject(TangoInjectMode.WhenAvailable)]
protected INotificationProvider NotificationProvider { get; set; }
private FSEServicesContainer _services;
[JsonIgnore]
[TangoInject(TangoInjectMode.WhenAvailable)]
public FSEServicesContainer Services
{
get { return _services; }
set { _services = value; OnServicesAvailable(); }
}
public String ID { get; set; }
public int Column { get; set; }
public int Row { get; set; }
public int ColumnSpan { get; set; }
public int RowSpan { get; set; }
public double Width { get; set; }
public double Height { get; set; }
private bool _isVisible;
[JsonIgnore]
public bool IsVisible
{
get { return _isVisible; }
set
{
if (_isVisible != value)
{
_isVisible = value;
OnVisibleChanged(_isVisible);
RaisePropertyChangedAuto();
}
}
}
[JsonIgnore]
public abstract String DisplayName
{
get;
}
public DiagnosticsWidget()
{
ID = Guid.NewGuid().ToString();
Width = 100;
Height = 100;
TangoIOC.Default.Inject(this);
}
protected virtual void OnServicesAvailable()
{
}
public virtual void OnDiagnosticsData(DiagnosticsPackage package)
{
//Do Nothing.
}
protected virtual void OnVisibleChanged(bool isVisible)
{
//Called when the widget visibility changed.
}
public abstract FrameworkElement GetView();
public virtual Task Init()
{
return Task.FromResult(true);
}
}
}
|