private async void OnNavigationBarAddClicked(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(model.Name))
            {
                // TODO: Show error dialog?
                return;
            }

            if (isSaving)
            {
                return;
            }

            isSaving = true;

            try {
                // Check for existing name
                var  dataStore     = ServiceContainer.Resolve <IDataStore> ();
                Guid clientId      = (model.Client == null) ?  Guid.Empty : model.Client.Id;
                var  existWithName = await dataStore.Table <ProjectData>().ExistWithNameAsync(model.Name, clientId);

                if (existWithName)
                {
                    var alert = new UIAlertView(
                        "NewProjectNameExistTitle".Tr(),
                        "NewProjectNameExistMessage".Tr(),
                        null,
                        "NewProjectNameExistOk".Tr(),
                        null);
                    alert.Clicked += async(s, ev) => {
                        if (ev.ButtonIndex == 0)
                        {
                            nameTextField.BecomeFirstResponder();
                        }
                    };
                    alert.Show();
                }
                else
                {
                    // Create new project:
                    await model.SaveAsync();

                    // Invoke callback hook
                    var cb = ProjectCreated;
                    if (cb != null)
                    {
                        cb(model);
                    }
                    else
                    {
                        NavigationController.PopViewController(true);
                    }
                }
            } finally {
                isSaving = false;
            }
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            TextField.BecomeFirstResponder();

            BottomConstraint.Active |= TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Compact;
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            TextField.BecomeFirstResponder();

            Update();
        }
Example #4
0
        void ReminderSwitch_ValueChanged(object sender, EventArgs e)
        {
            new LocalNotificationService().RegisterNoifications();

            if (ReminderSwitch.On)
            {
                TextField.ResignFirstResponder();
            }
            else
            {
                TextField.BecomeFirstResponder();
            }


            DateView.Hidden = !ReminderSwitch.On;
            if (!ReminderSwitch.On)
            {
                DueDateLabel.Text       = "";
                ViewModel.Item.Reminder = null;
            }
            else
            {
                ViewModel.Item.Reminder = DatePicker.Date.ToDateTime();
            }
        }
Example #5
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            TextField.BecomeFirstResponder();

            BottomConstraint.Active |= UIDevice.CurrentDevice.UserInterfaceIdiom != UIUserInterfaceIdiom.Pad;
        }
