protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ac_sign_in);
            EditText editEmail    = FindViewById <EditText>(Resource.Id.editEmail);
            EditText editPassword = FindViewById <EditText>(Resource.Id.editPassword);

            ProgressGenerator   progressGenerator = new ProgressGenerator(this);
            ActionProcessButton btnSignIn         = FindViewById <ActionProcessButton>(Resource.Id.btnSignIn);
            Bundle extras = Intent.Extras;

            if (extras != null && extras.GetBoolean(EXTRAS_ENDLESS_MODE))
            {
                btnSignIn.setMode(ActionProcessButton.Mode.ENDLESS);
            }
            else
            {
                btnSignIn.setMode(ActionProcessButton.Mode.PROGRESS);
            }
            btnSignIn.Click += (object sender, EventArgs e) => {
                this.RunOnUiThread(() => {
                    progressGenerator.start(btnSignIn, this);
                    btnSignIn.Enabled    = false;
                    editEmail.Enabled    = false;
                    editPassword.Enabled = false;
                });
            };
        }
예제 #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Cancelable = false;
            Dialog.Window.Attributes.WindowAnimations = Resource.Animation.modal_in;
            var ignore = base.OnCreateView(inflater, container, savedInstanceState);
            var view   = this.BindingInflate(Resource.Layout.LoginView, null);

            var set = this.CreateBindingSet <LoginView, LoginViewModel>();

            set.Bind(this).For(v => v.LoginInteraction).To(viewModel => viewModel.LoginInteraction).OneWay();
            set.Apply();


            _btLogin = view.FindViewById <ActionProcessButton>(Resource.Id.btLogin);
            _btLogin.SetBackgroundColor(Color.ParseColor("#3b5999"));
            _btLogin.setMode(ActionProcessButton.Mode.ENDLESS);
            _btLogin.Click += (sender, args) =>
            {
                _btLogin.setProgress(1);
                var token = SilentLogin();
                if (string.IsNullOrEmpty(token))
                {
                    FacebookLogin();
                }
                else
                {
                    TokenSuccess(token);
                }
            };
            return(view);
        }
예제 #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Cancelable = false;
            var ignore = base.OnCreateView(inflater, container, savedInstanceState);

            var set = this.CreateBindingSet <NewGameView, NewGameViewModel>();

            set.Bind(this).For(v => v.CreateGameInteraction).To(viewModel => viewModel.CreateGameInteraction).OneWay();
            set.Apply();


            var view = this.BindingInflate(Resource.Layout.NewGame, null);
            // grid
            var grid = (MvxGridView)view.FindViewById(Resource.Id.grid);

            grid.Adapter = new GridPlayerAdapter(Context, (IMvxAndroidBindingContext)BindingContext);

            // button
            ProgressGenerator progressGenerator = new ProgressGenerator(this);

            _btnUpload = view.FindViewById <ActionProcessButton>(Resource.Id.btNext);
            _btnUpload.setMode(ActionProcessButton.Mode.ENDLESS);
            _btnUpload.Click += (object sender, EventArgs e) =>
            {
                //progressGenerator.start(btnUpload, Activity);
                _btnUpload.setProgress(1);
                ViewModel.NextCommand.Execute(null);
            };

            return(view);
        }
예제 #4
0
        private void uploadImage()
        {
            var categoryText = categoryField.Text.Trim();

            if (imageView.Drawable == null)
            {
                Infobar.Show(this, "No image to upload", Infobar.InfoLevel.Info, GravityFlags.Top | GravityFlags.FillHorizontal);
                return;
            }
            else if (string.IsNullOrEmpty(categoryText))
            {
                categoryField.RequestFocus();
                categoryField.SetError("No category specified", null);
                return;
            }

            uploadBtn.setMode(ActionProcessButton.Mode.ENDLESS);
            uploadBtn.setProgress(1);

            var bm = (imageView.Drawable as BitmapDrawable).Bitmap;

            Task.Run(async() =>
            {
                var base64Image = string.Empty;

                using (MemoryStream memoryStream = new MemoryStream())
                {
                    await bm.CompressAsync(Bitmap.CompressFormat.Webp, 85, memoryStream);

                    base64Image = Base64.EncodeToString(memoryStream.ToArray(), Base64Flags.Default);
                }

                return(await Api.DavinciApi.UploadPost(base64Image, categoryText));
            }).ContinueWith(async t =>
            {
                var response = t.Result;

                if (t.Status == TaskStatus.Canceled)
                {
                    uploadBtn.setProgress(-1);
                    return;
                }

                if (response.OK)
                {
                    uploadBtn.setProgress(100);
                    await Task.Delay(2000);
                    this.Finish();
                }

                uploadBtn.setProgress(0);
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }