Пример #1
0
        private void AddComment_Click(object sender, RoutedEventArgs e)
        {
            StackPanel sp      = new StackPanel();
            var        Comment = new PhoneTextBox();

            Comment.Hint          = "Enter your comment here";
            Comment.AcceptsReturn = true;
            sp.Children.Add(Comment);
            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Caption            = "Add Comment",
                Message            = "Add a comment to this customer",
                Content            = sp,
                LeftButtonContent  = "Submit",
                RightButtonContent = "Cancel"
            };

            messageBox.Dismissed += async(s1, e1) =>
            {
                switch (e1.Result)
                {
                case CustomMessageBoxResult.LeftButton:
                    await api.AddCommentToCustomer(Customer.Email, Comment.Text);

                    await this.InitializeCustomer();

                    MessageBox.Show("Comment added sucessfully");
                    break;
                }
            };
            messageBox.Show();
        }
Пример #2
0
        private void AdminCommentsPopup()
        {
            LinearLayout layout = new LinearLayout(this);

            layout.Orientation = Orientation.Vertical;
            var FiveDp = ConvertDpToPixels(5);

            layout.SetPadding(FiveDp, FiveDp, FiveDp, FiveDp);
            TextView Comments = new TextView(this);
            Button   EditB    = new Button(this);

            Comments.SetTextSize(ComplexUnitType.Sp, 18);
            Comments.Text = Customer.AdminComment ?? "No Comments";

            if (Comments.Text.Equals("No Comments"))
            {
                EditB.Text = "New Comment";
            }
            else
            {
                EditB.Text = "Edit Comments";
            }

            layout.AddView(Comments);
            layout.AddView(EditB);

            var builder = new AlertDialog.Builder(this);

            builder.SetTitle("Admin Comments");
            builder.SetView(layout);
            builder.SetNeutralButton("Done", (s, e) =>
            {
                builder.Create().Dismiss();
            });
            builder.Create().Show();

            EditB.Click += delegate
            {
                LinearLayout LayoutEdit = new LinearLayout(this);
                LayoutEdit.SetPadding(FiveDp, FiveDp, FiveDp, FiveDp);
                EditText EditComment = new EditText(this);
                LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent,
                                                                                             LinearLayout.LayoutParams.WrapContent);
                EditComment.Text             = Customer.AdminComment ?? "";
                EditComment.LayoutParameters = linearLayoutParams;
                LayoutEdit.AddView(EditComment);

                var EditCommentDialog = new AlertDialog.Builder(this);
                EditCommentDialog.SetTitle("Admin Comments");
                EditCommentDialog.SetView(LayoutEdit);
                EditCommentDialog.SetPositiveButton("Save", async(s, e) =>
                {
                    dialog = ProgressDialog.Show(this, "", "Adding Comment. Please wait... ", true);
                    await api.AddCommentToCustomer(Customer.Email, EditComment.Text);
                    await RefreshCustomer();
                    Comments.Text = Customer.AdminComment;
                    dialog.Dismiss();
                });
                EditCommentDialog.SetNegativeButton("Cancel", (s, e) =>
                {
                    EditCommentDialog.Create().Dismiss();
                });
                EditCommentDialog.Create().Show();
            };
        }