Example #6
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);
            nameTextField.BecomeFirstResponder();

            ServiceContainer.Resolve <ITracker> ().CurrentScreen = "New Tag";
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            StyleBackground(BackgroundView);

            StyleHeader(HeaderView, HeaderLabel);

            if (SingleLine)
            {
                TextField.Text   = _Value;
                TextField.Hidden = false;
                TextView.Hidden  = true;

                CGRect rect = BackgroundView.Frame;
                rect.Height         -= 220;
                rect.Y              += 100;
                BackgroundView.Frame = rect;
                TextField.BecomeFirstResponder();
                TextField.ReturnKeyType   = UIReturnKeyType.Done;
                _textFieldDelegate        = new TextFieldDelegate(this);
                TextField.Delegate        = _textFieldDelegate;
                TextField.ClearButtonMode = UITextFieldViewMode.Always;
            }
            else
            {
                TextView.Text    = _Value;
                TextField.Hidden = true;
                TextView.Hidden  = false;
                TextView.BecomeFirstResponder();
            }

            StyleButton(OKButton);
            StyleButton(CancelButton);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new SelectProjectTableViewSource(ProjectsTableView);

            ProjectsTableView.Source  = source;
            source.ToggleTasksCommand = new MvxCommand <ProjectSuggestion>(toggleTaskSuggestions);

            var bindingSet = this.CreateBindingSet <SelectProjectViewController, SelectProjectViewModel>();

            bindingSet.Bind(EmptyStateLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.IsEmpty);

            bindingSet.Bind(EmptyStateImage)
            .For(v => v.BindVisible())
            .To(vm => vm.IsEmpty);

            //Table view
            bindingSet.Bind(source)
            .For(v => v.ObservableCollection)
            .To(vm => vm.Suggestions);

            bindingSet.Bind(source)
            .For(v => v.CreateCommand)
            .To(vm => vm.CreateProjectCommand);

            bindingSet.Bind(source)
            .For(v => v.SuggestCreation)
            .To(vm => vm.SuggestCreation);

            bindingSet.Bind(source)
            .For(v => v.UseGrouping)
            .To(vm => vm.UseGrouping);

            bindingSet.Bind(source)
            .For(v => v.Text)
            .To(vm => vm.Text);

            //Text
            bindingSet.Bind(TextField).To(vm => vm.Text);

            bindingSet.Bind(TextField)
            .For(v => v.BindPlaceholder())
            .To(vm => vm.PlaceholderText);

            //Commands
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);
            bindingSet.Bind(source)
            .For(s => s.SelectionChangedCommand)
            .To(vm => vm.SelectProjectCommand);

            bindingSet.Apply();

            TextField.BecomeFirstResponder();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TitleLabel.Text      = Resources.Tags;
            EmptyStateLabel.Text = Resources.EmptyTagText;
            CloseButton.SetTitle(Resources.Save, UIControlState.Normal);

            var source = new SelectTagsTableViewSource(TagsTableView);

            TagsTableView.Source          = source;
            TagsTableView.TableFooterView = new UIView();

            var bindingSet = this.CreateBindingSet <SelectTagsViewController, SelectTagsViewModel>();

            bindingSet.Bind(EmptyStateImage)
            .For(v => v.BindVisible())
            .To(vm => vm.IsEmpty);

            bindingSet.Bind(EmptyStateLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.IsEmpty);

            //Table view
            bindingSet.Bind(source).To(vm => vm.Tags);

            bindingSet.Bind(source)
            .For(v => v.CurrentQuery)
            .To(vm => vm.Text);

            bindingSet.Bind(source)
            .For(v => v.CreateTagCommand)
            .To(vm => vm.CreateTagCommand);

            bindingSet.Bind(source)
            .For(v => v.SuggestCreation)
            .To(vm => vm.SuggestCreation);

            //Text
            bindingSet.Bind(TextField).To(vm => vm.Text);

            bindingSet.Bind(TextField)
            .For(v => v.BindPlaceholder())
            .To(vm => vm.PlaceholderText);

            //Commands
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);
            bindingSet.Bind(SaveButton).To(vm => vm.SaveCommand);
            bindingSet.Bind(source)
            .For(v => v.SelectionChangedCommand)
            .To(vm => vm.SelectTagCommand);

            bindingSet.Apply();

            TextField.BecomeFirstResponder();
        }
Example #10
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);
            nameTextField.BecomeFirstResponder();

            var tracker = ServiceContainer.Resolve <IGAITracker> ();

            tracker.Set(GAIConstants.ScreenName, "New Client View");
            tracker.Send(GAIDictionaryBuilder.CreateAppView().Build());
        }
 public void Select()
 {
     if (TextView != null)
     {
         TextView.BecomeFirstResponder();
     }
     else if (TextField != null)
     {
         TextField.BecomeFirstResponder();
     }
 }
