mohawk 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/.gitignore +24 -17
  2. data/.travis.yml +2 -0
  3. data/Changelog +36 -20
  4. data/Gemfile +3 -3
  5. data/Guardfile +16 -0
  6. data/LICENSE.txt +21 -21
  7. data/README.md +60 -56
  8. data/Rakefile +18 -18
  9. data/features/control.feature +5 -0
  10. data/features/label.feature +4 -4
  11. data/features/link.feature +9 -0
  12. data/features/mohawk.feature +4 -1
  13. data/features/navigation.feature +9 -0
  14. data/features/step_definitions/control_steps.rb +3 -0
  15. data/features/step_definitions/label_steps.rb +3 -3
  16. data/features/step_definitions/link_steps.rb +3 -0
  17. data/features/step_definitions/mohawk_steps.rb +4 -0
  18. data/features/step_definitions/navigation_steps.rb +15 -0
  19. data/features/step_definitions/table_steps.rb +19 -3
  20. data/features/step_definitions/tree_view_steps.rb +4 -0
  21. data/features/support/WindowsForms.exe +0 -0
  22. data/features/support/app/WindowsForms/WindowsForms/AboutBox.Designer.cs +80 -0
  23. data/features/support/app/WindowsForms/WindowsForms/AboutBox.cs +103 -0
  24. data/features/support/app/WindowsForms/WindowsForms/AboutBox.resx +120 -0
  25. data/features/support/app/WindowsForms/WindowsForms/AutomatableMonthCalendar.cs +59 -0
  26. data/features/support/app/WindowsForms/WindowsForms/AutomationHelpers/AutomationProvider.cs +91 -0
  27. data/features/support/app/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +187 -0
  28. data/features/support/app/WindowsForms/WindowsForms/DataEntryForm.cs +46 -0
  29. data/features/support/app/WindowsForms/WindowsForms/DataEntryForm.resx +120 -0
  30. data/features/support/app/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +526 -0
  31. data/features/support/app/WindowsForms/WindowsForms/MainFormWindow.cs +93 -0
  32. data/features/support/app/WindowsForms/WindowsForms/MainFormWindow.resx +123 -0
  33. data/features/support/app/WindowsForms/WindowsForms/PersonForm.Designer.cs +119 -0
  34. data/features/support/app/WindowsForms/WindowsForms/PersonForm.cs +34 -0
  35. data/features/support/app/WindowsForms/WindowsForms/PersonForm.resx +120 -0
  36. data/features/support/app/WindowsForms/WindowsForms/Program.cs +21 -0
  37. data/features/support/app/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs +36 -0
  38. data/features/support/app/WindowsForms/WindowsForms/Properties/Resources.Designer.cs +71 -0
  39. data/features/support/app/WindowsForms/WindowsForms/Properties/Resources.resx +117 -0
  40. data/features/support/app/WindowsForms/WindowsForms/Properties/Settings.Designer.cs +30 -0
  41. data/features/support/app/WindowsForms/WindowsForms/Properties/Settings.settings +7 -0
  42. data/features/support/app/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs +93 -0
  43. data/features/support/app/WindowsForms/WindowsForms/SimpleElementsForm.cs +19 -0
  44. data/features/support/app/WindowsForms/WindowsForms/SimpleElementsForm.resx +120 -0
  45. data/features/support/app/WindowsForms/WindowsForms/WindowsForms.csproj +132 -0
  46. data/features/support/app/WindowsForms/WindowsForms.sln +30 -0
  47. data/features/support/env.rb +28 -17
  48. data/features/support/screens/about_screen.rb +7 -0
  49. data/features/support/screens/data_entry_form.rb +5 -0
  50. data/features/support/screens/main_screen.rb +3 -0
  51. data/features/table.feature +14 -0
  52. data/features/tree_view.feature +3 -0
  53. data/lib/mohawk/accessors/button.rb +6 -4
  54. data/lib/mohawk/accessors/checkbox.rb +7 -5
  55. data/lib/mohawk/accessors/combo.rb +7 -5
  56. data/lib/mohawk/accessors/control.rb +23 -0
  57. data/lib/mohawk/accessors/label.rb +15 -13
  58. data/lib/mohawk/accessors/link.rb +9 -0
  59. data/lib/mohawk/accessors/radio.rb +5 -3
  60. data/lib/mohawk/accessors/table.rb +12 -31
  61. data/lib/mohawk/accessors/table_row.rb +43 -0
  62. data/lib/mohawk/accessors/text.rb +7 -5
  63. data/lib/mohawk/accessors/tree_view.rb +9 -7
  64. data/lib/mohawk/accessors.rb +66 -7
  65. data/lib/mohawk/adapters/uia_adapter.rb +8 -0
  66. data/lib/mohawk/core_ext/string.rb +5 -0
  67. data/lib/mohawk/navigation.rb +6 -2
  68. data/lib/mohawk/version.rb +3 -3
  69. data/lib/mohawk.rb +76 -69
  70. data/mohawk.gemspec +32 -26
  71. data/spec/lib/mohawk/accessors/button_spec.rb +4 -0
  72. data/spec/lib/mohawk/accessors/checkbox_spec.rb +4 -1
  73. data/spec/lib/mohawk/accessors/combo_spec.rb +3 -0
  74. data/spec/lib/mohawk/accessors/control_spec.rb +38 -0
  75. data/spec/lib/mohawk/accessors/label_spec.rb +29 -25
  76. data/spec/lib/mohawk/accessors/link_spec.rb +34 -0
  77. data/spec/lib/mohawk/accessors/radio_spec.rb +4 -0
  78. data/spec/lib/mohawk/accessors/table_spec.rb +52 -7
  79. data/spec/lib/mohawk/accessors/text_spec.rb +4 -0
  80. data/spec/lib/mohawk/accessors/tree_view_spec.rb +5 -0
  81. data/spec/lib/mohawk_spec.rb +19 -0
  82. data/spec/lib/navigation_spec.rb +5 -0
  83. metadata +175 -6
