mohawk 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +24 -17
- data/.travis.yml +2 -0
- data/Changelog +36 -20
- data/Gemfile +3 -3
- data/Guardfile +16 -0
- data/LICENSE.txt +21 -21
- data/README.md +60 -56
- data/Rakefile +18 -18
- data/features/control.feature +5 -0
- data/features/label.feature +4 -4
- data/features/link.feature +9 -0
- data/features/mohawk.feature +4 -1
- data/features/navigation.feature +9 -0
- data/features/step_definitions/control_steps.rb +3 -0
- data/features/step_definitions/label_steps.rb +3 -3
- data/features/step_definitions/link_steps.rb +3 -0
- data/features/step_definitions/mohawk_steps.rb +4 -0
- data/features/step_definitions/navigation_steps.rb +15 -0
- data/features/step_definitions/table_steps.rb +19 -3
- data/features/step_definitions/tree_view_steps.rb +4 -0
- data/features/support/WindowsForms.exe +0 -0
- data/features/support/app/WindowsForms/WindowsForms/AboutBox.Designer.cs +80 -0
- data/features/support/app/WindowsForms/WindowsForms/AboutBox.cs +103 -0
- data/features/support/app/WindowsForms/WindowsForms/AboutBox.resx +120 -0
- data/features/support/app/WindowsForms/WindowsForms/AutomatableMonthCalendar.cs +59 -0
- data/features/support/app/WindowsForms/WindowsForms/AutomationHelpers/AutomationProvider.cs +91 -0
- data/features/support/app/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +187 -0
- data/features/support/app/WindowsForms/WindowsForms/DataEntryForm.cs +46 -0
- data/features/support/app/WindowsForms/WindowsForms/DataEntryForm.resx +120 -0
- data/features/support/app/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +526 -0
- data/features/support/app/WindowsForms/WindowsForms/MainFormWindow.cs +93 -0
- data/features/support/app/WindowsForms/WindowsForms/MainFormWindow.resx +123 -0
- data/features/support/app/WindowsForms/WindowsForms/PersonForm.Designer.cs +119 -0
- data/features/support/app/WindowsForms/WindowsForms/PersonForm.cs +34 -0
- data/features/support/app/WindowsForms/WindowsForms/PersonForm.resx +120 -0
- data/features/support/app/WindowsForms/WindowsForms/Program.cs +21 -0
- data/features/support/app/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs +36 -0
- data/features/support/app/WindowsForms/WindowsForms/Properties/Resources.Designer.cs +71 -0
- data/features/support/app/WindowsForms/WindowsForms/Properties/Resources.resx +117 -0
- data/features/support/app/WindowsForms/WindowsForms/Properties/Settings.Designer.cs +30 -0
- data/features/support/app/WindowsForms/WindowsForms/Properties/Settings.settings +7 -0
- data/features/support/app/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs +93 -0
- data/features/support/app/WindowsForms/WindowsForms/SimpleElementsForm.cs +19 -0
- data/features/support/app/WindowsForms/WindowsForms/SimpleElementsForm.resx +120 -0
- data/features/support/app/WindowsForms/WindowsForms/WindowsForms.csproj +132 -0
- data/features/support/app/WindowsForms/WindowsForms.sln +30 -0
- data/features/support/env.rb +28 -17
- data/features/support/screens/about_screen.rb +7 -0
- data/features/support/screens/data_entry_form.rb +5 -0
- data/features/support/screens/main_screen.rb +3 -0
- data/features/table.feature +14 -0
- data/features/tree_view.feature +3 -0
- data/lib/mohawk/accessors/button.rb +6 -4
- data/lib/mohawk/accessors/checkbox.rb +7 -5
- data/lib/mohawk/accessors/combo.rb +7 -5
- data/lib/mohawk/accessors/control.rb +23 -0
- data/lib/mohawk/accessors/label.rb +15 -13
- data/lib/mohawk/accessors/link.rb +9 -0
- data/lib/mohawk/accessors/radio.rb +5 -3
- data/lib/mohawk/accessors/table.rb +12 -31
- data/lib/mohawk/accessors/table_row.rb +43 -0
- data/lib/mohawk/accessors/text.rb +7 -5
- data/lib/mohawk/accessors/tree_view.rb +9 -7
- data/lib/mohawk/accessors.rb +66 -7
- data/lib/mohawk/adapters/uia_adapter.rb +8 -0
- data/lib/mohawk/core_ext/string.rb +5 -0
- data/lib/mohawk/navigation.rb +6 -2
- data/lib/mohawk/version.rb +3 -3
- data/lib/mohawk.rb +76 -69
- data/mohawk.gemspec +32 -26
- data/spec/lib/mohawk/accessors/button_spec.rb +4 -0
- data/spec/lib/mohawk/accessors/checkbox_spec.rb +4 -1
- data/spec/lib/mohawk/accessors/combo_spec.rb +3 -0
- data/spec/lib/mohawk/accessors/control_spec.rb +38 -0
- data/spec/lib/mohawk/accessors/label_spec.rb +29 -25
- data/spec/lib/mohawk/accessors/link_spec.rb +34 -0
- data/spec/lib/mohawk/accessors/radio_spec.rb +4 -0
- data/spec/lib/mohawk/accessors/table_spec.rb +52 -7
- data/spec/lib/mohawk/accessors/text_spec.rb +4 -0
- data/spec/lib/mohawk/accessors/tree_view_spec.rb +5 -0
- data/spec/lib/mohawk_spec.rb +19 -0
- data/spec/lib/navigation_spec.rb +5 -0
- metadata +175 -6
@@ -0,0 +1,120 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<root>
|
3
|
+
<!--
|
4
|
+
Microsoft ResX Schema
|
5
|
+
|
6
|
+
Version 2.0
|
7
|
+
|
8
|
+
The primary goals of this format is to allow a simple XML format
|
9
|
+
that is mostly human readable. The generation and parsing of the
|
10
|
+
various data types are done through the TypeConverter classes
|
11
|
+
associated with the data types.
|
12
|
+
|
13
|
+
Example:
|
14
|
+
|
15
|
+
... ado.net/XML headers & schema ...
|
16
|
+
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
17
|
+
<resheader name="version">2.0</resheader>
|
18
|
+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
19
|
+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
20
|
+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
21
|
+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
22
|
+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
23
|
+
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
24
|
+
</data>
|
25
|
+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
26
|
+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
27
|
+
<comment>This is a comment</comment>
|
28
|
+
</data>
|
29
|
+
|
30
|
+
There are any number of "resheader" rows that contain simple
|
31
|
+
name/value pairs.
|
32
|
+
|
33
|
+
Each data row contains a name, and value. The row also contains a
|
34
|
+
type or mimetype. Type corresponds to a .NET class that support
|
35
|
+
text/value conversion through the TypeConverter architecture.
|
36
|
+
Classes that don't support this are serialized and stored with the
|
37
|
+
mimetype set.
|
38
|
+
|
39
|
+
The mimetype is used for serialized objects, and tells the
|
40
|
+
ResXResourceReader how to depersist the object. This is currently not
|
41
|
+
extensible. For a given mimetype the value must be set accordingly:
|
42
|
+
|
43
|
+
Note - application/x-microsoft.net.object.binary.base64 is the format
|
44
|
+
that the ResXResourceWriter will generate, however the reader can
|
45
|
+
read any of the formats listed below.
|
46
|
+
|
47
|
+
mimetype: application/x-microsoft.net.object.binary.base64
|
48
|
+
value : The object must be serialized with
|
49
|
+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
50
|
+
: and then encoded with base64 encoding.
|
51
|
+
|
52
|
+
mimetype: application/x-microsoft.net.object.soap.base64
|
53
|
+
value : The object must be serialized with
|
54
|
+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
55
|
+
: and then encoded with base64 encoding.
|
56
|
+
|
57
|
+
mimetype: application/x-microsoft.net.object.bytearray.base64
|
58
|
+
value : The object must be serialized into a byte array
|
59
|
+
: using a System.ComponentModel.TypeConverter
|
60
|
+
: and then encoded with base64 encoding.
|
61
|
+
-->
|
62
|
+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
63
|
+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
64
|
+
<xsd:element name="root" msdata:IsDataSet="true">
|
65
|
+
<xsd:complexType>
|
66
|
+
<xsd:choice maxOccurs="unbounded">
|
67
|
+
<xsd:element name="metadata">
|
68
|
+
<xsd:complexType>
|
69
|
+
<xsd:sequence>
|
70
|
+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
71
|
+
</xsd:sequence>
|
72
|
+
<xsd:attribute name="name" use="required" type="xsd:string" />
|
73
|
+
<xsd:attribute name="type" type="xsd:string" />
|
74
|
+
<xsd:attribute name="mimetype" type="xsd:string" />
|
75
|
+
<xsd:attribute ref="xml:space" />
|
76
|
+
</xsd:complexType>
|
77
|
+
</xsd:element>
|
78
|
+
<xsd:element name="assembly">
|
79
|
+
<xsd:complexType>
|
80
|
+
<xsd:attribute name="alias" type="xsd:string" />
|
81
|
+
<xsd:attribute name="name" type="xsd:string" />
|
82
|
+
</xsd:complexType>
|
83
|
+
</xsd:element>
|
84
|
+
<xsd:element name="data">
|
85
|
+
<xsd:complexType>
|
86
|
+
<xsd:sequence>
|
87
|
+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
88
|
+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
89
|
+
</xsd:sequence>
|
90
|
+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
91
|
+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
92
|
+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
93
|
+
<xsd:attribute ref="xml:space" />
|
94
|
+
</xsd:complexType>
|
95
|
+
</xsd:element>
|
96
|
+
<xsd:element name="resheader">
|
97
|
+
<xsd:complexType>
|
98
|
+
<xsd:sequence>
|
99
|
+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
100
|
+
</xsd:sequence>
|
101
|
+
<xsd:attribute name="name" type="xsd:string" use="required" />
|
102
|
+
</xsd:complexType>
|
103
|
+
</xsd:element>
|
104
|
+
</xsd:choice>
|
105
|
+
</xsd:complexType>
|
106
|
+
</xsd:element>
|
107
|
+
</xsd:schema>
|
108
|
+
<resheader name="resmimetype">
|
109
|
+
<value>text/microsoft-resx</value>
|
110
|
+
</resheader>
|
111
|
+
<resheader name="version">
|
112
|
+
<value>2.0</value>
|
113
|
+
</resheader>
|
114
|
+
<resheader name="reader">
|
115
|
+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
116
|
+
</resheader>
|
117
|
+
<resheader name="writer">
|
118
|
+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
119
|
+
</resheader>
|
120
|
+
</root>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Collections.Generic;
|
3
|
+
using System.Globalization;
|
4
|
+
using System.Windows.Automation;
|
5
|
+
using System.Windows.Automation.Provider;
|
6
|
+
using System.Windows.Forms;
|
7
|
+
using WindowsForms.AutomationHelpers;
|
8
|
+
|
9
|
+
namespace WindowsForms
|
10
|
+
{
|
11
|
+
public class AutomatableMonthCalendar : MonthCalendar
|
12
|
+
{
|
13
|
+
private MonthCalendarAutomationProvider _automationProvider;
|
14
|
+
|
15
|
+
private IRawElementProviderSimple RawElementProviderSimple
|
16
|
+
{
|
17
|
+
get { return _automationProvider ?? (_automationProvider = new MonthCalendarAutomationProvider(this)); }
|
18
|
+
}
|
19
|
+
|
20
|
+
protected override void WndProc(ref Message m)
|
21
|
+
{
|
22
|
+
if (m.Msg == 0x3D /* WM_GETOBJECT */)
|
23
|
+
{
|
24
|
+
m.Result = AutomationInteropProvider.ReturnRawElementProvider(m.HWnd, m.WParam, m.LParam, RawElementProviderSimple);
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
base.WndProc(ref m);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
internal class MonthCalendarAutomationProvider : AutomationProvider, IValueProvider
|
33
|
+
{
|
34
|
+
private readonly MonthCalendar _control;
|
35
|
+
|
36
|
+
public MonthCalendarAutomationProvider(MonthCalendar control)
|
37
|
+
: base(control)
|
38
|
+
{
|
39
|
+
_control = control;
|
40
|
+
}
|
41
|
+
|
42
|
+
protected override List<int> SupportedPatterns
|
43
|
+
{
|
44
|
+
get { return new List<int> { ValuePatternIdentifiers.Pattern.Id }; }
|
45
|
+
}
|
46
|
+
|
47
|
+
public void SetValue(string value)
|
48
|
+
{
|
49
|
+
_control.SetDate(DateTime.Parse(value, new CultureInfo("en-US")));
|
50
|
+
}
|
51
|
+
|
52
|
+
public string Value
|
53
|
+
{
|
54
|
+
get { return _control.SelectionStart.ToString(new CultureInfo("en-US")); }
|
55
|
+
}
|
56
|
+
|
57
|
+
public bool IsReadOnly { get; private set; }
|
58
|
+
}
|
59
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
using System.Collections.Generic;
|
2
|
+
using System.Linq;
|
3
|
+
using System.Windows;
|
4
|
+
using System.Windows.Automation;
|
5
|
+
using System.Windows.Automation.Provider;
|
6
|
+
using System.Windows.Forms;
|
7
|
+
|
8
|
+
namespace WindowsForms.AutomationHelpers
|
9
|
+
{
|
10
|
+
public abstract class AutomationProvider : IRawElementProviderFragmentRoot
|
11
|
+
{
|
12
|
+
private readonly Control _control;
|
13
|
+
private readonly Dictionary<int, object> _properties;
|
14
|
+
|
15
|
+
protected AutomationProvider(Control control)
|
16
|
+
{
|
17
|
+
_control = control;
|
18
|
+
_properties = new Dictionary<int, object>
|
19
|
+
{
|
20
|
+
{AutomationElementIdentifiers.ControlTypeProperty.Id, ControlType.Custom.Id},
|
21
|
+
{AutomationElementIdentifiers.LocalizedControlTypeProperty.Id, _control.GetType().FullName},
|
22
|
+
{AutomationElementIdentifiers.AutomationIdProperty.Id, _control.Name},
|
23
|
+
{AutomationElementIdentifiers.IsKeyboardFocusableProperty.Id, true},
|
24
|
+
};
|
25
|
+
}
|
26
|
+
|
27
|
+
protected abstract List<int> SupportedPatterns { get; }
|
28
|
+
|
29
|
+
protected const int ProviderUseComThreading = 0x20;
|
30
|
+
public ProviderOptions ProviderOptions
|
31
|
+
{
|
32
|
+
get
|
33
|
+
{
|
34
|
+
return (ProviderOptions)((int)ProviderOptions.ServerSideProvider | ProviderUseComThreading);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
public IRawElementProviderSimple HostRawElementProvider
|
39
|
+
{
|
40
|
+
get { return AutomationInteropProvider.HostProviderFromHandle(_control.Handle); }
|
41
|
+
}
|
42
|
+
|
43
|
+
public Rect BoundingRectangle { get; private set; }
|
44
|
+
|
45
|
+
public IRawElementProviderFragmentRoot FragmentRoot
|
46
|
+
{
|
47
|
+
get { return this; }
|
48
|
+
}
|
49
|
+
|
50
|
+
public object GetPropertyValue(int propertyId)
|
51
|
+
{
|
52
|
+
return _properties.Where(x => x.Key.Equals(propertyId))
|
53
|
+
.Select(x => x.Value)
|
54
|
+
.FirstOrDefault();
|
55
|
+
}
|
56
|
+
|
57
|
+
public object GetPatternProvider(int patternId)
|
58
|
+
{
|
59
|
+
return SupportedPatterns.Contains(patternId) ? this : null;
|
60
|
+
}
|
61
|
+
|
62
|
+
public IRawElementProviderSimple[] GetEmbeddedFragmentRoots()
|
63
|
+
{
|
64
|
+
return null;
|
65
|
+
}
|
66
|
+
|
67
|
+
public int[] GetRuntimeId()
|
68
|
+
{
|
69
|
+
return new[] { _control.GetHashCode() };
|
70
|
+
}
|
71
|
+
|
72
|
+
public void SetFocus()
|
73
|
+
{
|
74
|
+
}
|
75
|
+
|
76
|
+
public IRawElementProviderFragment Navigate(NavigateDirection direction)
|
77
|
+
{
|
78
|
+
return null;
|
79
|
+
}
|
80
|
+
|
81
|
+
public IRawElementProviderFragment ElementProviderFromPoint(double x, double y)
|
82
|
+
{
|
83
|
+
return null;
|
84
|
+
}
|
85
|
+
|
86
|
+
public IRawElementProviderFragment GetFocus()
|
87
|
+
{
|
88
|
+
return null;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
@@ -0,0 +1,187 @@
|
|
1
|
+
namespace WindowsForms
|
2
|
+
{
|
3
|
+
partial class DataEntryForm
|
4
|
+
{
|
5
|
+
/// <summary>
|
6
|
+
/// Required designer variable.
|
7
|
+
/// </summary>
|
8
|
+
private System.ComponentModel.IContainer components = null;
|
9
|
+
|
10
|
+
/// <summary>
|
11
|
+
/// Clean up any resources being used.
|
12
|
+
/// </summary>
|
13
|
+
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
14
|
+
protected override void Dispose(bool disposing)
|
15
|
+
{
|
16
|
+
if (disposing && (components != null))
|
17
|
+
{
|
18
|
+
components.Dispose();
|
19
|
+
}
|
20
|
+
base.Dispose(disposing);
|
21
|
+
}
|
22
|
+
|
23
|
+
#region Windows Form Designer generated code
|
24
|
+
|
25
|
+
/// <summary>
|
26
|
+
/// Required method for Designer support - do not modify
|
27
|
+
/// the contents of this method with the code editor.
|
28
|
+
/// </summary>
|
29
|
+
private void InitializeComponent()
|
30
|
+
{
|
31
|
+
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
|
32
|
+
"John Doe",
|
33
|
+
"12/15/1967",
|
34
|
+
"FL"}, -1);
|
35
|
+
System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem(new string[] {
|
36
|
+
"Anna Doe",
|
37
|
+
"3/4/1975"}, -1);
|
38
|
+
this.deleteItemButton = new System.Windows.Forms.Button();
|
39
|
+
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
40
|
+
this.addItemButton = new System.Windows.Forms.Button();
|
41
|
+
this.personListView = new System.Windows.Forms.ListView();
|
42
|
+
this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
43
|
+
this.columnDateOfBirth = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
44
|
+
this.columnState = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
45
|
+
this.closeDataEntryFormButton = new System.Windows.Forms.Button();
|
46
|
+
this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox();
|
47
|
+
this.label1 = new System.Windows.Forms.Label();
|
48
|
+
this.maskedTextBox2 = new System.Windows.Forms.MaskedTextBox();
|
49
|
+
this.groupBox3.SuspendLayout();
|
50
|
+
this.SuspendLayout();
|
51
|
+
//
|
52
|
+
// deleteItemButton
|
53
|
+
//
|
54
|
+
this.deleteItemButton.Location = new System.Drawing.Point(334, 55);
|
55
|
+
this.deleteItemButton.Name = "deleteItemButton";
|
56
|
+
this.deleteItemButton.Size = new System.Drawing.Size(75, 23);
|
57
|
+
this.deleteItemButton.TabIndex = 2;
|
58
|
+
this.deleteItemButton.Text = "Delete";
|
59
|
+
this.deleteItemButton.UseVisualStyleBackColor = true;
|
60
|
+
this.deleteItemButton.Click += new System.EventHandler(this.deleteItemButton_Click);
|
61
|
+
//
|
62
|
+
// groupBox3
|
63
|
+
//
|
64
|
+
this.groupBox3.Controls.Add(this.deleteItemButton);
|
65
|
+
this.groupBox3.Controls.Add(this.addItemButton);
|
66
|
+
this.groupBox3.Controls.Add(this.personListView);
|
67
|
+
this.groupBox3.Location = new System.Drawing.Point(135, 12);
|
68
|
+
this.groupBox3.Name = "groupBox3";
|
69
|
+
this.groupBox3.Size = new System.Drawing.Size(415, 114);
|
70
|
+
this.groupBox3.TabIndex = 9;
|
71
|
+
this.groupBox3.TabStop = false;
|
72
|
+
this.groupBox3.Text = "List of items";
|
73
|
+
//
|
74
|
+
// addItemButton
|
75
|
+
//
|
76
|
+
this.addItemButton.Location = new System.Drawing.Point(334, 26);
|
77
|
+
this.addItemButton.Name = "addItemButton";
|
78
|
+
this.addItemButton.Size = new System.Drawing.Size(75, 23);
|
79
|
+
this.addItemButton.TabIndex = 1;
|
80
|
+
this.addItemButton.Text = "Add ...";
|
81
|
+
this.addItemButton.UseVisualStyleBackColor = true;
|
82
|
+
this.addItemButton.Click += new System.EventHandler(this.addItemButton_Click);
|
83
|
+
//
|
84
|
+
// personListView
|
85
|
+
//
|
86
|
+
this.personListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
87
|
+
this.columnName,
|
88
|
+
this.columnDateOfBirth,
|
89
|
+
this.columnState});
|
90
|
+
this.personListView.GridLines = true;
|
91
|
+
this.personListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
92
|
+
this.personListView.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
|
93
|
+
listViewItem1,
|
94
|
+
listViewItem2});
|
95
|
+
this.personListView.Location = new System.Drawing.Point(6, 26);
|
96
|
+
this.personListView.Name = "personListView";
|
97
|
+
this.personListView.Size = new System.Drawing.Size(314, 74);
|
98
|
+
this.personListView.TabIndex = 0;
|
99
|
+
this.personListView.UseCompatibleStateImageBehavior = false;
|
100
|
+
this.personListView.View = System.Windows.Forms.View.Details;
|
101
|
+
//
|
102
|
+
// columnName
|
103
|
+
//
|
104
|
+
this.columnName.Text = "Name";
|
105
|
+
this.columnName.Width = 148;
|
106
|
+
//
|
107
|
+
// columnDateOfBirth
|
108
|
+
//
|
109
|
+
this.columnDateOfBirth.Text = "Date of birth";
|
110
|
+
this.columnDateOfBirth.Width = 100;
|
111
|
+
//
|
112
|
+
// columnState
|
113
|
+
//
|
114
|
+
this.columnState.Text = "State";
|
115
|
+
//
|
116
|
+
// closeDataEntryFormButton
|
117
|
+
//
|
118
|
+
this.closeDataEntryFormButton.Location = new System.Drawing.Point(12, 12);
|
119
|
+
this.closeDataEntryFormButton.Name = "closeDataEntryFormButton";
|
120
|
+
this.closeDataEntryFormButton.Size = new System.Drawing.Size(95, 23);
|
121
|
+
this.closeDataEntryFormButton.TabIndex = 11;
|
122
|
+
this.closeDataEntryFormButton.Text = "Close";
|
123
|
+
this.closeDataEntryFormButton.UseVisualStyleBackColor = true;
|
124
|
+
this.closeDataEntryFormButton.Click += new System.EventHandler(this.closeDataEntryFormButton_Click);
|
125
|
+
//
|
126
|
+
// maskedTextBox1
|
127
|
+
//
|
128
|
+
this.maskedTextBox1.Location = new System.Drawing.Point(254, 147);
|
129
|
+
this.maskedTextBox1.Mask = "(999) 000-0000";
|
130
|
+
this.maskedTextBox1.Name = "maskedTextBox1";
|
131
|
+
this.maskedTextBox1.Size = new System.Drawing.Size(100, 20);
|
132
|
+
this.maskedTextBox1.TabIndex = 12;
|
133
|
+
//
|
134
|
+
// label1
|
135
|
+
//
|
136
|
+
this.label1.AutoSize = true;
|
137
|
+
this.label1.Location = new System.Drawing.Point(138, 150);
|
138
|
+
this.label1.Name = "label1";
|
139
|
+
this.label1.Size = new System.Drawing.Size(76, 13);
|
140
|
+
this.label1.TabIndex = 13;
|
141
|
+
this.label1.Text = "Phone number";
|
142
|
+
//
|
143
|
+
// maskedTextBox2
|
144
|
+
//
|
145
|
+
this.maskedTextBox2.Location = new System.Drawing.Point(425, 280);
|
146
|
+
this.maskedTextBox2.Mask = "00/00/0000";
|
147
|
+
this.maskedTextBox2.Name = "maskedTextBox2";
|
148
|
+
this.maskedTextBox2.Size = new System.Drawing.Size(100, 20);
|
149
|
+
this.maskedTextBox2.TabIndex = 14;
|
150
|
+
this.maskedTextBox2.ValidatingType = typeof(System.DateTime);
|
151
|
+
//
|
152
|
+
// DataEntryForm
|
153
|
+
//
|
154
|
+
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
155
|
+
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
156
|
+
this.ClientSize = new System.Drawing.Size(724, 474);
|
157
|
+
this.Controls.Add(this.maskedTextBox2);
|
158
|
+
this.Controls.Add(this.label1);
|
159
|
+
this.Controls.Add(this.maskedTextBox1);
|
160
|
+
this.Controls.Add(this.closeDataEntryFormButton);
|
161
|
+
this.Controls.Add(this.groupBox3);
|
162
|
+
this.MaximizeBox = false;
|
163
|
+
this.MinimizeBox = false;
|
164
|
+
this.Name = "DataEntryForm";
|
165
|
+
this.ShowInTaskbar = false;
|
166
|
+
this.Text = "DataEntryForm";
|
167
|
+
this.groupBox3.ResumeLayout(false);
|
168
|
+
this.ResumeLayout(false);
|
169
|
+
this.PerformLayout();
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
#endregion
|
174
|
+
|
175
|
+
private System.Windows.Forms.Button deleteItemButton;
|
176
|
+
private System.Windows.Forms.GroupBox groupBox3;
|
177
|
+
private System.Windows.Forms.Button addItemButton;
|
178
|
+
private System.Windows.Forms.ListView personListView;
|
179
|
+
private System.Windows.Forms.ColumnHeader columnName;
|
180
|
+
private System.Windows.Forms.ColumnHeader columnDateOfBirth;
|
181
|
+
private System.Windows.Forms.Button closeDataEntryFormButton;
|
182
|
+
private System.Windows.Forms.MaskedTextBox maskedTextBox1;
|
183
|
+
private System.Windows.Forms.Label label1;
|
184
|
+
private System.Windows.Forms.ColumnHeader columnState;
|
185
|
+
private System.Windows.Forms.MaskedTextBox maskedTextBox2;
|
186
|
+
}
|
187
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Collections.Generic;
|
3
|
+
using System.ComponentModel;
|
4
|
+
using System.Data;
|
5
|
+
using System.Drawing;
|
6
|
+
using System.Linq;
|
7
|
+
using System.Text;
|
8
|
+
using System.Windows.Forms;
|
9
|
+
|
10
|
+
namespace WindowsForms
|
11
|
+
{
|
12
|
+
public partial class DataEntryForm : Form
|
13
|
+
{
|
14
|
+
public DataEntryForm()
|
15
|
+
{
|
16
|
+
InitializeComponent();
|
17
|
+
}
|
18
|
+
|
19
|
+
private void closeDataEntryFormButton_Click(object sender, EventArgs e)
|
20
|
+
{
|
21
|
+
this.Close();
|
22
|
+
}
|
23
|
+
|
24
|
+
private void addItemButton_Click(object sender, EventArgs e)
|
25
|
+
{
|
26
|
+
PersonForm personForm = new PersonForm(this);
|
27
|
+
personForm.Show();
|
28
|
+
}
|
29
|
+
|
30
|
+
public void addPerson(String personName, String dateOfBirth)
|
31
|
+
{
|
32
|
+
ListViewItem newItem = new ListViewItem(personName);
|
33
|
+
newItem.SubItems.Add(dateOfBirth);
|
34
|
+
personListView.Items.Add(newItem);
|
35
|
+
}
|
36
|
+
|
37
|
+
private void deleteItemButton_Click(object sender, EventArgs e)
|
38
|
+
{
|
39
|
+
foreach (ListViewItem item in personListView.SelectedItems)
|
40
|
+
{
|
41
|
+
personListView.Items.Remove(item);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<root>
|
3
|
+
<!--
|
4
|
+
Microsoft ResX Schema
|
5
|
+
|
6
|
+
Version 2.0
|
7
|
+
|
8
|
+
The primary goals of this format is to allow a simple XML format
|
9
|
+
that is mostly human readable. The generation and parsing of the
|
10
|
+
various data types are done through the TypeConverter classes
|
11
|
+
associated with the data types.
|
12
|
+
|
13
|
+
Example:
|
14
|
+
|
15
|
+
... ado.net/XML headers & schema ...
|
16
|
+
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
17
|
+
<resheader name="version">2.0</resheader>
|
18
|
+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
19
|
+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
20
|
+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
21
|
+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
22
|
+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
23
|
+
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
24
|
+
</data>
|
25
|
+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
26
|
+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
27
|
+
<comment>This is a comment</comment>
|
28
|
+
</data>
|
29
|
+
|
30
|
+
There are any number of "resheader" rows that contain simple
|
31
|
+
name/value pairs.
|
32
|
+
|
33
|
+
Each data row contains a name, and value. The row also contains a
|
34
|
+
type or mimetype. Type corresponds to a .NET class that support
|
35
|
+
text/value conversion through the TypeConverter architecture.
|
36
|
+
Classes that don't support this are serialized and stored with the
|
37
|
+
mimetype set.
|
38
|
+
|
39
|
+
The mimetype is used for serialized objects, and tells the
|
40
|
+
ResXResourceReader how to depersist the object. This is currently not
|
41
|
+
extensible. For a given mimetype the value must be set accordingly:
|
42
|
+
|
43
|
+
Note - application/x-microsoft.net.object.binary.base64 is the format
|
44
|
+
that the ResXResourceWriter will generate, however the reader can
|
45
|
+
read any of the formats listed below.
|
46
|
+
|
47
|
+
mimetype: application/x-microsoft.net.object.binary.base64
|
48
|
+
value : The object must be serialized with
|
49
|
+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
50
|
+
: and then encoded with base64 encoding.
|
51
|
+
|
52
|
+
mimetype: application/x-microsoft.net.object.soap.base64
|
53
|
+
value : The object must be serialized with
|
54
|
+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
55
|
+
: and then encoded with base64 encoding.
|
56
|
+
|
57
|
+
mimetype: application/x-microsoft.net.object.bytearray.base64
|
58
|
+
value : The object must be serialized into a byte array
|
59
|
+
: using a System.ComponentModel.TypeConverter
|
60
|
+
: and then encoded with base64 encoding.
|
61
|
+
-->
|
62
|
+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
63
|
+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
64
|
+
<xsd:element name="root" msdata:IsDataSet="true">
|
65
|
+
<xsd:complexType>
|
66
|
+
<xsd:choice maxOccurs="unbounded">
|
67
|
+
<xsd:element name="metadata">
|
68
|
+
<xsd:complexType>
|
69
|
+
<xsd:sequence>
|
70
|
+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
71
|
+
</xsd:sequence>
|
72
|
+
<xsd:attribute name="name" use="required" type="xsd:string" />
|
73
|
+
<xsd:attribute name="type" type="xsd:string" />
|
74
|
+
<xsd:attribute name="mimetype" type="xsd:string" />
|
75
|
+
<xsd:attribute ref="xml:space" />
|
76
|
+
</xsd:complexType>
|
77
|
+
</xsd:element>
|
78
|
+
<xsd:element name="assembly">
|
79
|
+
<xsd:complexType>
|
80
|
+
<xsd:attribute name="alias" type="xsd:string" />
|
81
|
+
<xsd:attribute name="name" type="xsd:string" />
|
82
|
+
</xsd:complexType>
|
83
|
+
</xsd:element>
|
84
|
+
<xsd:element name="data">
|
85
|
+
<xsd:complexType>
|
86
|
+
<xsd:sequence>
|
87
|
+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
88
|
+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
89
|
+
</xsd:sequence>
|
90
|
+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
91
|
+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
92
|
+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
93
|
+
<xsd:attribute ref="xml:space" />
|
94
|
+
</xsd:complexType>
|
95
|
+
</xsd:element>
|
96
|
+
<xsd:element name="resheader">
|
97
|
+
<xsd:complexType>
|
98
|
+
<xsd:sequence>
|
99
|
+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
100
|
+
</xsd:sequence>
|
101
|
+
<xsd:attribute name="name" type="xsd:string" use="required" />
|
102
|
+
</xsd:complexType>
|
103
|
+
</xsd:element>
|
104
|
+
</xsd:choice>
|
105
|
+
</xsd:complexType>
|
106
|
+
</xsd:element>
|
107
|
+
</xsd:schema>
|
108
|
+
<resheader name="resmimetype">
|
109
|
+
<value>text/microsoft-resx</value>
|
110
|
+
</resheader>
|
111
|
+
<resheader name="version">
|
112
|
+
<value>2.0</value>
|
113
|
+
</resheader>
|
114
|
+
<resheader name="reader">
|
115
|
+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
116
|
+
</resheader>
|
117
|
+
<resheader name="writer">
|
118
|
+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
119
|
+
</resheader>
|
120
|
+
</root>
|