Example #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            RemoveBackBarButtonTitle();

            ActivityIndicatorView.Hidden = true;
            SaveButton.Hidden            = true;

            TextField.KeyboardType       = UIKeyboardType.Url;
            TextField.Placeholder        = "Website URL";
            TextField.AutocorrectionType = UITextAutocorrectionType.No;
            TextField.BecomeFirstResponder();
            TextField.EditingChanged += (sender, e) =>
            {
                WebView.Hidden    = true;
                SaveButton.Hidden = true;
                HideActivityIndicatorView();
            };
            TextField.EditingDidEndOnExit += (sender, e) =>
            {
                if (String.IsNullOrEmpty(TextField.Text))
                {
                    return;
                }

                URL = TextField.Text.Trim();
                if (!URL.Contains("http"))
                {
                    URL = "http://" + URL;
                }

                if (!StringUtils.IsValidURL(URL))
                {
                    return;
                }

                WebView.Hidden = false;
                WebView.LoadRequest(NSUrlRequest.FromUrl(NSUrl.FromString(URL)));
                ActivityIndicatorView.Hidden = false;
                ActivityIndicatorView.StartAnimating();
            };

            SetProgressButton(SaveButton);

            WebViewSuperViewWidthConstraint.Constant = UIScreen.MainScreen.Bounds.Width - 40;

            WebView.Hidden        = true;
            WebView.LoadFinished += (sender, e) =>
            {
                SaveButton.Hidden = false;
                HideActivityIndicatorView();
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new SelectProjectTableViewSource();

            source.RegisterViewCells(ProjectsTableView);

            source.UseGrouping = ViewModel.UseGrouping;

            ProjectsTableView.TableFooterView = new UIView();
            ProjectsTableView.Source          = source;

            ViewModel.Suggestions
            .Subscribe(ProjectsTableView.Rx().ReloadSections(source))
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateLabel.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateImage.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.PlaceholderText
            .Subscribe(TextField.Rx().PlaceholderText())
            .DisposedBy(DisposeBag);

            TextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            CloseButton.Rx()
            .BindAction(ViewModel.Close)
            .DisposedBy(DisposeBag);

            source.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectProject.Inputs)
            .DisposedBy(DisposeBag);

            source.ToggleTaskSuggestions
            .Subscribe(ViewModel.ToggleTaskSuggestions.Inputs)
            .DisposedBy(DisposeBag);

            TextField.BecomeFirstResponder();
        }
Example #14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            BindView();
            ConfigureNavigationView();
            TextField.BecomeFirstResponder();

            if (ViewModel.Item.Reminder != null && ViewModel.Item.Reminder > DateTime.Now)
            {
                ReminderSwitch.On = true;
            }
            else
            {
                ViewModel.Item.Reminder = null;
                DueDateLabel.Text       = "";
            }
        }
        private void BuildInterface()
        {
            View.BackgroundColor = new UIImage("Images/fondoInicio.jpg").GetScaledImageBackground(View);

            nfloat height = 40.0f;
            var    width  = View.Bounds.Width;

            var logo = new UIImageView(new UIImage("Images/logo.jpg"))
            {
                Frame = new CGRect(60, 60, 200, 45)
            };

            var appName = new UIImageView(new UIImage("Images/titulo.png"))
            {
                Frame = new CGRect(30, logo.Frame.Y + logo.Frame.Height + 20, 260, 40)
            };

            _password = new TextField
            {
                Placeholder     = "Contraseña",
                SecureTextEntry = true,
                Shape           = new CGRect(0, 290, width, height),
                ImageTouch      = ShowPasswordTouch,
                AfterImageTouch = HidePasswordTouch,
                RightImage      = "Images/btn-ver-contra.png",
            };
            _password.SetDidChangeNotification(text => _changePasswordVm.Password = text.Text);
            _password.ShouldReturn = condition =>
            {
                _passwordConfirm.BecomeFirstResponder();
                return(false);
            };

            _passwordConfirm = new TextField
            {
                Placeholder     = "Confirme Contraseña",
                SecureTextEntry = true,
                After           = _password,
                ImageTouch      = ShowPasswordTouch,
                AfterImageTouch = HidePasswordTouch,
                RightImage      = "Images/btn-ver-contra.png",
            };
            _passwordConfirm.SetDidChangeNotification(text => _changePasswordVm.PasswordConfirm = text.Text);
            _passwordConfirm.ShouldReturn = condition =>
            {
                if (!_changePasswordVm.IsValid)
                {
                    new UIAlertView(title: "Ferreyros", message: _changePasswordVm.Error, del: null,
                                    cancelButtonTitle: "OK", otherButtons: null).Show();
                    return(false);
                }
                ChangePassword();

                return(false);
            };


            _changePassword = new Button(UIButtonType.RoundedRect)
            {
                Content = "ENVIAR",
                After   = _passwordConfirm
            };
            _changePassword.TouchUpInside += Submit;

            var copyRight = new UILabel
            {
                Text          = "2016 Ferreyros | Derechos Reservados",
                TextAlignment = UITextAlignment.Center,
                TextColor     = UIColor.White,
                Font          = UIFont.FromName("Helvetica-Light", 10f),
                Frame         = new CGRect(0, View.Bounds.Height - 30, width, 20)
            };

            View.AddSubviews(logo, appName, _password, _passwordConfirm, _changePassword, copyRight);
        }
