public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _customTitleView = new ConnectionStatusView(CGRect.Empty);

            TableNode = new ASTableNode(UITableViewStyle.Grouped);
            Table     = TableNode.View;

            Input = new ChatInputView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            Input.Init(this);

            CustomNavigationItem.AddTitleView(_customTitleView);
            CustomNavigationItem.SetCommand(
                UIImage.FromBundle(StyleHelper.Style.BackButtonBundleName),
                ViewModel.BackCommand,
                true);

            if (ViewModel.HasInfo)
            {
                CustomNavigationItem.SetCommand(
                    UIImage.FromBundle(StyleHelper.Style.ChatDetailsButtonBundleName),
                    ViewModel.ShowInfoCommand,
                    false);
            }

            MainView.InsertSubview(Table, 1);
            InitTableView();

            _contextMenuHandler = new ContextMenuHandler <ChatMessageViewModel>(CreateContextMenuComponentForViewModel);

            Input.EditingCloseButton.SetCommand(ViewModel.MessageInput.CancelEditingCommand);
            Input.OpenCameraButton.SetCommand(ViewModel.MessageInput.OpenCameraCommand);
            Input.OpenGalleryButton.SetCommand(ViewModel.MessageInput.OpenGalleryCommand);
            Input.SendButton.SetCommand(ViewModel.MessageInput.SendMessageCommand);
            Input.DeleteButton.SetCommand(ViewModel.MessageInput.DeleteImageCommand);
            Input.SetLabels(
                ViewModel.MessageInput.EditMessageHeaderString,
                ViewModel.MessageInput.EnterMessagePlaceholderString);

            ScrollToBottomButton.SetCommand(new RelayCommand(() => ScrollToBottom(true)));
            ScrollToBottomButton.SetBackgroundImage(UIImage.FromBundle(StyleHelper.Style.ScrollDownBoundleName), UIControlState.Normal);
        }
예제 #2
0
        public SerialChannel(string port)
        {
            Port = port;

            Children = new Drawable[]
            {
                messagePool,
                scroll = new ChannelScrollContainer
                {
                    ScrollbarVisible = true,
                    RelativeSizeAxes = Axes.Both
                },
                continueAutoscroll = new ScrollToBottomButton
                {
                    Anchor = Anchor.BottomRight,
                    Origin = Anchor.BottomRight,
                    Alpha  = 0,
                    Action = () =>
                    {
                        scroll.ResetScroll();
                    }
                }
            };

            scroll.UserScrolling.ValueChanged += e =>
            {
                if (e.NewValue)
                {
                    continueAutoscroll.FadeIn(50, Easing.InQuint);
                }
                else
                {
                    continueAutoscroll.FadeOut(50, Easing.OutQuint);
                }
            };
        }