forked from extnet/Ext.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessageBox.Confirm.cs
More file actions
138 lines (125 loc) · 9.79 KB
/
MessageBox.Confirm.cs
File metadata and controls
138 lines (125 loc) · 9.79 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
/********
* @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 Ext.Net.Utilities;
namespace Ext.Net
{
/// <summary>
///
/// </summary>
public partial class MessageBox
{
/// <summary>
/// Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). 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 will be passed as the only parameter to the callback (could also be the top-right close button).
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
[Description("Displays a standard read-only message box with an OK button (comparable to the basic JavaScript confirm prompt). If a callback function is passed it will be called after the user clicks the button, and the id of the button that was clicked will be passed as the only parameter to the callback (could also be the top-right close button).")]
public MessageBox Confirm(string title, object msg)
{
return this.Confirm(title, msg.ToString());
}
/// <summary>
/// Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). 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 will be passed as the only parameter to the callback (could also be the top-right close button).
/// </summary>
/// <param name="title">The title bar text</param>
/// <param name="msg">The message box body text</param>
[Description("Displays a standard read-only message box with an OK button (comparable to the basic JavaScript confirm prompt). If a callback function is passed it will be called after the user clicks the button, and the id of the button that was clicked will be passed as the only parameter to the callback (could also be the top-right close button).")]
public MessageBox Confirm(string title, string msg)
{
return this.Confirm(title, msg, "", "");
}
/// <summary>
/// Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). 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 will be passed as the only parameter to the callback (could also be the top-right close button).
/// </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>
[Description("Displays a standard read-only message box with an OK button (comparable to the basic JavaScript confirm prompt). If a callback function is passed it will be called after the user clicks the button, and the id of the button that was clicked will be passed as the only parameter to the callback (could also be the top-right close button).")]
public MessageBox Confirm(string title, string msg, JFunction fn)
{
return this.Confirm(title, msg, fn, "");
}
/// <summary>
/// Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). 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 will be passed as the only parameter to the callback (could also be the top-right close button).
/// </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>
[Description("Displays a standard read-only message box with an OK button (comparable to the basic JavaScript confirm prompt). If a callback function is passed it will be called after the user clicks the button, and the id of the button that was clicked will be passed as the only parameter to the callback (could also be the top-right close button).")]
public MessageBox Confirm(string title, string msg, string handler)
{
return this.Confirm(title, msg, handler, "");
}
/// <summary>
/// Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). 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 will be passed as the only parameter to the callback (could also be the top-right close button).
/// </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 standard read-only message box with an OK button (comparable to the basic JavaScript confirm prompt). If a callback function is passed it will be called after the user clicks the button, and the id of the button that was clicked will be passed as the only parameter to the callback (could also be the top-right close button).")]
public MessageBox Confirm(string title, string msg, string handler, string scope)
{
return this.Confirm(title, msg, handler.IsNotEmpty() ? new JFunction(handler, "buttonId", "text") : null as JFunction, scope);
}
/// <summary>
/// Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). 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 will be passed as the only parameter to the callback (could also be the top-right close button).
/// </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>
[Description("Displays a standard read-only message box with an OK button (comparable to the basic JavaScript confirm prompt). If a callback function is passed it will be called after the user clicks the button, and the id of the button that was clicked will be passed as the only parameter to the callback (could also be the top-right close button).")]
public MessageBox Confirm(string title, string msg, JFunction fn, string scope)
{
MessageBoxConfig config = new MessageBoxConfig();
config.Title = title;
config.Message = msg;
config.Buttons = Button.YESNO;
config.Fn = fn;
config.Scope = scope;
config.Icon = Icon.QUESTION;
return this.Configure(config);
}
/// <summary>
/// Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). 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 will be passed as the only parameter to the callback (could also be the top-right close button).
/// </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 Confirm(string title, string msg, MessageBoxButtonsConfig buttonsConfig)
{
MessageBoxConfig config = new MessageBoxConfig();
config.Title = title;
config.Message = msg;
config.Buttons = Button.YESNO;
config.MessageBoxButtonsConfig = buttonsConfig;
config.Icon = Icon.QUESTION;
return this.Configure(config);
}
/// <summary>
/// Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). 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 will be passed as the only parameter to the callback (could also be the top-right close button).
/// </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>
public MessageBox Confirm(string title, string msg, MessageBoxButtonsConfig buttonsConfig, string scope)
{
MessageBoxConfig config = new MessageBoxConfig();
config.Title = title;
config.Message = msg;
config.Buttons = Button.YESNO;
config.MessageBoxButtonsConfig = buttonsConfig;
config.Scope = scope;
config.Icon = Icon.QUESTION;
return this.Configure(config);
}
}
}