data/.gitignore CHANGED
@@ -1,17 +1,24 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea/
19
+ Debug/
20
+ Release/
21
+ bin/
22
+ obj/
23
+ *.pdb
24
+ *.suo
data/.travis.yml CHANGED
@@ -1 +1,3 @@
1
1
  language: ruby
2
+ notifications:
3
+ webhooks: http://northwoods-projectmonitor.herokuapp.com/projects/10c36e9b-e308-48e0-ba53-1f27639a2da8/status
data/Changelog CHANGED
@@ -1,20 +1,36 @@
1
- === Version 0.2 / 2012-12-26
2
- * Enhancements
3
- * Added the following Mohawk module methods:
4
- * active?
5
- * has_text?
6
- * present?
7
- * wait_until
8
- * wait_until_present
9
- * Added more accessors for working with the following controls:
10
- * label
11
- * menu_item
12
- * table
13
- * tree_view
14
- * Added method to text accessor to simulate typing into a field (helpful for masked edit controls)
15
- * Enhanced navigation to wait until the Window is present before working with it
16
- * Added aliases for table, combo_box and tree_view accessors
17
-
18
- === Version 0.1 / 2012-11-07
19
- Initial release with support for text, button, combo, radio and checkbox
20
- controls
1
+ === Version 0.0.3 / 2013-04-26
2
+ * Enhancements
3
+ * Bumped the RAutomation dependency so we can now interact with controls
4
+ that do not have native window handles (i.e. WPF applications)
5
+ * Added a control accessor for working with generic controls
6
+ * Added _view methods to all accessors to access the underlying driver control
7
+ * Added Mohawk#wait_for_control to block until a child control appears
8
+ * Table improvements
9
+ * access row values by table_name[index]
10
+ * table is now Enumerable
11
+ * added ability to get table headers
12
+ * can get a value of a cell by the name of its header
13
+ * can select Table rows by their value as well
14
+ * Added Mohawk::Accessors#link to work with link controls
15
+ * added ability to define routes with the page_navigation gem
16
+
17
+ === Version 0.0.2 / 2012-12-26
18
+ * Enhancements
19
+ * Added the following Mohawk module methods:
20
+ * active?
21
+ * has_text?
22
+ * present?
23
+ * wait_until
24
+ * wait_until_present
25
+ * Added more accessors for working with the following controls:
26
+ * label
27
+ * menu_item
28
+ * table
29
+ * tree_view
30
+ * Added method to text accessor to simulate typing into a field (helpful for masked edit controls)
31
+ * Enhanced navigation to wait until the Window is present before working with it
32
+ * Added aliases for table, combo_box and tree_view accessors
33
+
34
+ === Version 0.0.1 / 2012-11-07
35
+ Initial release with support for text, button, combo, radio and checkbox
36
+ controls
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'http://rubygems.org'
2
-
3
- gemspec
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,16 @@
1
+ # Guardfile
2
+ notification :tmux,
3
+ :display_message => true,
4
+ :timeout => 5, # in seconds
5
+ :default_message_format => '%s >> %s',
6
+ :line_separator => ' > ', # since we are single line we need a separator
7
+ :color_location => 'status-left-bg' # to customize which tmux element will change color
8
+
9
+ guard 'rspec' do
10
+ watch(%r{^spec/.+_spec\.rb$})
11
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
12
+ watch('lib/mohawk/accessors.rb') { |m| "spec/lib/mohawk/accessors" }
13
+ watch(%r{^lib/mohawk/(.+)\.rb$}) { |m| "spec/lib/mohawk/#{m[1]}_spec.rb" }
14
+ watch(%r{^lib/mohawk/accessors/(.+)\.rb$}) { |m| "spec/lib/mohawk/accessors/#{m[1]}_spec.rb" }
15
+ watch('spec/spec_helper.rb') { "spec" }
16
+ end
data/LICENSE.txt CHANGED
@@ -1,22 +1,22 @@
1
- Copyright (c) 2012 Levi Wilson
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1
+ Copyright (c) 2012 Levi Wilson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,56 +1,60 @@
1
- # Mohawk
2
-
3
- [![Build Status](https://travis-ci.org/leviwilson/mohawk.png)](https://travis-ci.org/leviwilson/mohawk)
4
-
5
- A gem to assist in building page-object like structures for testing Windows applications.
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- gem 'mohawk'
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install mohawk
20
-
21
- ## Example
22
-
23
- ### Defining a screen
24
-
25
- ```ruby
26
- require 'mohawk'
27
-
28
- class LoginScreen
29
- include Mohawk
30
- window(:title => /Login/)
31
-
32
- text(:username, :id => "UserNameField")
33
- text(:password, :id => "PasswordField")
34
-
35
- button(:login, :value => "Login")
36
- end
37
- ```
38
-
39
- ### Using the Page-Object
40
- ```ruby
41
- World(Mohawk::Navigation)
42
-
43
- on(LoginScreen) do |screen|
44
- screen.username = "levi"
45
- screen.password = "secret"
46
- screen.login
47
- end
48
- ```
49
-
50
- ## Contributing
51
-
52
- 1. Fork it
53
- 2. Create your feature branch (`git checkout -b my-new-feature`)
54
- 3. Commit your changes (`git commit -am 'Add some feature'`)
55
- 4. Push to the branch (`git push origin my-new-feature`)
56
- 5. Create new Pull Request
1
+ # Mohawk
2
+
3
+ [![Build Status](https://travis-ci.org/leviwilson/mohawk.png)](https://travis-ci.org/leviwilson/mohawk)
4
+
5
+ A gem to assist in building page-object like structures for testing Windows applications.
6
+
7
+ ## Installation
8
+
9
+ ### Runtime Environment
10
+ In order for `mohawk` to work, you need to have the [.NET 4.0 Framework](http://www.microsoft.com/en-us/download/details.aspx?id=24872) as well as the [C++ Runtime Redistributable](http://www.microsoft.com/en-us/download/details.aspx?id=5555).
11
+
12
+ ### Ruby Environment
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'mohawk'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install mohawk
24
+
25
+ ## Example
26
+
27
+ ### Defining a screen
28
+
29
+ ```ruby
30
+ require 'mohawk'
31
+
32
+ class LoginScreen
33
+ include Mohawk
34
+ window(:title => /Login/)
35
+
36
+ text(:username, :id => "UserNameField")
37
+ text(:password, :id => "PasswordField")
38
+
39
+ button(:login, :value => "Login")
40
+ end
41
+ ```
42
+
43
+ ### Using the Page-Object
44
+ ```ruby
45
+ World(Mohawk::Navigation)
46
+
47
+ on(LoginScreen) do |screen|
48
+ screen.username = "levi"
49
+ screen.password = "secret"
50
+ screen.login
51
+ end
52
+ ```
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,18 +1,18 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require 'rubygems'
4
- require 'cucumber'
5
- require 'cucumber/rake/task'
6
-
7
- RSpec::Core::RakeTask.new(:spec) do |spec|
8
- spec.ruby_opts = "-I lib:spec"
9
- spec.pattern = 'spec/**/*_spec.rb'
10
- spec.rspec_opts = "--color -f documentation"
11
- end
12
- task :spec
13
-
14
- Cucumber::Rake::Task.new(:features) do |t|
15
- t.profile = 'default'
16
- end
17
-
18
- task :default => :spec
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubygems'
4
+ require 'cucumber'
5
+ require 'cucumber/rake/task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec) do |spec|
8
+ spec.ruby_opts = "-I lib:spec"
9
+ spec.pattern = 'spec/**/*_spec.rb'
10
+ spec.rspec_opts = "--color -f documentation"
11
+ end
12
+ task :spec
13
+
14
+ Cucumber::Rake::Task.new(:features) do |t|
15
+ t.profile = 'default'
16
+ end
17
+
18
+ task :default => :spec
@@ -0,0 +1,5 @@
1
+ Feature: Working with controls
2
+
3
+ Scenario: Getting and setting the value of value controls
4
+ When I set the "value control field" to the value "12/25/2012"
5
+ Then the value of the "value control field" control should be "12/25/2012 12:00:00 AM"
@@ -1,4 +1,4 @@
1
- Feature: Working with label controls
2
-
3
- Scenario: Getting the value of the control
4
- Then I know that the "label control" has the value "This is a sample text"
1
+ Feature: Working with label controls
2
+
3
+ Scenario: Getting the value of the control
4
+ Then I know that the "label control" has the value "This is a sample text"
@@ -0,0 +1,9 @@
1
+ Feature: Working with link controls
2
+
3
+ Scenario: Getting the value of the link
4
+ Then I know that the "link control text" has the value "linkLabel1"
5
+
6
+ Scenario: Clicking on the link
7
+ When I click the "link control"
8
+ Then I know that the "link control text" has the value "linkLabel1 (clicked 1 times)"
9
+
@@ -8,7 +8,10 @@ Scenario: Determining if a window is active
8
8
  When we are using the "MainScreen"
9
9
  Then we know that the window is active
10
10
 
11
- @wip
12
11
  Scenario: Determining if a window has text
13
12
  When we are using the "MainScreen"
14
13
  Then we can confirm the window has the text "Assorted UI Elements"
14
+
15
+ Scenario: Waiting for a particular control
16
+ When we are using the "MainScreen"
17
+ Then we can wait for the control with a value of "Data Entry Form"
@@ -0,0 +1,9 @@
1
+ Feature: Navigating by way of routes
2
+
3
+ Scenario: Defining a route through the application
4
+ When we decide to go a roundabout way to the datagrid
5
+ Then we should still arrive at our destination
6
+
7
+ Scenario: Giving extra information to the screen
8
+ When we give extra navigational information to a screen
9
+ Then it should listen to every word that we say
@@ -0,0 +1,3 @@
1
+ Then /^the value of the "([^"]*)" control should be "(.*?)"$/ do |which, what|
2
+ on(MainScreen).send("#{which.to_method}_value").should eq(what)
3
+ end
@@ -1,3 +1,3 @@
1
- Then /^I know that the "(.*?)" has the value "(.*?)"$/ do |name, value|
2
- on(MainScreen).send(name.to_field).should eq(value)
3
- end
1
+ Then /^I know that the "(.*?)" has the value "(.*?)"$/ do |name, value|
2
+ on(MainScreen).send(name.to_field).should eq(value)
3
+ end
@@ -0,0 +1,3 @@
1
+ When /^I click the "([^"]*)"$/ do |name|
2
+ on(MainScreen).send("click_#{name.to_field}")
3
+ end
@@ -13,3 +13,7 @@ end
13
13
  Then /^we can confirm the window has the text "(.*?)"$/ do |what_text|
14
14
  @screen.should have_text(what_text)
15
15
  end
16
+
17
+ Then /^we can wait for the control with a value of "(.*?)"$/ do |value|
18
+ @screen.wait_for_control :value => value
19
+ end
@@ -0,0 +1,15 @@
1
+ When /^we decide to go a roundabout way to the datagrid$/ do
2
+ navigate_to(DataEntryForm)
3
+ end
4
+
5
+ Then /^we should still arrive at our destination$/ do
6
+ on(DataEntryForm).should be_active
7
+ end
8
+
9
+ When /^we give extra navigational information to a screen$/ do
10
+ @which_screen = on(MainScreen, :pid => @process.pid)
11
+ end
12
+
13
+ Then /^it should listen to every word that we say$/ do
14
+ @which_screen.should be_present
15
+ end
@@ -6,18 +6,34 @@ end
6
6
  Then /^the table row information should look like the following:$/ do |row_items|
7
7
  row_items.map_column!("row") { |r| r.to_i }
8
8
  row_items.map_headers!("text" => :text, "row" => :row)
9
- on(DataEntryForm).people_rows.should eq row_items.hashes
9
+ on(DataEntryForm).people.map(&:to_hash).should eq row_items.hashes
10
10
  end
11
11
 
12
12
  When /^we select the table row with index "(.*?)"$/ do |row_index|
13
13
  on(DataEntryForm).people = row_index.to_i
14
14
  end
15
15
 
16
+ When /^we select the table row with the value "([^"]*)"$/ do |row_value|
17
+ on(DataEntryForm).people = row_value
18
+ end
19
+
20
+ When /^we select the "(.*?)"th table row$/ do |index|
21
+ on(DataEntryForm).people[index.to_i].select
22
+ end
23
+
16
24
  Then /^the row with index "(.*?)" should be selected$/ do |which_row|
