Ejemplo n.º 1
0
        public SendAddEditPage(
            AppOptions appOptions = null,
            string sendId         = null,
            SendType?type         = null)
        {
            _broadcasterService  = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _appOptions          = appOptions;
            InitializeComponent();
            _vm        = BindingContext as SendAddEditPageViewModel;
            _vm.Page   = this;
            _vm.SendId = sendId;
            _vm.Type   = appOptions?.CreateSend?.Item1 ?? type;
            SetActivityIndicator();
            if (Device.RuntimePlatform == Device.Android)
            {
                if (_vm.EditMode)
                {
                    ToolbarItems.Add(_removePassword);
                    ToolbarItems.Add(_copyLink);
                    ToolbarItems.Add(_shareLink);
                    ToolbarItems.Add(_deleteItem);
                }
                _vm.SegmentedButtonHeight    = 36;
                _vm.SegmentedButtonFontSize  = 13;
                _vm.SegmentedButtonMargins   = new Thickness(0, 10, 0, 0);
                _vm.EditorMargins            = new Thickness(0, 5, 0, 0);
                _btnOptions.WidthRequest     = 70;
                _btnOptionsDown.WidthRequest = 30;
                _btnOptionsUp.WidthRequest   = 30;
            }
            else if (Device.RuntimePlatform == Device.iOS)
            {
                ToolbarItems.Add(_closeItem);
                if (_vm.EditMode)
                {
                    ToolbarItems.Add(_moreItem);
                }
                _vm.SegmentedButtonHeight   = 30;
                _vm.SegmentedButtonFontSize = 15;
                _vm.SegmentedButtonMargins  = new Thickness(0, 5, 0, 0);
                _vm.ShowEditorSeparators    = true;
                _vm.EditorMargins           = new Thickness(0, 10, 0, 5);
                _deletionDateTypePicker.On <iOS>().SetUpdateMode(UpdateMode.WhenFinished);
                _expirationDateTypePicker.On <iOS>().SetUpdateMode(UpdateMode.WhenFinished);
            }

            _deletionDateTypePicker.ItemDisplayBinding   = new Binding("Key");
            _expirationDateTypePicker.ItemDisplayBinding = new Binding("Key");

            if (_vm.IsText)
            {
                _nameEntry.ReturnType    = ReturnType.Next;
                _nameEntry.ReturnCommand = new Command(() => _textEditor.Focus());
            }
        }
Ejemplo n.º 2
0
        public SendAddOnlyPage(
            AppOptions appOptions = null,
            string sendId         = null,
            SendType?type         = null)
        {
            if (appOptions?.IosExtension != true)
            {
                throw new InvalidOperationException(nameof(SendAddOnlyPage) + " is only prepared to be used in iOS share extension");
            }

            _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _appOptions          = appOptions;
            InitializeComponent();
            _vm        = BindingContext as SendAddEditPageViewModel;
            _vm.Page   = this;
            _vm.SendId = sendId;
            _vm.Type   = appOptions?.CreateSend?.Item1 ?? type;

            if (_vm.IsText)
            {
                _nameEntry.ReturnType    = ReturnType.Next;
                _nameEntry.ReturnCommand = new Command(() => _textEditor.Focus());
            }
        }