-
Notifications
You must be signed in to change notification settings - Fork 1
/
evententry.cs
838 lines (768 loc) · 31.5 KB
/
evententry.cs
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
/* Copyright (c) 2006-2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Change history
* Oct 13 2008 Joe Feser joseph.feser@gmail.com
* Converted ArrayLists and other .NET 1.1 collections to use Generics
* Combined IExtensionElement and IExtensionElementFactory interfaces
*
*/
using System;
using System.Xml;
using System.IO;
using System.Collections;
using Google.GData.Client;
using Google.GData.Extensions;
namespace Google.GData.Calendar {
//////////////////////////////////////////////////////////////////////
/// <summary>subelements definition for calendar-specific event entries
/// </summary>
//////////////////////////////////////////////////////////////////////
public class GCalNameTable {
/// <summary>syncEvent</summary>
public const string XmlSyncEventElement = "syncEvent";
/// <summary>sequence element</summary>
public const string XmlSequenceElement = "sequence";
/// <summary>uid element</summary>
public const string XmlUidElement = "uid";
/// <summary>guestsCanModify element</summary>
public const string XmlGuestsCanModifyElement = "guestsCanModify";
/// <summary>guestsCanInviteOthers element</summary>
public const string XmlGuestsCanInviteOthersElement = "guestsCanInviteOthers";
/// <summary>guestsCanSeeGuests element</summary>
public const string XmlGuestsCanSeeGuestsElement = "guestsCanSeeGuests";
}
/// <summary>
/// Indicates whether this is a sync scenario where we allow setting the gCal:uid, the gCal:sequence,
/// and the organizer of an event. This element makes sense only when inserting and updating
/// events. This element should primarily be used in a sync scenario.
/// </summary>
public class GCalSyncEvent : SimpleAttribute {
/// <summary>
/// default calendar access level constructor
/// </summary>
public GCalSyncEvent()
: base(GCalNameTable.XmlSyncEventElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal) {
}
/// <summary>
/// default calendar acccess level
/// constructor with an initial value
/// </summary>
/// <param name="initValue"></param>
public GCalSyncEvent(string initValue)
: base(GCalNameTable.XmlSyncEventElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal,
initValue) {
}
}
/// <summary>
/// Indicates the globally unique identifier (UID) of the event as defined in Section 4.8.4.7 of RFC 2445.
/// </summary>
public class GCalUid : SimpleAttribute {
/// <summary>
/// default calendar access level constructor
/// </summary>
public GCalUid()
: base(GCalNameTable.XmlUidElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal) {
}
/// <summary>
/// default calendar acccess level
/// constructor with an initial value
/// </summary>
/// <param name="initValue"></param>
public GCalUid(string initValue)
: base(GCalNameTable.XmlUidElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal,
initValue) {
}
}
/// <summary>
/// Indicates the revision sequence number of the event as defined in Section 4.8.7.4 of RFC 2445.
/// Must be non-negative.
/// </summary>
public class GCalSequence : SimpleAttribute {
/// <summary>
/// default calendar access level constructor
/// </summary>
public GCalSequence()
: base(GCalNameTable.XmlSequenceElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal) {
}
/// <summary>
/// default calendar acccess level
/// constructor with an initial value
/// </summary>
/// <param name="initValue"></param>
public GCalSequence(string initValue)
: base(GCalNameTable.XmlSequenceElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal,
initValue) {
}
}
/// <summary>
/// Indicates whether or not guests can modify the event.
/// </summary>
public class GCalGuestsCanModify : SimpleAttribute {
/// <summary>
/// default constructor
/// </summary>
public GCalGuestsCanModify()
: base(GCalNameTable.XmlGuestsCanModifyElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal) {
}
/// <summary>
/// constructor with an initial value
/// </summary>
/// <param name="initValue"></param>
public GCalGuestsCanModify(string initValue)
: base(GCalNameTable.XmlGuestsCanModifyElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal,
initValue) {
}
}
/// <summary>
/// Indicates whether or not guests can invite other guests.
/// </summary>
public class GCalGuestsCanInviteOthers : SimpleAttribute {
/// <summary>
/// default constructor
/// </summary>
public GCalGuestsCanInviteOthers()
: base(GCalNameTable.XmlGuestsCanInviteOthersElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal) {
}
/// <summary>
/// constructor with an initial value
/// </summary>
/// <param name="initValue"></param>
public GCalGuestsCanInviteOthers(string initValue)
: base(GCalNameTable.XmlGuestsCanInviteOthersElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal,
initValue) {
}
}
/// <summary>
/// Indicates whether or not guests can see other guests.
/// </summary>
public class GCalGuestsCanSeeGuests : SimpleAttribute {
/// <summary>
/// default constructor
/// </summary>
public GCalGuestsCanSeeGuests()
: base(GCalNameTable.XmlGuestsCanSeeGuestsElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal) {
}
/// <summary>
/// constructor with an initial value
/// </summary>
/// <param name="initValue"></param>
public GCalGuestsCanSeeGuests(string initValue)
: base(GCalNameTable.XmlGuestsCanSeeGuestsElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal,
initValue) {
}
}
/// <summary>
/// Entry API customization class for defining entries in an Event feed.
/// </summary>
public class EventEntry : AbstractEntry {
/// <summary>
/// Category used to label entries that contain Event extension data.
/// </summary>
public static AtomCategory EVENT_CATEGORY =
new AtomCategory(GDataParserNameTable.Event, new AtomUri(BaseNameTable.gKind));
/// <summary>
/// Constructs a new EventEntry instance with the appropriate category
/// to indicate that it is an event.
/// </summary>
public EventEntry()
: base() {
Categories.Add(EVENT_CATEGORY);
addEventEntryExtensions();
}
/// <summary>
/// Constructs a new EventEntry instance with provided data.
/// </summary>
/// <param name="title">The descriptive title of the event ("What" in the UI)</param>
public EventEntry(string title)
: this() {
this.Title.Text = title;
}
/// <summary>
/// Constructs a new EventEntry instance with provided data.
/// </summary>
/// <param name="title">The descriptive title of the event ("What" in the UI)</param>
/// <param name="description">A longer description of the event
/// ("Description" in the UI)</param>
public EventEntry(string title, string description)
: this(title) {
this.Content.Content = description;
}
/// <summary>
/// Constructs a new EventEntry instance with provided data.
/// </summary>
/// <param name="title">The descriptive title of the event ("What" in the UI)</param>
/// <param name="description">A longer description of the event
/// ("Description" in the UI)</param>
/// <param name="location">The location of the event ("Where" in the UI)</param>
public EventEntry(string title, string description, string location)
: this(title, description) {
Where eventLocation = new Where();
eventLocation.ValueString = location;
this.Locations.Add(eventLocation);
}
/// <summary>
/// helper method to add extensions to the evententry
/// </summary>
private void addEventEntryExtensions() {
this.AddExtension(new Reminder());
this.AddExtension(new Where());
this.AddExtension(new Who());
this.AddExtension(new When());
this.AddExtension(new OriginalEvent());
this.AddExtension(new SendNotifications());
this.AddExtension(new Transparency());
this.AddExtension(new Visibility());
this.AddExtension(new EventStatus());
this.AddExtension(new RecurrenceException());
this.AddExtension(new Comments());
this.AddExtension(new ExtendedProperty());
this.AddExtension(new Recurrence());
this.AddExtension(new GCalSequence());
this.AddExtension(new GCalUid());
this.AddExtension(new GCalSyncEvent());
this.AddExtension(new GCalGuestsCanSeeGuests());
this.AddExtension(new GCalGuestsCanInviteOthers());
this.AddExtension(new GCalGuestsCanModify());
}
/// <summary>
/// Constructs a new EventStatus instance
/// </summary>
public class EventStatus : EnumConstruct {
/// <summary>
/// default constructor
/// </summary>
public EventStatus()
: base(GDataParserNameTable.XmlEventStatusElement) {
}
/// <summary>
/// EventStatus constructor
/// </summary>
/// <param name="value">indicates the default status</param>
public EventStatus(string value)
: base(GDataParserNameTable.XmlEventStatusElement, value) {
}
/// <summary>string constant for a confirmed event</summary>
public const string CONFIRMED_VALUE = BaseNameTable.gNamespacePrefix + "event.confirmed";
/// <summary>string constant for a tentative accepted event</summary>
public const string TENTATIVE_VALUE = BaseNameTable.gNamespacePrefix + "event.tentative";
/// <summary>string constant for a cancelled event</summary>
public const string CANCELED_VALUE = BaseNameTable.gNamespacePrefix + "event.canceled";
/// <summary>EventStatus constant for a confirmed event</summary>
public static EventStatus CONFIRMED = new EventStatus(CONFIRMED_VALUE);
/// <summary>EventStatus constant for a tentative event</summary>
public static EventStatus TENTATIVE = new EventStatus(TENTATIVE_VALUE);
/// <summary>EventStatus constant for a Cancelled event</summary>
public static EventStatus CANCELED = new EventStatus(CANCELED_VALUE);
}
/// <summary>
/// Visibility class indicates the visibility of an eventNode
/// </summary>
public class Visibility : EnumConstruct {
/// <summary>
/// default constructor
/// </summary>
public Visibility()
: base(GDataParserNameTable.XmlVisibilityElement) {
}
/// <summary>
/// Visibility constructor with a string to indicate default value
/// </summary>
/// <param name="value">the default visibility value</param>
public Visibility(string value)
: base(GDataParserNameTable.XmlVisibilityElement, value) {
}
/// <summary>string constant for the default visibility value</summary>
public const string DEFAULT_VALUE = BaseNameTable.gNamespacePrefix + "event.default";
/// <summary>string constant for the public visibility value</summary>
public const string PUBLIC_VALUE = BaseNameTable.gNamespacePrefix + "event.public";
/// <summary>string constant for the confidential visibility value</summary>
public const string CONFIDENTIAL_VALUE = BaseNameTable.gNamespacePrefix + "event.confidential";
/// <summary>string constant for the private visibility value</summary>
public const string PRIVATE_VALUE = BaseNameTable.gNamespacePrefix + "event.private";
/// <summary>object constant for the private visibility value</summary>
public static Visibility DEFAULT = new Visibility(DEFAULT_VALUE);
/// <summary>object constant for the private visibility value</summary>
public static Visibility PUBLIC = new Visibility(PUBLIC_VALUE);
/// <summary>object constant for the private visibility value</summary>
public static Visibility CONFIDENTIAL = new Visibility(CONFIDENTIAL_VALUE);
/// <summary>object constant for the private visibility value</summary>
public static Visibility PRIVATE = new Visibility(PRIVATE_VALUE);
}
/// <summary>
/// the Transparency of an event class
/// </summary>
public class Transparency : EnumConstruct {
/// <summary>
/// default constructor
/// </summary>
public Transparency()
: base(GDataParserNameTable.XmlTransparencyElement) {
}
/// <summary>
/// constructor with a default string value
/// </summary>
/// <param name="value">transparency value</param>
public Transparency(string value)
: base(GDataParserNameTable.XmlTransparencyElement, value) {
}
/// <summary>string constant for the opaque transparency value</summary>
public const string OPAQUE_VALUE = BaseNameTable.gNamespacePrefix + "event.opaque";
/// <summary>string constant for the transparent trancparency value</summary>
public const string TRANSPARENT_VALUE = BaseNameTable.gNamespacePrefix + "event.transparent";
/// <summary>object constant for the opaque transparency value</summary>
public static Transparency OPAQUE = new Transparency(OPAQUE_VALUE);
/// <summary>object constant for the transparent transparency value</summary>
public static Transparency TRANSPARENT = new Transparency(TRANSPARENT_VALUE);
}
/// <summary>
/// indicates if an eventupdate should reissue notifications
/// false by default
/// </summary>
public class SendNotifications : EnumConstruct {
/// <summary>
/// default constructor
/// </summary>
public SendNotifications()
: base(GDataParserNameTable.XmlSendNotificationsElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal) {
}
/// <summary>
/// constructor with a default string value
/// </summary>
/// <param name="value">transparency value</param>
public SendNotifications(string value)
: base(GDataParserNameTable.XmlSendNotificationsElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal,
value) {
}
}
/// <summary>
/// indicates if this new entry should be a quickadd
/// false by default
/// </summary>
public class QuickAddElement : EnumConstruct {
/// <summary>
/// default constructor
/// </summary>
public QuickAddElement()
: base(GDataParserNameTable.XmlQuickAddElement,
GDataParserNameTable.gCalPrefix,
GDataParserNameTable.NSGCal) {
}
/// <summary>
/// constructor with a default string value
/// </summary>
/// <param name="value">transparency value</param>
public QuickAddElement(string value)
: base(GDataParserNameTable.XmlQuickAddElement, value) {
}
}
#region EventEntry Attributes
private ExtensionCollection<When> times;
private ExtensionCollection<Where> locations;
private ExtensionCollection<Who> participants;
#endregion
#region Public Methods
/// <summary>
/// property accessor for the WhenCollection
/// </summary>
public ExtensionCollection<When> Times {
get {
if (this.times == null) {
this.times = new ExtensionCollection<When>(this);
}
return this.times;
}
}
/// <summary>
/// property accessor for the WhereCollection
/// </summary>
public ExtensionCollection<Where> Locations {
get {
if (this.locations == null) {
this.locations = new ExtensionCollection<Where>(this);
}
return this.locations;
}
}
/// <summary>
/// property accessor for the whos in the event
/// </summary>
public ExtensionCollection<Who> Participants {
get {
if (this.participants == null) {
this.participants = new ExtensionCollection<Who>(this);
}
return this.participants;
}
}
/// <summary>
/// property accessor for the Event notifications
/// set this to True for notifications to be sent
/// </summary>
public bool Notifications {
get {
SendNotifications n =
FindExtension(GDataParserNameTable.XmlSendNotificationsElement,
GDataParserNameTable.NSGCal) as SendNotifications;
if (n == null) {
return false;
}
return n.Value == Utilities.XSDTrue;
}
set {
SendNotifications n =
FindExtension(GDataParserNameTable.XmlSendNotificationsElement,
GDataParserNameTable.NSGCal) as SendNotifications;
if (value) {
if (n == null) {
n = new SendNotifications();
ExtensionElements.Add(n);
}
n.Value = Utilities.XSDTrue;
} else {
if (n != null) {
DeleteExtensions(GDataParserNameTable.XmlSendNotificationsElement,
GDataParserNameTable.NSGCal);
}
}
}
}
/// <summary>
/// property accessor QuickAdd
/// To create an event using Google Calendar's quick add feature, set the event
/// entry's content to the quick add string you'd like to use. Then add a
/// gCal:quickadd element with a value attribute set to true
/// </summary>
public bool QuickAdd {
get {
QuickAddElement q =
FindExtension(GDataParserNameTable.XmlQuickAddElement,
GDataParserNameTable.NSGCal) as QuickAddElement;
if (q == null) {
return false;
}
return q.Value == Utilities.XSDTrue;
}
set {
QuickAddElement q =
FindExtension(GDataParserNameTable.XmlQuickAddElement,
GDataParserNameTable.NSGCal) as QuickAddElement;
if (value) {
if (q == null) {
q = new QuickAddElement();
ExtensionElements.Add(q);
}
q.Value = Utilities.XSDTrue;
} else {
if (q != null) {
DeleteExtensions(GDataParserNameTable.XmlQuickAddElement,
GDataParserNameTable.NSGCal);
}
}
}
}
/// <summary>
/// property accessor for the EventStatus
/// </summary>
public EventStatus Status {
get {
return FindExtension(GDataParserNameTable.XmlEventStatusElement,
GDataParserNameTable.gNamespace) as EventStatus;
}
set {
ReplaceExtension(GDataParserNameTable.XmlEventStatusElement,
GDataParserNameTable.gNamespace, value);
}
}
/// <summary>
/// property accessor for the Event Visibility
/// </summary>
public Visibility EventVisibility {
get {
return FindExtension(GDataParserNameTable.XmlVisibilityElement,
GDataParserNameTable.gNamespace) as Visibility;
}
set {
ReplaceExtension(GDataParserNameTable.XmlVisibilityElement,
GDataParserNameTable.gNamespace, value);
}
}
/// <summary>
/// property accessor for the EventTransparency
/// </summary>
public Transparency EventTransparency {
get {
return FindExtension(GDataParserNameTable.XmlTransparencyElement,
GDataParserNameTable.gNamespace) as Transparency;
}
set {
ReplaceExtension(GDataParserNameTable.XmlTransparencyElement,
GDataParserNameTable.gNamespace, value);
}
}
/// <summary>
/// property accessor for the Recurrence
/// </summary>
public Recurrence Recurrence {
get {
return FindExtension(GDataParserNameTable.XmlRecurrenceElement,
GDataParserNameTable.gNamespace) as Recurrence;
}
set {
ReplaceExtension(GDataParserNameTable.XmlRecurrenceElement,
GDataParserNameTable.gNamespace, value);
}
}
/// <summary>
/// property accessor for the RecurrenceException
/// </summary>
public RecurrenceException RecurrenceException {
get {
return FindExtension(GDataParserNameTable.XmlRecurrenceExceptionElement,
GDataParserNameTable.gNamespace) as RecurrenceException;
}
set {
ReplaceExtension(GDataParserNameTable.XmlRecurrenceExceptionElement,
GDataParserNameTable.gNamespace, value);
}
}
/// <summary>
/// property accessor for the OriginalEvent
/// </summary>
public OriginalEvent OriginalEvent {
get {
return FindExtension(GDataParserNameTable.XmlOriginalEventElement,
GDataParserNameTable.gNamespace) as OriginalEvent;
}
set {
ReplaceExtension(GDataParserNameTable.XmlOriginalEventElement,
GDataParserNameTable.gNamespace, value);
}
}
/// <summary>
/// property accessor for the Comments
/// </summary>
public Comments Comments {
get {
return FindExtension(GDataParserNameTable.XmlCommentsElement,
GDataParserNameTable.gNamespace) as Comments;
}
set {
ReplaceExtension(GDataParserNameTable.XmlCommentsElement,
GDataParserNameTable.gNamespace, value);
}
}
/// <summary>
/// returns the first reminder of the Times collection
/// </summary>
/// <returns>When object for the reminder or NULL</returns>
protected When GetFirstReminder() {
return this.Times != null && this.Times.Count > 0 ? this.Times[0] : null;
}
/// <summary>
/// returns the FIRST reminder for backwards compatibility
/// if set, will REMOVE all reminders, but this one (array of one)
/// </summary>
public Reminder Reminder {
get {
if (this.Reminders != null && this.Reminders.Count > 0) {
return this.Reminders[0];
}
return null;
}
set {
this.Reminders.Clear();
if (value != null) {
this.Reminders.Add(value);
}
}
}
/// <summary>
/// property accessor for the Reminder
/// </summary>
public ExtensionCollection<Reminder> Reminders {
get {
// if we are a recurrent event, reminder is on the entry/toplevel
if (this.Recurrence != null) {
//TODO could not get the generic overload to work. we for now just copy the list a few times.
ExtensionList list = new ExtensionList(this);
FindExtensions(GDataParserNameTable.XmlReminderElement,
BaseNameTable.gNamespace, list);
ExtensionCollection<Reminder> collection = new ExtensionCollection<Reminder>(this);
foreach (Reminder var in list) {
collection.Add(var);
}
return collection;
} else {
// in the non recurrent case, it's on the first when element
When w = GetFirstReminder();
if (w != null) {
return w.Reminders;
}
}
return null;
}
}
/// <summary>
/// as eventId is a commonly used part in the calendar world, we expose it
/// here. In general the EventId is the last part of the AtomId
/// </summary>
public string EventId {
get {
string[] elements = this.Id.AbsoluteUri.Split(new char[] { '/' });
if (elements != null && elements.Length > 0) {
return elements[elements.Length - 1];
}
return null;
}
}
/// <summary>
/// Property to retrieve/set an associated WebContentLink
/// </summary>
public WebContentLink WebContentLink {
get {
return this.Links.FindService(WebContentLink.WEB_CONTENT_REL,
null) as WebContentLink;
}
set {
this.Links.Add(value);
}
}
/// <summary>
/// property accessor for the SyncEvent element
/// </summary>
public GCalSyncEvent SyncEvent {
get {
return FindExtension(GCalNameTable.XmlSyncEventElement,
GDataParserNameTable.NSGCal) as GCalSyncEvent;
}
set {
ReplaceExtension(GCalNameTable.XmlSyncEventElement,
GDataParserNameTable.NSGCal, value);
}
}
/// <summary>
/// property accessor for the uid element
/// </summary>
public GCalUid Uid {
get {
return FindExtension(GCalNameTable.XmlUidElement,
GDataParserNameTable.NSGCal) as GCalUid;
}
set {
ReplaceExtension(GCalNameTable.XmlUidElement,
GDataParserNameTable.NSGCal, value);
}
}
/// <summary>
/// property accessor for the SyncEvent element
/// </summary>
public GCalSequence Sequence {
get {
return FindExtension(GCalNameTable.XmlSequenceElement,
GDataParserNameTable.NSGCal) as GCalSequence;
}
set {
ReplaceExtension(GCalNameTable.XmlSequenceElement,
GDataParserNameTable.NSGCal, value);
}
}
/// <summary>
/// property accessor for the GuestsCanSeeGuests element
/// </summary>
public GCalGuestsCanSeeGuests GuestsCanSeeGuests {
get {
return FindExtension(GCalNameTable.XmlGuestsCanSeeGuestsElement,
GDataParserNameTable.NSGCal) as GCalGuestsCanSeeGuests;
}
set {
ReplaceExtension(GCalNameTable.XmlGuestsCanSeeGuestsElement,
GDataParserNameTable.NSGCal, value);
}
}
/// <summary>
/// property accessor for the GuestsCanInviteOthers element
/// </summary>
public GCalGuestsCanInviteOthers GuestsCanInviteOthers {
get {
return FindExtension(GCalNameTable.XmlGuestsCanInviteOthersElement,
GDataParserNameTable.NSGCal) as GCalGuestsCanInviteOthers;
}
set {
ReplaceExtension(GCalNameTable.XmlGuestsCanInviteOthersElement,
GDataParserNameTable.NSGCal, value);
}
}
/// <summary>
/// property accessor for the GuestsCanModify element
/// </summary>
public GCalGuestsCanModify GuestsCanModify {
get {
return FindExtension(GCalNameTable.XmlGuestsCanModifyElement,
GDataParserNameTable.NSGCal) as GCalGuestsCanModify;
}
set {
ReplaceExtension(GCalNameTable.XmlGuestsCanModifyElement,
GDataParserNameTable.NSGCal, value);
}
}
#endregion
/// <summary>
/// this is the subclassing method for AtomBase derived
/// classes to overload what childelements should be created
/// needed to create CustomLink type objects, like WebContentLink etc
/// </summary>
/// <param name="reader">The XmlReader that tells us what we are working with</param>
/// <param name="parser">the parser is primarily used for nametable comparisons</param>
/// <returns>AtomBase</returns>
public override AtomBase CreateAtomSubElement(XmlReader reader, AtomFeedParser parser) {
Object localname = reader.LocalName;
if (localname.Equals(parser.Nametable.Link)) {
if (reader.GetAttribute(GDataParserNameTable.XmlAttributeRel) ==
WebContentLink.WEB_CONTENT_REL) {
return new WebContentLink(false);
}
}
return base.CreateAtomSubElement(reader, parser);
}
}
}