/[cits3200i]/branches/metadata-branch-rvvs89/UWAPlugins/MetadataPlugin/Source/MetadataList.cs


UCC Code Repository

Contents of /branches/metadata-branch-rvvs89/UWAPlugins/MetadataPlugin/Source/MetadataList.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 88 - (show annotations) (download)
Tue Oct 12 04:54:08 2010 UTC (11 years, 1 month ago) by rvvs89
File size: 1498 byte(s)
Syncing.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.IO;
5 using System.Runtime.Serialization;
6 using ZoneFiveSoftware.Common.Data.Fitness;
7
8 namespace MetadataPlugin.Source
9 {
10 [Serializable]
11 class MetadataList : IDeserializationCallback
12 {
13 private IList<IMetadata> items = new List<IMetadata>();
14 [NonSerialized]
15 private IActivity activity;
16
17 public IActivity Activity
18 {
19 set { activity = value; }
20 }
21
22 public bool Dirty
23 {
24 get
25 {
26 // FIXME: implement me
27 return true;
28 }
29 }
30
31 public void Commit()
32 {
33 // TODO: create some triggers for this function
34 if (activity == null || !Dirty)
35 return;
36 activity.SetExtensionData(Plugin.Instance.Id, MetadataListSerializer.Serialize(this));
37 }
38
39 public void OnDeserialization(object sender)
40 {
41 activity = null;
42 }
43
44 public static MetadataList LoadFromActivity(IActivity activity)
45 {
46 if (activity == null)
47 return null;
48 MetadataList ret = MetadataListSerializer.Deserialize(activity.GetExtensionData(Plugin.Instance.Id));
49 if (ret == null)
50 ret = new MetadataList();
51 ret.Activity = activity;
52 return ret;
53 }
54 }
55 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26