blob: f3b0237d8e2e5836425fede0b050571109fb588f (
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
using LiteDB;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Enumerations;
namespace Tango.BL.Entities
{
public class TangoUpdate : TangoUpdateBase
{
public static event EventHandler<TangoUpdate> TangoUpdateSaved;
[NotMapped]
[JsonIgnore]
public TangoUpdateStatuses UpdateStatus
{
get
{
return (TangoUpdateStatuses)Status;
}
set
{
Status = (int)value;
RaisePropertyChangedAuto();
}
}
[NotMapped]
[JsonIgnore]
public bool IsSetup
{
get
{
return
UpdateStatus == TangoUpdateStatuses.SetupStarted ||
UpdateStatus == TangoUpdateStatuses.SetupCompleted ||
UpdateStatus == TangoUpdateStatuses.SetupFailed;
}
}
[NotMapped]
[JsonIgnore]
public bool IsUpdate
{
get
{
return
UpdateStatus == TangoUpdateStatuses.UpdateStarted ||
UpdateStatus == TangoUpdateStatuses.UpdateCompleted ||
UpdateStatus == TangoUpdateStatuses.UpdateFailed;
}
}
[NotMapped]
[JsonIgnore]
public bool IsDataBase
{
get
{
return
UpdateStatus == TangoUpdateStatuses.DatabaseStarted ||
UpdateStatus == TangoUpdateStatuses.DatabaseCompleted ||
UpdateStatus == TangoUpdateStatuses.DatabaseFailed;
}
}
[NotMapped]
[JsonIgnore]
public bool IsSynchronization
{
get
{
return
UpdateStatus == TangoUpdateStatuses.SynchronizationStarted ||
UpdateStatus == TangoUpdateStatuses.SynchronizationCompleted ||
UpdateStatus == TangoUpdateStatuses.SynchronizationFailed;
}
}
[NotMapped]
[JsonIgnore]
public bool IsOfflineUpdate
{
get
{
return
UpdateStatus == TangoUpdateStatuses.OfflineUpdateStarted ||
UpdateStatus == TangoUpdateStatuses.OfflineUpdateCompleted ||
UpdateStatus == TangoUpdateStatuses.OfflineUpdateFailed;
}
}
[NotMapped]
[JsonIgnore]
public bool IsOfflineFirmwareUpgrade
{
get
{
return
UpdateStatus == TangoUpdateStatuses.OfflineFirmwareUpgradeStarted ||
UpdateStatus == TangoUpdateStatuses.OfflineFirmwareUpgradeCompleted ||
UpdateStatus == TangoUpdateStatuses.OfflineFirmwareUpgradeFailed;
}
}
[NotMapped]
[JsonIgnore]
public bool IsStarted
{
get
{
return
UpdateStatus == TangoUpdateStatuses.SetupStarted ||
UpdateStatus == TangoUpdateStatuses.UpdateStarted ||
UpdateStatus == TangoUpdateStatuses.DatabaseStarted ||
UpdateStatus == TangoUpdateStatuses.SynchronizationStarted ||
UpdateStatus == TangoUpdateStatuses.OfflineUpdateStarted ||
UpdateStatus == TangoUpdateStatuses.OfflineFirmwareUpgradeStarted;
}
}
[NotMapped]
[JsonIgnore]
public bool IsCompleted
{
get
{
return
UpdateStatus == TangoUpdateStatuses.SetupCompleted ||
UpdateStatus == TangoUpdateStatuses.UpdateCompleted ||
UpdateStatus == TangoUpdateStatuses.DatabaseCompleted ||
UpdateStatus == TangoUpdateStatuses.SynchronizationCompleted ||
UpdateStatus == TangoUpdateStatuses.OfflineUpdateCompleted ||
UpdateStatus == TangoUpdateStatuses.OfflineFirmwareUpgradeCompleted;
}
}
[NotMapped]
[JsonIgnore]
public bool IsFailed
{
get
{
return
UpdateStatus == TangoUpdateStatuses.SetupFailed ||
UpdateStatus == TangoUpdateStatuses.UpdateFailed ||
UpdateStatus == TangoUpdateStatuses.DatabaseFailed ||
UpdateStatus == TangoUpdateStatuses.SynchronizationFailed ||
UpdateStatus == TangoUpdateStatuses.OfflineUpdateFailed ||
UpdateStatus == TangoUpdateStatuses.OfflineFirmwareUpgradeFailed;
}
}
[NotMapped]
[JsonIgnore]
[BsonIgnore]
public String VersionAndTag
{
get { return ApplicationVersion + (ApplicationVersionTag.IsNotNullOrEmpty() ? $" [{ApplicationVersionTag}]" : String.Empty); }
}
protected override void OnStatusChanged(int status)
{
base.OnStatusChanged(status);
RaisePropertyChanged(nameof(UpdateStatus));
}
public override void OnBeforeSave()
{
base.OnBeforeSave();
TangoUpdateSaved?.Invoke(this, this);
}
}
}
|