forked from extnet/Ext.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessageBox.Prompt.cs
More file actions
207 lines (189 loc) · 14.4 KB
/
MessageBox.Prompt.cs
File metadata and controls
207 lines (189 loc) · 14.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/********
* @version : 2.1.1 - Ext.NET Pro License
* @author : Ext.NET, Inc. http://www.ext.net/
* @date : 2012-12-10
* @copyright : Copyright (c) 2007-2012, Ext.NET, Inc. (http://www.ext.net/). All rights reserved.
* @license : See license.txt and http://www.ext.net/license/.
********/
using System.ComponentModel;
using System.Web.UI.WebControls;
using Ext.Net.Utilities;
namespace Ext.Net
{
/// <summary>
///
/// </summary>
public partial class MessageBox
{
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
public MessageBox Prompt(string title, object msg)
{
return this.Prompt(title, msg.ToString());
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
public MessageBox Prompt(string title, string msg)
{
return this.Prompt(title, msg, "");
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="fn">(optional) The callback function invoked after the message box is closed</param>
public MessageBox Prompt(string title, string msg, JFunction fn)
{
return this.Prompt(title, msg, fn, "");
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="handler">(optional) The callback function invoked after the message box is closed</param>
public MessageBox Prompt(string title, string msg, string handler)
{
return this.Prompt(title, msg, handler, "");
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="handler">(optional) The callback function invoked after the message box is closed</param>
/// <param name="scope">(optional) The scope of the callback function</param>
[Description("Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.")]
public MessageBox Prompt(string title, string msg, string handler, string scope)
{
return this.Prompt(title, msg, handler.IsNotEmpty() ? new JFunction(handler, "buttonId", "text") : null as JFunction, scope);
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="fn">(optional) The callback function invoked after the message box is closed</param>
/// <param name="scope">(optional) The scope of the callback function</param>
public MessageBox Prompt(string title, string msg, JFunction fn, string scope)
{
return this.Prompt(title, msg, fn, scope, false, "");
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="fn">(optional) The callback function invoked after the message box is closed</param>
/// <param name="scope">(optional) The scope of the callback function</param>
/// <param name="multiline">(optional) True to create a multiline textbox using the defaultTextHeight property, or the height in pixels to create the textbox (defaults to false / single-line)</param>
/// <param name="value">(optional) Default value of the text input element (defaults to '')</param>
public MessageBox Prompt(string title, string msg, JFunction fn, string scope, bool multiline, string value)
{
MessageBoxConfig config = new MessageBoxConfig();
config.Title = title;
config.Message = msg;
config.Buttons = Button.OKCANCEL;
config.Fn = fn;
config.MinWidth = Unit.Pixel(250);
config.Scope = scope;
config.Prompt = true;
config.Multiline = multiline;
config.Value = value;
return this.Configure(config);
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="fn">(optional) The callback function invoked after the message box is closed</param>
/// <param name="scope">(optional) The scope of the callback function</param>
/// <param name="multiline">(optional) True to create a multiline textbox using the defaultTextHeight property, or the height in pixels to create the textbox (defaults to false / single-line)</param>
/// <param name="value">(optional) Default value of the text input element (defaults to '')</param>
public MessageBox Prompt(string title, string msg, JFunction fn, string scope, Unit multiline, string value)
{
MessageBoxConfig config = new MessageBoxConfig();
config.Title = title;
config.Message = msg;
config.Buttons = Button.OKCANCEL;
config.Fn = fn;
config.MinWidth = Unit.Pixel(250);
config.Scope = scope;
config.Prompt = true;
config.MultilineHeight = multiline;
config.Value = value;
return this.Configure(config);
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="buttonsConfig">A MessageBoxButtonsConfig object for configuring the Text value and JavaScript Handler for each MessageBox Button.</param>
public MessageBox Prompt(string title, string msg, MessageBoxButtonsConfig buttonsConfig)
{
MessageBoxConfig config = new MessageBoxConfig();
config.Title = title;
config.Message = msg;
config.Buttons = Button.OKCANCEL;
config.MessageBoxButtonsConfig = buttonsConfig;
config.MinWidth = Unit.Pixel(250);
config.Prompt = true;
return this.Configure(config);
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="buttonsConfig">A MessageBoxButtonsConfig object for configuring the Text value and JavaScript Handler for each MessageBox Button.</param>
/// <param name="scope">(optional) The scope of the callback function</param>
/// <param name="multiline">(optional) True to create a multiline textbox using the defaultTextHeight property, or the height in pixels to create the textbox (defaults to false / single-line)</param>
/// <param name="value">(optional) Default value of the text input element (defaults to '')</param>
public MessageBox Prompt(string title, string msg, MessageBoxButtonsConfig buttonsConfig, string scope, bool multiline, string value)
{
MessageBoxConfig config = new MessageBoxConfig();
config.Title = title;
config.Message = msg;
config.Buttons = Button.OKCANCEL;
config.MessageBoxButtonsConfig = buttonsConfig;
config.MinWidth = Unit.Pixel(250);
config.Scope = scope;
config.Prompt = true;
config.Multiline = multiline;
config.Value = value;
return this.Configure(config);
}
/// <summary>
/// Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback.
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
/// <param name="buttonsConfig">A MessageBoxButtonsConfig object for configuring the Text value and JavaScript Handler for each MessageBox Button.</param>
/// <param name="scope">(optional) The scope of the callback function</param>
/// <param name="multiline">(optional) True to create a multiline textbox using the defaultTextHeight property, or the height in pixels to create the textbox (defaults to false / single-line)</param>
/// <param name="value">(optional) Default value of the text input element (defaults to '')</param>
public MessageBox Prompt(string title, string msg, MessageBoxButtonsConfig buttonsConfig, string scope, Unit multiline, string value)
{
MessageBoxConfig config = new MessageBoxConfig();
config.Title = title;
config.Message = msg;
config.Buttons = Button.OKCANCEL;
config.MessageBoxButtonsConfig = buttonsConfig;
config.MinWidth = Unit.Pixel(250);
config.Scope = scope;
config.Prompt = true;
config.MultilineHeight = multiline;
config.Value = value;
return this.Configure(config);
}
}
}