Example #1
0
        private void AddButtons(List <AttachmentButton> attachmentButtons)
        {
            var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);

            layoutParams.Weight = 1;
            layoutParams.SetMargins(4, 2, 4, 2);

            foreach (var attachmentButton in attachmentButtons)
            {
                var button = new Button(this)
                {
                    TransformationMethod = null,
                    Text             = attachmentButton.Title,
                    LayoutParameters = layoutParams,
                };
                button.SetPadding(4, 2, 4, 2);

                var drawable = Resources.GetDrawable(Resource.Drawable.button_rounded);
                button.Background = drawable;
                button.Click     += async(sender, e) =>
                {
                    InputArea.RemoveAllViews();

                    var activity = new Microsoft.Bot.Connector.DirectLine.Activity(type: "message",
                                                                                   text: button.Text,
                                                                                   fromProperty: new Microsoft.Bot.Connector.DirectLine.ChannelAccount {
                        Id = Android.Provider.Settings.Secure.AndroidId
                    });
                    AddMessageToList(activity);
                    await SendMessage(button.Text);
                };
                InputArea.AddView(button);
            }
        }
Example #2
0
 private void OnBeforeFilesDrop()
 {
     if (!Window.Current.Active)
     {
         Window.Current.Activate();
         InputArea.SetFocus();
     }
     mousePositionOnFilesDrop = MousePosition * Document.Current.Container.AsWidget.LocalToWorldTransform.CalcInversed();
 }