1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace BlogSample
.UI
17 using System
.Windows
.Forms
;
19 public class BlogForm
: Form
21 private GroupBox groupBox1
;
24 private TextBox authorText
;
25 private TextBox nameText
;
26 private Button closeButton
;
27 private Button saveButton
;
28 private System
.ComponentModel
.Container components
= null;
30 private readonly Blog currentBlog
;
34 InitializeComponent();
36 currentBlog
= new Blog();
39 public BlogForm(Blog blog
) : this()
43 nameText
.Text
= currentBlog
.Name
;
44 authorText
.Text
= currentBlog
.Author
;
48 /// Clean up any resources being used.
50 protected override void Dispose( bool disposing
)
54 if(components
!= null)
59 base.Dispose( disposing
);
62 #region Windows Form Designer generated code
64 /// Required method for Designer support - do not modify
65 /// the contents of this method with the code editor.
67 private void InitializeComponent()
69 this.groupBox1
= new System
.Windows
.Forms
.GroupBox();
70 this.authorText
= new System
.Windows
.Forms
.TextBox();
71 this.label2
= new System
.Windows
.Forms
.Label();
72 this.nameText
= new System
.Windows
.Forms
.TextBox();
73 this.label1
= new System
.Windows
.Forms
.Label();
74 this.closeButton
= new System
.Windows
.Forms
.Button();
75 this.saveButton
= new System
.Windows
.Forms
.Button();
76 this.groupBox1
.SuspendLayout();
81 this.groupBox1
.Controls
.Add(this.authorText
);
82 this.groupBox1
.Controls
.Add(this.label2
);
83 this.groupBox1
.Controls
.Add(this.nameText
);
84 this.groupBox1
.Controls
.Add(this.label1
);
85 this.groupBox1
.Location
= new System
.Drawing
.Point(8, 8);
86 this.groupBox1
.Name
= "groupBox1";
87 this.groupBox1
.Size
= new System
.Drawing
.Size(456, 128);
88 this.groupBox1
.TabIndex
= 1;
89 this.groupBox1
.TabStop
= false;
90 this.groupBox1
.Text
= "Blog:";
94 this.authorText
.Location
= new System
.Drawing
.Point(160, 72);
95 this.authorText
.Name
= "authorText";
96 this.authorText
.Size
= new System
.Drawing
.Size(232, 21);
97 this.authorText
.TabIndex
= 3;
98 this.authorText
.Text
= "";
102 this.label2
.Location
= new System
.Drawing
.Point(40, 72);
103 this.label2
.Name
= "label2";
104 this.label2
.TabIndex
= 2;
105 this.label2
.Text
= "Author:";
109 this.nameText
.Location
= new System
.Drawing
.Point(160, 40);
110 this.nameText
.Name
= "nameText";
111 this.nameText
.Size
= new System
.Drawing
.Size(232, 21);
112 this.nameText
.TabIndex
= 1;
113 this.nameText
.Text
= "";
117 this.label1
.Location
= new System
.Drawing
.Point(40, 40);
118 this.label1
.Name
= "label1";
119 this.label1
.TabIndex
= 0;
120 this.label1
.Text
= "Blog Name:";
124 this.closeButton
.DialogResult
= System
.Windows
.Forms
.DialogResult
.Cancel
;
125 this.closeButton
.Location
= new System
.Drawing
.Point(242, 152);
126 this.closeButton
.Name
= "closeButton";
127 this.closeButton
.Size
= new System
.Drawing
.Size(104, 23);
128 this.closeButton
.TabIndex
= 6;
129 this.closeButton
.Text
= "Close";
130 this.closeButton
.Click
+= new System
.EventHandler(this.closeButton_Click
);
134 this.saveButton
.Location
= new System
.Drawing
.Point(126, 152);
135 this.saveButton
.Name
= "saveButton";
136 this.saveButton
.Size
= new System
.Drawing
.Size(104, 23);
137 this.saveButton
.TabIndex
= 7;
138 this.saveButton
.Text
= "Save";
139 this.saveButton
.Click
+= new System
.EventHandler(this.saveButton_Click
);
143 this.AutoScaleBaseSize
= new System
.Drawing
.Size(5, 14);
144 this.CancelButton
= this.closeButton
;
145 this.ClientSize
= new System
.Drawing
.Size(472, 190);
146 this.Controls
.Add(this.saveButton
);
147 this.Controls
.Add(this.closeButton
);
148 this.Controls
.Add(this.groupBox1
);
149 this.Font
= new System
.Drawing
.Font("Tahoma", 8.25F
, System
.Drawing
.FontStyle
.Regular
, System
.Drawing
.GraphicsUnit
.Point
, ((System
.Byte
)(0)));
150 this.FormBorderStyle
= System
.Windows
.Forms
.FormBorderStyle
.FixedDialog
;
151 this.MaximizeBox
= false;
152 this.MinimizeBox
= false;
153 this.Name
= "BlogForm";
154 this.Text
= "BlogForm";
155 this.groupBox1
.ResumeLayout(false);
156 this.ResumeLayout(false);
161 private void closeButton_Click(object sender
, System
.EventArgs e
)
163 DialogResult
= DialogResult
.Cancel
;
168 private void saveButton_Click(object sender
, System
.EventArgs e
)
170 currentBlog
.Name
= nameText
.Text
;
171 currentBlog
.Author
= authorText
.Text
;
174 DialogResult
= DialogResult
.OK
;