Example #1
0
        private async Task HandleSubmit(QuestionItem model)
        {
            ResponseModelBase response;

            if (string.IsNullOrEmpty(model.Id))
            {
                response = await _questionService.CreateQuestion(model);
            }
            else
            {
                response = await _questionService.UpdateQuestion(model.Id, model);
            }

            if (response.isSuccessful)
            {
                ModalForm.HideModal();

                await Filter();

                if (string.IsNullOrEmpty(model.Id))
                {
                    toastService.ShowSuccess("Assessment added successfully");
                }
                else
                {
                    toastService.ShowSuccess("Assessment updated successfully");
                }
            }
            else
            {
                toastService.ShowError(response.message);
            }
        }
Example #2
0
        private async Task OpenForEdit(string assessmentId)
        {
            var assessment = Assessments.First(u => u.Id == assessmentId);

            AssessmentItem = assessment;

            ModalForm.ShowModal();
        }
Example #3
0
 public static void DisplayModal(ModalForm parModalForm)
 {
     if (LocalData.IsReady)
     {
         LocalData.btModal.Show(parModalForm);
     }
     else
     {
         AddMessage("Not ready yet, please try again", true, false);
     }
 }
        private void ExecuteReviewOrder(Player player, CustomForm form)
        {
            var modalForm = new ModalForm();

            modalForm.ExecuteAction = ExecutePayment;
            modalForm.Title         = "Review Order";
            modalForm.Content       = "§lPlease review your ordering information below.§r\nProduct: Mega coins extra pack.\nYour total: $3.99 USD\nPayment method: VISA ************59 $3.99 USD\n";
            modalForm.Button1       = "§2§lBuy now";
            modalForm.Button2       = "Cancel";

            player.SendForm(modalForm);
        }
Example #5
0
        private async Task HandleSubmit(AssessmentItem model)
        {
            AssessmentResponseModel response;

            if (string.IsNullOrEmpty(model.Id))
            {
                response = await _assessmentService.CreateAssessment(model);
            }
            else
            {
                response = await _assessmentService.UpdateAssessment(model.Id, model);
            }

            if (response.isSuccessful)
            {
                var assessmentItem = response.data;

                if (string.IsNullOrEmpty(model.Id))
                {
                    Assessments = Assessments.Prepend(assessmentItem).ToList();

                    toastService.ShowSuccess("Assessment added successfully");
                }
                else
                {
                    var item = Assessments.First(u => u.Id == model.Id);

                    item.Duration     = assessmentItem.Duration;
                    item.Instructions = assessmentItem.Instructions;
                    item.Name         = assessmentItem.Name;


                    toastService.ShowSuccess("Assessment updated successfully");
                }


                RefreshAssessments(SearchText);

                ModalForm.HideModal();

                StateHasChanged();
            }
            else
            {
                Console.WriteLine(response.message);
            }
        }