17
- on(DataEntryForm).people_row(which_row.to_i).should be_selected
25
+ on(DataEntryForm).people[which_row.to_i].should be_selected
18
26
  end
19
27
 
20
28
  Then /^the row with index "(.*?)" should look like the following:$/ do |which_row, table|
21
- actual_cells = on(DataEntryForm).people_row(which_row.to_i).cells
29
+ actual_cells = on(DataEntryForm).people[which_row.to_i].cells
22
30
  actual_cells.should eq table.rows.first
23
31
  end
32
+
33
+ Then /^the table headers are "(.*?)"$/ do |expected_headers|
34
+ on(DataEntryForm).people_headers.should eq(expected_headers.split(", "))
35
+ end
36
+
37
+ Then /^the "(.*?)" for the row at index "(.*?)" is "(.*?)"$/ do |header, which_row, expected_value|
38
+ on(DataEntryForm).people[which_row.to_i].send(header).should eq(expected_value)
39
+ end
@@ -29,3 +29,7 @@ end
29
29
  When /^I collapse the tree item "(.*?)"$/ do |which_item|
30
30
  on(MainScreen).collapse_tree_view_item which_item
31
31
  end
32
+
33
+ Then /^I am able to interact with the raw tree view$/ do
34
+ on(MainScreen).tree_view_view.should be_visible
35
+ end
Binary file
@@ -0,0 +1,80 @@
1
+ namespace WindowsForms
2
+ {
3
+ partial class AboutBox
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
+ protected override void Dispose(bool disposing)
14
+ {
15
+ if (disposing && (components != null))
16
+ {
17
+ components.Dispose();
18
+ }
19
+ base.Dispose(disposing);
20
+ }
21
+
22
+ #region Windows Form Designer generated code
23
+
24
+ /// <summary>
25
+ /// Required method for Designer support - do not modify
26
+ /// the contents of this method with the code editor.
27
+ /// </summary>
28
+ private void InitializeComponent()
29
+ {
30
+ this.label1 = new System.Windows.Forms.Label();
31
+ this.button1 = new System.Windows.Forms.Button();
32
+ this.SuspendLayout();
33
+ //
34
+ // label1
35
+ //
36
+ this.label1.AutoSize = true;
37
+ this.label1.Location = new System.Drawing.Point(12, 9);
38
+ this.label1.Name = "label1";
39
+ this.label1.Size = new System.Drawing.Size(303, 13);
40
+ this.label1.TabIndex = 0;
41
+ this.label1.Text = "This is the about dialog for the RAutomation sample application";
42
+ //
43
+ // button1
44
+ //
45
+ this.button1.Location = new System.Drawing.Point(141, 80);
46
+ this.button1.Name = "button1";
47
+ this.button1.Size = new System.Drawing.Size(75, 23);
48
+ this.button1.TabIndex = 1;
49
+ this.button1.Text = "OK";
50
+ this.button1.UseVisualStyleBackColor = true;
51
+ this.button1.Click += new System.EventHandler(this.button1_Click);
52
+ //
53
+ // AboutBox
54
+ //
55
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
56
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
57
+ this.ClientSize = new System.Drawing.Size(339, 115);
58
+ this.Controls.Add(this.button1);
59
+ this.Controls.Add(this.label1);
60
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
61
+ this.MaximizeBox = false;
62
+ this.MinimizeBox = false;
63
+ this.Name = "AboutBox";
64
+ this.Padding = new System.Windows.Forms.Padding(9);
65
+ this.ShowIcon = false;
66
+ this.ShowInTaskbar = false;
67
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
68
+ this.Text = "About";
69
+ this.ResumeLayout(false);
70
+ this.PerformLayout();
71
+
72
+ }
73
+
74
+ #endregion
75
+
76
+ private System.Windows.Forms.Label label1;
77
+ private System.Windows.Forms.Button button1;
78
+
79
+ }
80
+ }
@@ -0,0 +1,103 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.ComponentModel;
4
+ using System.Drawing;
5
+ using System.Linq;
6
+ using System.Reflection;
7
+ using System.Windows.Forms;
8
+
9
+ namespace WindowsForms
10
+ {
11
+ partial class AboutBox : Form
12
+ {
13
+ public AboutBox()
14
+ {
15
+ InitializeComponent();
16
+ }
17
+
18
+ #region Assembly Attribute Accessors
19
+
20
+ public string AssemblyTitle
21
+ {
22
+ get
23
+ {
24
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
25
+ if (attributes.Length > 0)
26
+ {
27
+ AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
28
+ if (titleAttribute.Title != "")
29
+ {
30
+ return titleAttribute.Title;
31
+ }
32
+ }
33
+ return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
34
+ }
35
+ }
36
+
37
+ public string AssemblyVersion
38
+ {
39
+ get
40
+ {
41
+ return Assembly.GetExecutingAssembly().GetName().Version.ToString();
42
+ }
43
+ }
44
+
45
+ public string AssemblyDescription
46
+ {
47
+ get
48
+ {
49
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
50
+ if (attributes.Length == 0)
51
+ {
52
+ return "";
53
+ }
54
+ return ((AssemblyDescriptionAttribute)attributes[0]).Description;
55
+ }
56
+ }
57
+
58
+ public string AssemblyProduct
59
+ {
60
+ get
61
+ {
62
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
63
+ if (attributes.Length == 0)
64
+ {
65
+ return "";
66
+ }
67
+ return ((AssemblyProductAttribute)attributes[0]).Product;
68
+ }
69
+ }
70
+
71
+ public string AssemblyCopyright
72
+ {
73
+ get
74
+ {
75
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
76
+ if (attributes.Length == 0)
77
+ {
78
+ return "";
79
+ }
80
+ return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
81
+ }
82
+ }
83
+
84
+ public string AssemblyCompany
85
+ {
86
+ get
87
+ {
88
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
89
+ if (attributes.Length == 0)
90
+ {
91
+ return "";
92
+ }
93
+ return ((AssemblyCompanyAttribute)attributes[0]).Company;
94
+ }
95
+ }
96
+ #endregion
97
+
98
+ private void button1_Click(object sender, EventArgs e)
99
+ {
100
+ this.Close();
101
+ }
102
+ }
103
+ }