本文整理汇总了C#中Dialog类的典型用法代码示例。如果您正苦于以下问题:C# Dialog类的具体用法?C# Dialog怎么用?C# Dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dialog类属于命名空间,在下文中一共展示了Dialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
Application app = new Application(null, null);
app.setMargin(new Margin(10));
app.setLayout(new VBoxLayout());
Dialog dialog1 = new Dialog("Dialog 1", Dialog.ButtonOption.NoButtonOption);
ToolButton button1 = new ToolButton("Show dialog 1");
button1.connectClick(new DelegateNotify(dialog1.execute));
app.addWidget(button1);
Dialog dialog2 = new Dialog("Dialog 2", Dialog.ButtonOption.CancelButtonOption);
ToolButton button2 = new ToolButton("Show dialog 2");
button2.connectClick(new DelegateNotify(dialog2.execute));
app.addWidget(button2);
Dialog dialog3 = new Dialog("Dialog 3", Dialog.ButtonOption.OKCancelButtonOption);
ToolButton button3 = new ToolButton("Show dialog 3");
button3.connectClick(new DelegateNotify(dialog3.execute));
app.addWidget(button3);
Dialog dialog4 = new Dialog("Dialog 4", Dialog.ButtonOption.YesNoCancelButtonOption);
ToolButton button4 = new ToolButton("Show dialog 4");
button4.connectClick(new DelegateNotify(dialog4.execute));
app.addWidget(button4);
app.exec();
}
示例2: OnPointerClick
public void OnPointerClick(PointerEventData eventData)
{
if (slices > 0)
{
slices--;
eatSound.Play();
Status food = GameStateManagerScript.Instance.GetStatus(StatusType.Food);
GameStateManagerScript.Instance.Eat(Random.Range(40, 61));
updateTooltip();
}
else
{
Dialog dialog = new Dialog();
dialog.dialogText = "You have no more pizza.";
DialogOption option = new DialogOption();
option.optionText = "Ok";
option.optionId = "ok";
dialog.dialogOptions.Add(option);
if (GameStateManagerScript.Instance.GetStatus(StatusType.Money).points >= 20)
{
option = new DialogOption();
option.optionText = "Order more";
option.optionId = "order";
option.tooltipText = "-20$";
dialog.dialogOptions.Add(option);
}
DialogManagerScript.Instance.ShowDialog(dialog, optionChosen);
}
}
示例3: BattleGUI
internal BattleGUI(ScreenConstants screen, GUIManager manager,
Dialog messageFrame, MessageBox messageBox,
IMenuWidget<MainMenuEntries> mainWidget,
IMenuWidget<Move> moveWidget, IMenuWidget<Pokemon> pokemonWidget,
IMenuWidget<Item> itemWidget, IBattleStateService battleState,
BattleData data)
{
this.battleState = battleState;
playerId = data.PlayerId;
ai = data.Clients.First(id => !id.IsPlayer);
this.moveWidget = moveWidget;
this.itemWidget = itemWidget;
this.mainWidget = mainWidget;
this.pokemonWidget = pokemonWidget;
this.messageBox = messageBox;
this.messageFrame = messageFrame;
InitMessageBox(screen, manager);
InitMainMenu(screen, manager);
InitAttackMenu(screen, manager);
InitItemMenu(screen, manager);
InitPKMNMenu(screen, manager);
}
示例4: Agregar
void Agregar( object o, EventArgs args )
{
// crear dialogo
Dialog dialog = new Dialog ("Agregar", window, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.AddButton ("Aceptar", ResponseType.Ok);
dialog.AddButton ("Cerrar", ResponseType.Close);
Label lab = new Label("Información que desea agregar:");
lab.Show();
dialog.VBox.PackStart (lab , true, true, 5 );
Table table = new Table (2, 2, false);
Label labNombre = new Label("Nombre:");
labNombre.Show();
table.Attach(labNombre , 0, 1, 0, 1);
entryNombre = new Entry();
entryNombre.Show();
table.Attach(entryNombre, 1, 2, 0, 1);
Label labApe = new Label("Apellidos:");
labApe.Show();
table.Attach(labApe , 0, 1, 1, 2);
entryApe = new Entry();
entryApe.Show();
table.Attach(entryApe , 1, 2, 1, 2);
table.Show();
dialog.VBox.PackStart (table, true, true, 5 );
dialog.Response += new ResponseHandler (on_dialog_agregar);
dialog.Run ();
dialog.Destroy ();
}
示例5: HandleButtonButtonAction
static void HandleButtonButtonAction(object sender, TouchEventArgs e)
{
//if (e.TouchEvent == TouchEventType.Down)
{
var dialog = new Dialog();
Label label = new Label();
label.X = 10.0f;
label.Y = 50.0f;
label.Text = "Test Dialog";
Button button = new Button();
button.Text = "Hidding Dialog...";
button.TextColor = new UIColor(1.0f, 0.0f, 0.0f, 1.0f);
button.SetPosition(5.0f, 5.0f);
button.ButtonAction += (s, ea) =>
{
dialog.Hide();
};
dialog.AddChildLast(button);
dialog.AddChildLast(label);
dialog.Show();
}
}
示例6: DialogManager
public DialogManager(Dialog emptyDialog)
{
Check.Required<ArgumentNullException>(() => emptyDialog != null);
_dialog = _emptyDialog = emptyDialog;
emptyDialog.Initialize();
}
示例7: OnPointerClick
public void OnPointerClick(PointerEventData eventData)
{
if (workedToday)
{
Dialog dialog = new Dialog();
dialog.dialogText = "You already went to work today.";
DialogOption option = new DialogOption();
option.optionText = "Ok";
dialog.dialogOptions.Add(option);
DialogManagerScript.Instance.ShowDialog(dialog, noOp);
}
else if (allowWork && GameStateManagerScript.Instance.GetGameTime().hour > 14)
{
Dialog dialog = new Dialog();
dialog.dialogText = "It's too late to go to work now.";
DialogOption option = new DialogOption();
option.optionText = "Ok";
dialog.dialogOptions.Add(option);
DialogManagerScript.Instance.ShowDialog(dialog, noOp);
}
else if (allowWork)
{
Dialog dialog = new Dialog();
dialog.dialogText = "You went to work, you earned 20$.";
DialogOption option = new DialogOption();
option.optionText = "Ok";
dialog.dialogOptions.Add(option);
DialogManagerScript.Instance.ShowDialog(dialog, noOp);
workedToday = true;
GameStateManagerScript.Instance.AdvanceTime(8 * 60 + Random.Range(0, 30));
GameStateManagerScript.Instance.ChangeMoney(20);
}
}
示例8: ShowDialog
internal void ShowDialog(Dialog dialog, Sprite avatar = null, DialogEndAction endAction = null)
{
currentDialog = dialog;
avatarImage.sprite = avatar;
StartCoroutine(getAllLines(endAction));
}
示例9: StartDialog
/**
* Start Dialog is called from Dialog as the trigger to get the DialogGui
* going.
*
* This is broadcast into he GameObject after the DialogGui class is created
* and added to the GameObject. You should not need to use extends or alter
* this method if you are using the DialogGuiAbstract as your base.
*
* This broadcasts DialogStarted into the GameObject after it is called.
*
*/
public void StartDialog(Dialog dialog)
{
Parley.GetInstance().SetInGui(true);
this.dialog=dialog;
// Change camera
if (dialog.dialogCamera!=null){
oldCamera=Camera.main;
// Try calling the camera dolly
dialog.dialogCamera.gameObject.SendMessage("SwitchCamera",SendMessageOptions.DontRequireReceiver);
if (!dialog.dialogCamera.gameObject.activeSelf){
oldCamera.gameObject.SetActive(false);
dialog.dialogCamera.gameObject.SetActive(true);
}
}
// Broadcast to player and this object that we have started a dialog
GameObject.FindWithTag("Player").BroadcastMessage("DialogStarted",dialog,SendMessageOptions.DontRequireReceiver);
BroadcastMessage("DialogStarted",dialog,SendMessageOptions.DontRequireReceiver);
Parley.GetInstance().SetCurrentDialog(dialog);
// Start at the correct dialog
GotoDialogue(null,dialog.GetConversationIndex());
}
示例10: Dialog
public Dialog(Dialog _dialog)
{
name=_dialog.name;
//face=_dialog.face;
text=_dialog.text;
speed=_dialog.speed;
}
示例11: OnButtonIngresarClicked
protected void OnButtonIngresarClicked(object sender, EventArgs e)
{
ControladorBaseDatos Bd = new ControladorBaseDatos();
string[] usuarioClave = new string[2];
usuarioClave = Bd.ObtenerUsuarioContraseñaBd(entryUsuario.Text);
if(usuarioClave[0].Equals(entryUsuario.Text) & usuarioClave[1].Equals(entryClave.Text))
{
//PrincipalWindow principal = new PrincipalWindow(entryUsuario.Text);
VenderProductosDialog principal = new VenderProductosDialog(entryUsuario.Text);
base.Destroy();
principal.Show();
}
else
{
Dialog dialog = new Dialog("Iniciar Sesion", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label();
etiqueta.Markup = "Usuario/Clave incorrectos";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart(etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll();
dialog.Run ();
dialog.Destroy ();
}
}
示例12: Run
public Command Run (WindowFrame transientFor, MessageDescription message)
{
this.icon = GetIcon (message.Icon);
if (ConvertButtons (message.Buttons, out buttons)) {
// Use a system message box
if (message.SecondaryText == null)
message.SecondaryText = String.Empty;
else {
message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
message.SecondaryText = String.Empty;
}
var wb = (WindowFrameBackend)Toolkit.GetBackend (transientFor);
if (wb != null) {
this.dialogResult = MessageBox.Show (wb.Window, message.Text, message.SecondaryText,
this.buttons, this.icon, this.defaultResult, this.options);
}
else {
this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
this.icon, this.defaultResult, this.options);
}
return ConvertResultToCommand (this.dialogResult);
}
else {
// Custom message box required
Dialog dlg = new Dialog ();
dlg.Resizable = false;
dlg.Padding = 0;
HBox mainBox = new HBox { Margin = 25 };
if (message.Icon != null) {
var image = new ImageView (message.Icon.WithSize (32,32));
mainBox.PackStart (image, vpos: WidgetPlacement.Start);
}
VBox box = new VBox () { Margin = 3, MarginLeft = 8, Spacing = 15 };
mainBox.PackStart (box, true);
var text = new Label {
Text = message.Text ?? ""
};
Label stext = null;
box.PackStart (text);
if (!string.IsNullOrEmpty (message.SecondaryText)) {
stext = new Label {
Text = message.SecondaryText
};
box.PackStart (stext);
}
dlg.Buttons.Add (message.Buttons.ToArray ());
if (mainBox.Surface.GetPreferredSize (true).Width > 480) {
text.Wrap = WrapMode.Word;
if (stext != null)
stext.Wrap = WrapMode.Word;
mainBox.WidthRequest = 480;
}
var s = mainBox.Surface.GetPreferredSize (true);
dlg.Content = mainBox;
return dlg.Run ();
}
}
示例13: SetUp
public void SetUp()
{
_responses = Enumerable.Range(1, 3)
.Select(x => "Response" + x)
.ToArray();
_userDialog = new Dialog<string>(string.Empty, string.Empty, _responses);
}
示例14: LoadDialog
public void LoadDialog(Dialog dialog)
{
GameController.Instance ().pause ();
this.dialog = dialog;
speakerIcon.sprite = dialog.speakerImage;
speakerName.text = dialog.speakerName;
dialogContent.text = dialog.getCurrentDialog();
}
示例15: OnButtonEditarNumBoletaClicked
protected void OnButtonEditarNumBoletaClicked(object sender, EventArgs e)
{
numBoleta = this.db.ObtenerBoleta ();
if (Int32.Parse (entryNumBoleta.Text.Trim ()) > numBoleta) {
try {
Venta nuevaVenta = new Venta (Int32.Parse (entryNumBoleta.Text.Trim ()), DateTime.Now.ToString ("yyyy-MM-dd"), "0", "inicioBoletaNueva", Int32.Parse ("0"), usuario_, "false");
db.AgregarVentaBd (nuevaVenta);
entryNumBoleta.Text = "";
Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label ();
etiqueta.Markup = "La operación ha sido realizada con éxito";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart (etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll ();
dialog.Run ();
dialog.Destroy ();
} catch (Exception ex) {
Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label ();
etiqueta.Markup = "Ha ocurrido un error al editar boleta";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart (etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll ();
dialog.Run ();
dialog.Destroy ();
Console.WriteLine ("error editar boleta: " + ex);
}
} else {
Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label ();
etiqueta.Markup = "La boleta ingresada es menor a la del sistema";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart (etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll ();
dialog.Run ();
dialog.Destroy ();
}
}