Example #6
0
	public MainForm ()
	{
		// 
		// _sfd
		// 
		_sfd = new SaveFileDialog ();
		_sfd.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
		// 
		// _saveFileButton
		// 
		_saveFileButton = new Button ();
		_saveFileButton.Location = new Point (25, 25);
		_saveFileButton.Size = new Size (80, 20);
		_saveFileButton.Text = "Save File";
		_saveFileButton.Click += new EventHandler (SaveFileButton_Click);
		Controls.Add (_saveFileButton);
		// 
		// _modalForm
		// 
		_modalForm = new ModalForm ();
		// 
		// _showModalFormButton
		// 
		_showModalFormButton = new Button ();
		_showModalFormButton.Location = new Point (150, 25);
		_showModalFormButton.Size = new Size (120, 20);
		_showModalFormButton.Text = "Show Modal Form";
		_showModalFormButton.Click += new EventHandler (ShowModalFormButton_Click);
		Controls.Add (_showModalFormButton);
		// 
		// MainForm
		// 
		Location = new Point (250, 100);
		Size = new Size (300, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82187";
		Load += new EventHandler (MainForm_Load);
	}
        private void ExecutePayment(Player player, ModalForm modal)
        {
            StripeConfiguration.SetApiKey("sk_test_****************************");             // Add your API key here

            double amount = 1.90;

            var chargeOptions = new StripeChargeCreateOptions()
            {
                Amount      = (int?)(amount * 100),
                Currency    = "usd",
                Description = "Charge for [email protected]",
                SourceCard  = new SourceCard()
                {
                    Number          = "4242424242424242",
                    ExpirationMonth = 01,
                    ExpirationYear  = 2025,
                    Cvc             = "111",
                    Capture         = true
                },
            };

            var          chargeService = new StripeChargeService();
            StripeCharge charge        = chargeService.Create(chargeOptions);
        }
Example #8
0
        /// <inheritdoc />
        public ModalFormDialog(uint formId, BedrockFormManager parent, ModalForm form, InputManager inputManager) : base(
                formId, parent, inputManager)
        {
            Background = Color.Transparent;

            var width  = 356;
            var height = width;

            ContentContainer.Width  = ContentContainer.MinWidth = ContentContainer.MaxWidth = width;
            ContentContainer.Height = ContentContainer.MinHeight = ContentContainer.MaxHeight = height;

            SetFixedSize(width, height);

            ContentContainer.AutoSizeMode = AutoSizeMode.None;

            Container.Anchor = Alignment.MiddleCenter;

            Container.AddChild(Footer = new GuiMultiStackContainer(row =>
            {
                row.Anchor = Alignment.BottomFill;
                //row.Orientation = Orientation.Horizontal;
                row.ChildAnchor = Alignment.BottomFill;
                //row.Margin = new Thickness(3);
                row.Width    = 356;
                row.MaxWidth = 356;
            })
            {
                Height = 24,

                Orientation = Orientation.Vertical,
                Anchor      = Alignment.BottomFill,
                ChildAnchor = Alignment.BottomCenter,
                Background  = Color.Black * 0.5f
            });

            Footer.AddRow(row =>
            {
                row.AddChild(new GuiButton(form.Button1, () =>
                {
                    var packet    = McpeModalFormResponse.CreateObject();
                    packet.formId = formId;
                    packet.data   = "true";
                    //JsonConvert.SerializeObject(idx)
                    parent.SendResponse(packet);

                    parent.Hide(formId);
                })
                {
                    Enabled = true,
                });
                row.AddChild(new GuiButton(form.Button2, () =>
                {
                    var packet    = McpeModalFormResponse.CreateObject();
                    packet.formId = formId;
                    packet.data   = "false";
                    //JsonConvert.SerializeObject(idx)
                    parent.SendResponse(packet);

                    parent.Hide(formId);
                })
                {
                    Enabled = true
                });
            });

            Container.AddChild(Body = new GuiStackContainer()
            {
                //Margin = new Thickness(0, Header.Height, 0, Footer.Height),
                //AutoSizeMode = AutoSizeMode.None,
                //Height = 100,
                //MaxHeight = 100,
                Orientation = Orientation.Vertical,
                Anchor      = Alignment.Fill,
                ChildAnchor = Alignment.MiddleCenter,
                Background  = Color.Black * 0.35f
                              //HorizontalScrollMode = ScrollMode.Hidden
            });

            var text = form.Content;

            var newString = "";

            //	char[] help = new[] { '.', '?', '!' };
            for (int i = 0; i < text.Length - 1; i++)
            {
                var c = text[i];
                newString += c;

                if (c == '.' || c == '?' || c == '!')
                {
                    //newString += "\n";

                    Body.AddChild(new GuiTextElement(newString));

                    /*row.AddChild(new GuiTextElement(form.Content)
                     * {
                     *      Wrap = true,
                     *      MaxWidth = 320
                     * });*/


                    newString = "";

                    if (i != text.Length - 1 && text[i + 1] == ' ')
                    {
                        i++;
                    }
                }
            }

            if (newString.Length > 0)
            {
                Body.AddChild(new GuiTextElement(newString));
            }

            Container.AddChild(Header = new GuiStackContainer()
            {
                Anchor      = Alignment.TopFill,
                ChildAnchor = Alignment.BottomCenter,
                Height      = 32,
                Padding     = new Thickness(3),
                Background  = Color.Black * 0.5f
            });

            Header.AddChild(new GuiTextElement()
            {
                Text      = form.Title,
                TextColor = TextColor.White,
                Scale     = 2f,
                FontStyle = FontStyle.DropShadow,

                Anchor = Alignment.BottomCenter,
            });

            Body.Margin = new Thickness(0, Header.Height, 0, Footer.Height);
            //	Body.MaxHeight = Body.Height = height - 64;
        }
Example #9
0
	void DisplayFormButton_Click (object sender, EventArgs e)
	{
		if (_modalForm == null) {
			_modalForm = new ModalForm ();
		}
		MessageBox.Show ("Result: " + _modalForm.ShowDialog ());
	}
Example #10
0
        private void ShowModal()
        {
            AssessmentItem = new AssessmentItem();

            ModalForm.ShowModal();
        }
Example #11
0
 private void HandleClose()
 {
     ModalForm.HideModal();
     AssessmentForm.ResetForm();
 }
Example #12
0
	void ShowFormButton_Click (object sender, EventArgs e)
	{
		Form modal = new ModalForm ();
		modal.ShowDialog ();
	}
Example #13
0
 private void ShowModal()
 {
     ModalForm.ShowModal();
 }
Example #14
0
 private void HandleClose()
 {
     ModalForm.HideModal();
     QuestionForm.ResetForm();
 }
Example #15
0
 public frmModalForm(ModalForm factory)
 {
     InitializeComponent();
 }
Example #16
0
 public void Show(ModalForm _modalForm)
 {
     modalForm = _modalForm;
     OnShow?.Invoke();
 }
Example #17
0
	void DisplayFormButton_Click (object sender, EventArgs e)
	{
		Form modalForm = new ModalForm ();
		modalForm.Closed += new EventHandler (ModalForm_Closed);
		MessageBox.Show ("Result: " + modalForm.ShowDialog ());
	}