@@ -11,12 +11,16 @@ namespace OneNoteServiceSamplesWinUniversal.DataModel
11
11
{
12
12
public class ItemPageModel : INotifyPropertyChanged
13
13
{
14
- private string _authUserName = null ; // Logged in user name
15
- private SampleDataItem _item = null ; // Info about the current item
16
- private object _apiResponse = null ; // Response from an API request - Either a ApiBaseResponse or a List<ApiBaseResponse>
17
- private ApiBaseResponse _selectedResponse = null ; // Holds a reference to the currently selected response
14
+ private string _authUserName = null ; // Logged in user name
15
+ private SampleDataItem _item = null ; // Info about the current item
16
+ private HubContext _userData = null ;
17
+ private object _apiResponse = null ;
18
+ // Response from an API request - Either a ApiBaseResponse or a List<ApiBaseResponse>
18
19
19
- public event PropertyChangedEventHandler PropertyChanged ; // Implements INotifyPropertyChanged for notifying the binding engine when an attribute changes
20
+ private ApiBaseResponse _selectedResponse = null ; // Holds a reference to the currently selected response
21
+
22
+ public event PropertyChangedEventHandler PropertyChanged ;
23
+ // Implements INotifyPropertyChanged for notifying the binding engine when an attribute changes
20
24
21
25
/// <summary>
22
26
// NotifyPropertyChanged will fire the PropertyChanged event,
@@ -32,10 +36,7 @@ public void NotifyPropertyChanged(string propertyName)
32
36
33
37
public string AuthUserName
34
38
{
35
- get
36
- {
37
- return _authUserName ;
38
- }
39
+ get { return _authUserName ; }
39
40
40
41
set
41
42
{
@@ -62,10 +63,7 @@ public string SignInButtonTitle
62
63
63
64
public SampleDataItem Item
64
65
{
65
- get
66
- {
67
- return _item ;
68
- }
66
+ get { return _item ; }
69
67
70
68
set
71
69
{
@@ -85,14 +83,18 @@ public object ApiResponse
85
83
86
84
if ( _apiResponse != null )
87
85
{
88
- if ( _apiResponse is ApiBaseResponse )
86
+ var response = _apiResponse as ApiBaseResponse ;
87
+ if ( response != null )
89
88
{
90
- selectedResponse = _apiResponse as ApiBaseResponse ;
89
+ selectedResponse = response ;
91
90
}
92
91
else
93
92
{
94
- List < ApiBaseResponse > multipleResponses = _apiResponse as List < ApiBaseResponse > ;
95
- selectedResponse = multipleResponses [ 0 ] ;
93
+ var multipleResponses = _apiResponse as List < ApiBaseResponse > ;
94
+ if ( multipleResponses != null )
95
+ {
96
+ selectedResponse = multipleResponses [ 0 ] ;
97
+ }
96
98
}
97
99
}
98
100
@@ -105,15 +107,13 @@ public object ApiResponse
105
107
NotifyPropertyChanged ( "IsClientUrlAvailable" ) ;
106
108
NotifyPropertyChanged ( "ResponseList" ) ;
107
109
NotifyPropertyChanged ( "SelectedResponse" ) ;
110
+ NotifyPropertyChanged ( "CorrelationId" ) ;
108
111
}
109
112
}
110
113
111
114
public ApiBaseResponse SelectedResponse
112
115
{
113
- get
114
- {
115
- return _selectedResponse ;
116
- }
116
+ get { return _selectedResponse ; }
117
117
118
118
set
119
119
{
@@ -123,6 +123,17 @@ public ApiBaseResponse SelectedResponse
123
123
}
124
124
}
125
125
126
+ public HubContext UserData
127
+ {
128
+ get { return _userData ; }
129
+
130
+ set
131
+ {
132
+ _userData = value ;
133
+ NotifyPropertyChanged ( "TimeStamp" ) ;
134
+ }
135
+ }
136
+
126
137
public string StatusCode
127
138
{
128
139
get
@@ -135,7 +146,7 @@ public string StatusCode
135
146
136
147
if ( statusCode != 0 )
137
148
{
138
- statusCodeString = string . Format ( "{0}-{1}" , ( int ) statusCode , statusCode . ToString ( ) ) ;
149
+ statusCodeString = string . Format ( "{0}-{1}" , ( int ) statusCode , statusCode . ToString ( ) ) ;
139
150
}
140
151
}
141
152
@@ -175,10 +186,7 @@ public Thickness BodyBorderThikness
175
186
176
187
public bool IsResponseAvailable
177
188
{
178
- get
179
- {
180
- return _apiResponse != null ;
181
- }
189
+ get { return _apiResponse != null ; }
182
190
}
183
191
184
192
public Visibility IsResponseListAvailable
@@ -198,10 +206,7 @@ public Visibility IsResponseListAvailable
198
206
199
207
public List < ApiBaseResponse > ResponseList
200
208
{
201
- get
202
- {
203
- return _apiResponse as List < ApiBaseResponse > ;
204
- }
209
+ get { return _apiResponse as List < ApiBaseResponse > ; }
205
210
}
206
211
207
212
public Visibility IsClientUrlAvailable
@@ -248,5 +253,23 @@ public string OneNoteWebUrl
248
253
return webUrl ;
249
254
}
250
255
}
256
+
257
+ public string CorrelationId
258
+ {
259
+ get
260
+ {
261
+ return _selectedResponse != null && ! string . IsNullOrEmpty ( _selectedResponse . CorrelationId )
262
+ ? _selectedResponse . CorrelationId
263
+ : string . Empty ;
264
+ }
265
+ }
266
+
267
+ public string TimeStamp
268
+ {
269
+ get
270
+ {
271
+ return _userData != null ? _userData . TimeStamp . ToString ( ) : string . Empty ;
272
+ }
273
+ }
251
274
}
252
275
}
0 commit comments