/[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 95 - (show annotations) (download)
Tue Oct 12 23:23:36 2010 UTC (11 years, 1 month ago) by rvvs89
File size: 2556 byte(s)
Adding stubs for file attachment metadata.
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 fileRadioButton.Enabled = new List<MetadataLocation>(MetadataType.FILE.ApplicableLocations).Contains(location);
32 }
33 }
34
35 public DateTime Point
36 {
37 get { return point.Value; }
38 set { point = value; }
39 }
40
41 public DateTime End
42 {
43 get { return range.Value; }
44 set { range = value; }
45 }
46
47 private void nextButton_Click(object sender, EventArgs e)
48 {
49 MetadataType type;
50 if (textRadioButton.Checked)
51 {
52 type = MetadataType.TEXT;
53 } else if(fileRadioButton.Checked) {
54 type = MetadataType.FILE;
55 } else {
56 AddMetadataDialog.Instance.Close();
57 return;
58 }
59 IMetadata data = type.CreateInstance(MetadataLocation);
60 switch (MetadataLocation)
61 {
62 case MetadataLocation.POINT:
63 data.Point = Point;
64 break;
65 case MetadataLocation.RANGE:
66 data.Point = Point;
67 data.End = End;
68 break;
69 }
70 MetadataRouteControlLayer.Instances[0].CurrentList.Add(data);
71 EditMetadataDialog.Instance.Control.Editor = data.Editor;
72 EditMetadataDialog.Instance.Control.InitialEdit = true;
73 EditMetadataDialog.Instance.Control.UpdateContent();
74 AddMetadataDialog.Instance.Close();
75 EditMetadataDialog.Instance.ShowDialog();
76 }
77 }
78 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26