Example #16
0
        private void BuildInterface()
        {
            View.BackgroundColor = new UIImage("Images/fondoInicio.jpg").GetScaledImageBackground(View);

            nfloat height = 40.0f;
            var    width  = View.Bounds.Width;

            var logo = new UIImageView(new UIImage("Images/logo.jpg"))
            {
                Frame = new CGRect(60, 60, 200, 45)
            };

            var appName = new UIImageView(new UIImage("Images/titulo.png"))
            {
                Frame = new CGRect(30, logo.Frame.Y + logo.Frame.Height + 20, 260, 40)
            };

            _userName = new TextField
            {
                KeyboardType = UIKeyboardType.EmailAddress,
                Placeholder  = "Nombre de Usuario",
                RightImage   = "Images/icon-user.png",
                Shape        = new CGRect(0, 290, width, height)
            };
            _userName.SetDidChangeNotification(text => _loginVm.UserName = text.Text);
            _userName.ShouldReturn = condition =>
            {
                _userPassword.BecomeFirstResponder();
                return(false);
            };

            _userPassword = new TextField
            {
                Placeholder     = "Contraseña",
                SecureTextEntry = true,
                After           = _userName,
                ImageTouch      = ShowPasswordTouch,
                AfterImageTouch = HidePasswordTouch,
                RightImage      = "Images/btn-ver-contra.png",
            };
            _userPassword.SetDidChangeNotification(text => _loginVm.Password = text.Text);

            _userPassword.ShouldReturn = condition =>
            {
                if (_loginVm.IsValid)
                {
                    Login();
                }
                else
                {
                    new UIAlertView(title: "Ferreyros", message: _loginVm.Error, del: null,
                                    cancelButtonTitle: "OK", otherButtons: null).Show();
                }
                return(false);
            };


            _login = new Button(UIButtonType.RoundedRect)
            {
                Content = "INGRESAR",
                After   = _userPassword
            };
            _login.TouchUpInside += Submit;

            var forgetPasswordButton = new Button(UIButtonType.RoundedRect)
            {
                After = _login,
                HorizontalAlignment = UIControlContentHorizontalAlignment.Left,
                VerticalAlignment   = UIControlContentVerticalAlignment.Top,
                Content             = "¿Olvidaste tu contraseña?",
                TitleLabel          =
                {
                    Font = UIFont.FromName("Helvetica-Light", 15f)
                },
                TintColor       = UIColor.White,
                BackgroundColor = UIColor.Clear
            };

            forgetPasswordButton.TouchUpInside += ForgetPasswordButton_TouchUpInside;


            var copyRight = new UILabel
            {
                Text          = "2016 Ferreyros | Derechos Reservados",
                TextAlignment = UITextAlignment.Center,
                TextColor     = UIColor.White,
                Font          = UIFont.FromName("Helvetica-Light", 10f),
                Frame         = new CGRect(0, View.Bounds.Height - 30, width, 20)
            };

            View.AddSubviews(logo, appName, _userName, _userPassword, _login, forgetPasswordButton, copyRight);
        }
 public void Select()
 {
     TextField?.BecomeFirstResponder();
 }
Example #18
0
 void OnAddNewExpressionButtonClicked(object sender, EventArgs e)
 {
     TextField.BecomeFirstResponder();
 }
Example #19
0
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     nameTextField.BecomeFirstResponder();
 }