public Form1() { InitializeComponent(); { Form form = this; mManager = new PaintManagerUI(); mManager.init(ref form); DialogBuilder builder = new DialogBuilder(true); ControlUI rootNode = builder.createFromFile("login.xml", null, mManager); mManager.attachDialog(ref rootNode); mManager.addNotifier(this); this.ClientSize = mManager.getInitSize(); mRectClient = new Rectangle(0, 0, mManager.getInitSize().Width, mManager.getInitSize().Height); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; rootNode.setPos(new Rectangle(0, 0, this.Size.Width, this.Size.Height)); this.StartPosition = FormStartPosition.CenterScreen; this.MaximumSize = this.ClientSize; init(); } }
/// <summary> /// Takes an exception and creates a generic dialog builder ready /// to build to display the exception. /// </summary> public static DialogBuilder MakeGenericExceptionDialog(this DialogBuilder value, Exception _exception) { return(value.SetTitle("Error!") .SetIcon(DialogBuilder.Icon.ERROR) .SetMessage(_exception.Message) .AddButton("OK", () => Debug.LogError(_exception))); }
protected void OnSaveButtonPressed() { DialogBuilder builder = m_dialogBuilderFactory.Create(); // if save is successful if (m_state.OnSave(m_inputNameField.text)) { builder.SetTitle("Save successful!") .SetMessage("Would you like to keep editing this track or start a new one?\n" + "Or you can race it immediately!") .SetIcon(DialogBuilder.Icon.STAR) .AddButton("Keep Editing", m_state.OnCancel) .AddButton("New Track", m_state.OnNewTrack) .AddButton("Race!", m_state.OnDone); } else { builder.SetTitle("Save unsuccessful!") .SetMessage("Please check the storage of your device or contact the developer.") .SetIcon(DialogBuilder.Icon.WARNING) .AddButton("Back") .AddButton("Try Again", () => m_state.OnSave(m_inputNameField.text)); } builder.Build(); }
public override PlayerDialog SetUp(uint player) { var model = new Model(); // This menu can be entered one of two ways: // 1.) From the player's rest menu. // 2.) From using a crafting fabricator. // If the second event happens, we need to skip over the first page. var state = Craft.GetPlayerCraftingState(player); model.SelectedSkill = state.DeviceSkillType; if (model.SelectedSkill != SkillType.Invalid) { model.IsFabricator = true; } var builder = new DialogBuilder() .WithDataModel(model) .AddBackAction(Back) .AddEndAction(End); if (!model.IsFabricator) { builder.AddPage(MainPageId, MainPageInit); } builder.AddPage(CategoryPageId, CategoryPageInit) .AddPage(RecipeListPageId, RecipeListPageInit) .AddPage(RecipePageId, RecipePageInit); return(builder.Build()); }
public override PlayerDialog SetUp(uint player) { var builder = new DialogBuilder() .AddPage(MainPageId, MainPageInit); return(builder.Build()); }
public Form1() { InitializeComponent(); { Form form = this; mManager = new PaintManagerUI(); mManager.init(ref form); DialogBuilder builder = new DialogBuilder(true); mRootNode = builder.createFromFile("skin.xml", null, mManager); mManager.attachDialog(ref mRootNode); mManager.addNotifier(this); this.ClientSize = mManager.getInitSize(); mRectClient = new Rectangle(0, 0, mManager.getInitSize().Width, mManager.getInitSize().Height); { /*** 创建显示缓存对象 ***/ mRectClient = new Rectangle(0, 0, mManager.getInitSize().Width, mManager.getInitSize().Height); mManager.getBufferManager().tryAllocateBuffer(mRectClient); } this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; mRootNode.setPos(new Rectangle(0, 0, this.Size.Width, this.Size.Height)); this.StartPosition = FormStartPosition.CenterScreen; init(); } }
void OnActionSheetRequested(Page sender, ActionSheetArguments arguments) { // Verify that the page making the request is part of this activity if (!PageIsInThisContext(sender)) { return; } var builder = new DialogBuilder(Activity); builder.SetTitle(arguments.Title); string[] items = arguments.Buttons.ToArray(); builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which])); if (arguments.Cancel != null) { builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel)); } if (arguments.Destruction != null) { builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction)); } var dialog = builder.Create(); builder.Dispose(); //to match current functionality of renderer we set cancelable on outside //and return null dialog.SetCanceledOnTouchOutside(true); dialog.SetCancelEvent((o, e) => arguments.SetResult(null)); dialog.Show(); }
public override PlayerDialog SetUp(uint player) { var dialog = DialogBuilder.Create() .AddPage(MainPageId, MainPageInit) .Build(); return(dialog); }
void OnActionSheetRequested(Page sender, ActionSheetArguments arguments) { // Verify that the page making the request is part of this activity if (!PageIsInThisContext(sender)) { return; } var builder = new DialogBuilder(Activity); builder.SetTitle(arguments.Title); string[] items = arguments.Buttons.ToArray(); builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which])); if (arguments.Cancel != null) { builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel)); } if (arguments.Destruction != null) { builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction)); } var dialog = builder.Create(); builder.Dispose(); //to match current functionality of renderer we set cancelable on outside //and return null if (arguments.FlowDirection == FlowDirection.MatchParent && sender is IVisualElementController ve) { dialog.Window.DecorView.UpdateFlowDirection(ve); } else if (arguments.FlowDirection == FlowDirection.LeftToRight) { dialog.Window.DecorView.LayoutDirection = LayoutDirection.Ltr; } else if (arguments.FlowDirection == FlowDirection.RightToLeft) { dialog.Window.DecorView.LayoutDirection = LayoutDirection.Rtl; } dialog.SetCanceledOnTouchOutside(true); dialog.SetCancelEvent((o, e) => arguments.SetResult(null)); dialog.Show(); dialog.GetListView().TextDirection = GetTextDirection(sender, arguments.FlowDirection); LayoutDirection layoutDirection = GetLayoutDirection(sender, arguments.FlowDirection); if (arguments.Cancel != null) { ((dialog.GetButton((int)DialogButtonType.Positive).Parent) as global::Android.Views.View).LayoutDirection = layoutDirection; } if (arguments.Destruction != null) { ((dialog.GetButton((int)DialogButtonType.Negative).Parent) as global::Android.Views.View).LayoutDirection = layoutDirection; } }
public void Render_Begin_SetsDivWithAttributes() { actual = string.Empty; string expected = "<div id=\"dialog\" data-control-type=\"dialog\"><p></p></div>"; DialogBuilder target = new DialogBuilder("dialog", null); actual = Utility.ControlHtmlBuilder <Dialog, DialogBuilder>(target); Assert.AreEqual(expected, actual); }
public override PlayerDialog SetUp(uint player) { var builder = new DialogBuilder() .WithDataModel(new Model()) .AddPage(MainPageId, MainPageInit) .AddPage(AchievementDetailId, AchievementDetailInit); return(builder.Build()); }
public DialogClass(DialogBuilder dialogBuilder) { this.title = dialogBuilder.title; this.message = dialogBuilder.message; this.positiveButtonText = dialogBuilder.positiveButtonText; this.negativeButtonText = dialogBuilder.negativeButtonText; this.positiveButtonAction = dialogBuilder.positiveButtonAction; this.negativeButtonAction = dialogBuilder.negativeButtonAction; }
public override void OnRootScreenBack() { DialogInterface dialog = DialogBuilder.Create(DialogBuilder.DialogType.CHOICE_DIALOG); dialog.SetMessage("Exit the application?"); dialog.SetOnConfirmListener(() => { Application.Quit(); }); }
public override PlayerDialog SetUp(uint player) { var builder = new DialogBuilder() .WithDataModel(new Model()) .AddInitializationAction(Initialization) .AddPage(MainPageId, MainPageInit); return(builder.Build()); }
public override void OnRootScreenBack() { DialogInterface dialog = DialogBuilder.Create(DialogBuilder.DialogType.CHOICE_DIALOG); dialog.SetMessage("Go back to main menu?"); dialog.SetOnConfirmListener(() => { LoadManager.Instance.LoadScene(SceneNames.MAIN_SCENE); }); }
public void OnMainMenuClicked() { DialogInterface choiceDialog = DialogBuilder.Create(DialogBuilder.DialogType.CHOICE_DIALOG); choiceDialog.SetMessage("Are you sure? All progress wil be lost."); choiceDialog.SetOnConfirmListener(() => { SceneManager.LoadScene(SceneNames.MAIN_MENU_SCENE); }); }
public override void OnRootScreenBack() { base.OnRootScreenBack(); TwoChoiceDialog twoChoiceDialog = (TwoChoiceDialog)DialogBuilder.Create(DialogBuilder.DialogType.CHOICE_DIALOG); twoChoiceDialog.SetMessage("Go back to main menu?"); twoChoiceDialog.SetOnConfirmListener(() => { LoadManager.Instance.LoadScene(SceneNames.MAIN_SCENE); }); }
public void DisplayExitDialog() { Debug.Log("Display"); DialogInterface dialog = DialogBuilder.Create(DialogBuilder.DialogType.CHOICE_DIALOG); dialog.SetMessage("Are you sure you want to go back?"); dialog.SetOnConfirmListener(() => { LoadManager.Instance.LoadScene(SceneNames.MAIN_SCENE); }); }
public void GetDialogPositionTest() { Vector2 bottomPos = DialogBuilder.GetDialogPosition(DialogBoxPosition.Bottom); Vector2 midPos = DialogBuilder.GetDialogPosition(DialogBoxPosition.Middle); Vector2 topPos = DialogBuilder.GetDialogPosition(DialogBoxPosition.Top); Assert.IsTrue(Vector2.Distance(midPos, new Vector2(DialogBuilder.SCREEN_MIDDLE_X, Screen.height / 2.0f)) < 0.001f); Assert.IsTrue(Vector2.Distance(topPos, new Vector2(DialogBuilder.SCREEN_MIDDLE_X, Screen.height - DialogBuilder.BOX_STANDARD_SIZE.y / 2.0f - DialogBuilder.MARGIN)) < 0.001f); Assert.IsTrue(Vector2.Distance(bottomPos, new Vector2(DialogBuilder.SCREEN_MIDDLE_X, DialogBuilder.BOX_STANDARD_SIZE.y / 2.0f + DialogBuilder.MARGIN)) < 0.001f); }
public void DisplayTestDialog() { DialogInterface dialog = DialogBuilder.Create(DialogBuilder.DialogType.NOTIFICATION); dialog.SetMessage("Test"); dialog.SetOnDismissListener(() => { DialogInterface addedDialog = DialogBuilder.Create(DialogBuilder.DialogType.NOTIFICATION); addedDialog.SetMessage("Another test"); }); }
public void Constructor_SetsTagName() { actual = string.Empty; returnHtml = string.Empty; DialogBuilder target = new DialogBuilder("dialogControl", null); returnHtml = Utility.ControlHtmlBuilder <Dialog, DialogBuilder>(target); actual = Utility.GetTagName(returnHtml); Assert.AreEqual(_startTag, actual); }
public void Constructor_SetsControls() { actual = string.Empty; returnHtml = string.Empty; DialogBuilder target = new DialogBuilder("dialogControl", null); returnHtml = Utility.ControlHtmlBuilder <Dialog, DialogBuilder>(target); actual = Utility.GetAttribute(returnHtml, "data-control-bind-source", _startTag); Assert.AreEqual(string.Empty, actual); }
public void Setup() { GameObject builderGO = new GameObject(); _builder = builderGO.AddComponent <DialogBuilder>(); GameObject canvasGO = new GameObject(); _canvas = canvasGO.AddComponent <Canvas>(); _canvas.renderMode = RenderMode.ScreenSpaceOverlay; }
public void Render_Begin_SetsOptions() { actual = string.Empty; string expected = "<div id=\"dialog\" data-control-type=\"dialog\" data-control-options=\"{"modal":true,"autoOpen":false}\"><p></p></div>"; DialogBuilder target = new DialogBuilder("dialog", null); target.Options(option => { option.Modal = true; option.AutoOpen = false; }); actual = Utility.ControlHtmlBuilder <Dialog, DialogBuilder>(target); Assert.AreEqual(expected, actual); }
public void ShowAlertDialog() { DialogClass alertDialogClass = new DialogBuilder(). Title("Alert Dialog !"). Message(" This Is an Alert Message With One Button."). PositiveButtonText("Got It"). PositiveButtonAction(AlertDialogButtonClicked). build(); DialogManager.instance.SpawnDialogBasedOnDialogType(DialogTypeEnum.DialogType.AlertDialog, alertDialogClass); }
public override PlayerDialog SetUp(uint player) { var builder = new DialogBuilder() .WithDataModel(new Model()) .AddPage(MainPageId, MainPageInit) .AddPage(ChangeBattleThemeId, ChangeBattleThemeInit) .AddPage(SongDetailId, SongDetailInit) .AddBackAction(BackAction) .AddEndAction(EndAction); return(builder.Build()); }
public override PlayerDialog SetUp(uint player) { var builder = new DialogBuilder() .WithDataModel(new Model()) .AddInitializationAction(Initialize) .AddEndAction(ClearPlacementGrid) .AddPage(MainPageId, MainPageInit) .AddPage(MovePageId, MovePageInit) .AddPage(RotatePageId, RotatePageInit); return(builder.Build()); }
void OnAlertRequested(IView sender, AlertArguments arguments) { // Verify that the page making the request is part of this activity if (!PageIsInThisContext(sender)) { return; } int messageID = 16908299; var alert = new DialogBuilder(Activity).Create(); if (alert == null) { return; } if (alert.Window != null) { if (arguments.FlowDirection == FlowDirection.MatchParent && sender is IView view) { alert.Window.DecorView.UpdateFlowDirection(view); } else if (arguments.FlowDirection == FlowDirection.LeftToRight) { alert.Window.DecorView.LayoutDirection = LayoutDirection.Ltr; } else if (arguments.FlowDirection == FlowDirection.RightToLeft) { alert.Window.DecorView.LayoutDirection = LayoutDirection.Rtl; } } alert.SetTitle(arguments.Title); alert.SetMessage(arguments.Message); if (arguments.Accept != null) { alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true)); } alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false)); alert.SetCancelEvent((o, args) => { arguments.SetResult(false); }); alert.Show(); TextView textView = (TextView)alert.findViewByID(messageID); textView.TextDirection = GetTextDirection(sender, arguments.FlowDirection); if (alert.GetButton((int)DialogButtonType.Negative).Parent is AView parentView) { parentView.LayoutDirection = GetLayoutDirection(sender, arguments.FlowDirection); } }
void OnPromptRequested(IView sender, PromptArguments arguments) { // Verify that the page making the request is part of this activity if (!PageIsInThisContext(sender)) { return; } var alertDialog = new DialogBuilder(Activity).Create(); if (alertDialog == null) { return; } alertDialog.SetTitle(arguments.Title); alertDialog.SetMessage(arguments.Message); var frameLayout = new FrameLayout(Activity); var editText = new EditText(Activity) { Hint = arguments.Placeholder, Text = arguments.InitialValue }; var layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { LeftMargin = (int)(22 * Activity.Resources.DisplayMetrics.Density), RightMargin = (int)(22 * Activity.Resources.DisplayMetrics.Density) }; editText.LayoutParameters = layoutParams; editText.InputType = arguments.Keyboard.ToInputType(); if (arguments.Keyboard == Keyboard.Numeric) { editText.KeyListener = LocalizedDigitsKeyListener.Create(editText.InputType); } if (arguments.MaxLength > -1) { editText.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(arguments.MaxLength) }); } frameLayout.AddView(editText); alertDialog.SetView(frameLayout); alertDialog.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(editText.Text)); alertDialog.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(null)); alertDialog.SetCancelEvent((o, args) => { arguments.SetResult(null); }); alertDialog.Window.SetSoftInputMode(SoftInput.StateVisible); alertDialog.Show(); editText.RequestFocus(); }
public void GetLocutorWindowPositionTest() { Vector2 bottomPos = DialogBuilder.GetLocutorWindowPosition(DialogBoxPosition.Bottom); Vector2 midPos = DialogBuilder.GetLocutorWindowPosition(DialogBoxPosition.Middle); Vector2 topPos = DialogBuilder.GetLocutorWindowPosition(DialogBoxPosition.Top); Assert.IsTrue(Vector2.Distance(bottomPos, new Vector2(DialogBuilder.SCREEN_MIDDLE_X - DialogBuilder.BOX_STANDARD_SIZE.x / 2.0f + DialogBuilder.LOCUTOR_BOX_STANDARD_SIZE.x / 2.0f, DialogBuilder.BOX_STANDARD_SIZE.y / 2.0f + DialogBuilder.MARGIN + DialogBuilder.LOCUTOR_BOX_Y_OFFSET)) < 0.001f); Assert.IsTrue(Vector2.Distance(topPos, new Vector2(DialogBuilder.SCREEN_MIDDLE_X + DialogBuilder.BOX_STANDARD_SIZE.x / 2.0f - DialogBuilder.LOCUTOR_BOX_STANDARD_SIZE.x / 2.0f, Screen.height - DialogBuilder.BOX_STANDARD_SIZE.y / 2.0f - DialogBuilder.MARGIN - DialogBuilder.LOCUTOR_BOX_Y_OFFSET)) < 0.001f); Assert.IsTrue(Vector2.Distance(midPos, new Vector2(DialogBuilder.SCREEN_MIDDLE_X - DialogBuilder.BOX_STANDARD_SIZE.x / 2.0f + DialogBuilder.LOCUTOR_BOX_STANDARD_SIZE.x / 2.0f, Screen.height / 2.0f + DialogBuilder.LOCUTOR_BOX_Y_OFFSET)) < 0.001f); }
public static void Confirm(String message, Action onConfirm = null, Action onCancel = null) { if (onConfirm == null) { onConfirm = delegate { ViewController.SwitchView(ViewIndex.WORLDMAP_WORLD_MAP); }; } ViewController.SwitchView(delegate { DialogBuilder builder = new DialogBuilder(); builder.SetTitle("###<color=yellow>超級機</color>###"); builder.AddSubView(MenuIcon.Create(MenuIcon.IconType.LUCKYDRAW_DISNEY, null).gameObject); builder.SetMessage(message); builder.AddButton(Locale.t("LABEL_OK"), onConfirm); if (onCancel != null) builder.AddButton(Locale.t("LABEL_CANCEL"), onCancel); builder.Show(); }); }