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


UCC Code Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 90 - (show annotations) (download)
Tue Oct 12 21:18:41 2010 UTC (11 years, 1 month ago) by rvvs89
File size: 2393 byte(s)
Attaching metadata now works.
Saving metadata now works.
Loading metadata now works.
Editing metadata and cancelling your changes now works.
MetadataList now only commits on change.
Icons appear on the track when metadata is added.
Icons can be double clicked to launch the editor.
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Text;
7 using System.Windows.Forms;
8 using ZoneFiveSoftware.Common.Data;
9
10 namespace MetadataPlugin.Source
11 {
12 public partial class AddMetadataControl : UserControl
13 {
14 private MetadataLocation location;
15 private Nullable<DateTime> point;
16 private Nullable<DateTime> range;
17
18 public AddMetadataControl()
19 {
20 InitializeComponent();
21 }
22
23 public MetadataLocation MetadataLocation
24 {
25 get { return location; }
26 set
27 {
28 location = value;
29 textRadioButton.Enabled = new List<MetadataLocation>(MetadataType.TEXT.ApplicableLocations).Contains(location);
30 textRadioButton.Checked = textRadioButton.Enabled;
31 }
32 }
33
34 public DateTime Point
35 {
36 get { return point.Value; }
37 set { point = value; }
38 }
39
40 public DateTime End
41 {
42 get { return range.Value; }
43 set { range = value; }
44 }
45
46 private void nextButton_Click(object sender, EventArgs e)
47 {
48 MetadataType type;
49 if (textRadioButton.Checked)
50 {
51 type = MetadataType.TEXT;
52 } else {
53 Hide();
54 /* FIXME: prevent this case from occuring by disabling the button */
55 return;
56 }
57 IMetadata data = type.CreateInstance(MetadataLocation);
58 switch (MetadataLocation)
59 {
60 case MetadataLocation.POINT:
61 data.Point = Point;
62 break;
63 case MetadataLocation.RANGE:
64 data.Point = Point;
65 data.End = End;
66 break;
67 }
68 MetadataRouteControlLayer.Instances[0].CurrentList.Add(data);
69 EditMetadataDialog.Instance.Control.Editor = data.Editor;
70 EditMetadataDialog.Instance.Control.InitialEdit = true;
71 EditMetadataDialog.Instance.Control.UpdateSpecific();
72 AddMetadataDialog.Instance.Close();
73 EditMetadataDialog.Instance.ShowDialog();
74 }
75 }
76 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26