Example #1
0
        public void ViewDidLoad(UIViewController viewController)
        {
            SendButton.TintColor = StyleHelper.Style.ButtonTintColor;
            SendButton.SetImage(UIImage.FromBundle(StyleHelper.Style.SendBundleName), UIControlState.Normal);
            SendButton.SetCommand(new RelayCommand(OnRaiseSend));

            AttachImageButton.TintColor = StyleHelper.Style.ButtonTintColor;
            AttachImageButton.SetImage(UIImage.FromBundle(StyleHelper.Style.AddImageBundleName), UIControlState.Normal);
            AttachImageButton.SetCommand(new RelayCommand(OnAddPhotoClicked));

            TakePhotoButton.TintColor = StyleHelper.Style.ButtonTintColor;
            TakePhotoButton.SetImage(UIImage.FromBundle(StyleHelper.Style.TakePhotoBundleName), UIControlState.Normal);
            TakePhotoButton.SetCommand(new RelayCommand(OnTakePhotoClicked));

            RemoveAttachButton.SetImage(UIImage.FromBundle(StyleHelper.Style.RemoveAttachBundleName),
                                        UIControlState.Normal);
            RemoveAttachButton.SetCommand(new RelayCommand(OnRemovePhotoClicked));

            AttachedImageView.Layer.MasksToBounds = false;
            AttachedImageView.Layer.CornerRadius  = 5;
            AttachedImageView.ClipsToBounds       = true;
            AttachedImageView.ContentMode         = UIViewContentMode.ScaleAspectFill;

            EditImageContainer.Hidden = true;
            EditImageContainerHeightConstraint.Constant = 0;

            _simpleImagePicker = new SimpleImagePicker(viewController,
                                                       Dependencies.Container.Resolve <IPermissionsManager>(), false);
            _attachedImageBinding = this.SetBinding(() => _simpleImagePicker.ViewModel.ImageCacheKey).WhenSourceChanges(
                () =>
            {
                if (string.IsNullOrEmpty(_simpleImagePicker.ViewModel.ImageCacheKey))
                {
                    CloseAttachPanel();
                    return;
                }

                OpenAttachPanel();
            });
            _simpleImagePicker.SetCommand(nameof(_simpleImagePicker.PickerWillOpen),
                                          new RelayCommand(RaisePickerWillOpen));
        }
        void ReleaseDesignerOutlets()
        {
            if (AttachedImageView != null)
            {
                AttachedImageView.Dispose();
                AttachedImageView = null;
            }

            if (AttachImageButton != null)
            {
                AttachImageButton.Dispose();
                AttachImageButton = null;
            }

            if (EditImageContainer != null)
            {
                EditImageContainer.Dispose();
                EditImageContainer = null;
            }

            if (EditImageContainerHeightConstraint != null)
            {
                EditImageContainerHeightConstraint.Dispose();
                EditImageContainerHeightConstraint = null;
            }

            if (EditingCloseButton != null)
            {
                EditingCloseButton.Dispose();
                EditingCloseButton = null;
            }

            if (EditingIndicatorView != null)
            {
                EditingIndicatorView.Dispose();
                EditingIndicatorView = null;
            }

            if (EditingText != null)
            {
                EditingText.Dispose();
                EditingText = null;
            }

            if (EditViewContainer != null)
            {
                EditViewContainer.Dispose();
                EditViewContainer = null;
            }

            if (EditViewContainerHeightConstraint != null)
            {
                EditViewContainerHeightConstraint.Dispose();
                EditViewContainerHeightConstraint = null;
            }

            if (InputTextView != null)
            {
                InputTextView.Dispose();
                InputTextView = null;
            }

            if (InputTextViewMaxHeightConstraint != null)
            {
                InputTextViewMaxHeightConstraint.Dispose();
                InputTextViewMaxHeightConstraint = null;
            }

            if (InputTextViewPlaceholder != null)
            {
                InputTextViewPlaceholder.Dispose();
                InputTextViewPlaceholder = null;
            }

            if (InputViewContainer != null)
            {
                InputViewContainer.Dispose();
                InputViewContainer = null;
            }

            if (RemoveAttachButton != null)
            {
                RemoveAttachButton.Dispose();
                RemoveAttachButton = null;
            }

            if (SendButton != null)
            {
                SendButton.Dispose();
                SendButton = null;
            }

            if (TakePhotoButton != null)
            {
                TakePhotoButton.Dispose();
                TakePhotoButton = null;
            }

            if (EditMessageHeaderLabel != null)
            {
                EditMessageHeaderLabel.Dispose();
                EditMessageHeaderLabel = null;
            }
        }