private void DobEditText_Click(object sender, EventArgs e)
        {
            var datePicker = new DatePickerDialog();

            datePicker.OnDatePicked += DatePicker_OnDatePicked;
            var ft = ParentFragmentManager.BeginTransaction();

            ft.Add(datePicker, "date_picker");
            ft.CommitAllowingStateLoss();
        }
Пример #2
0
        private async void AudioClicked()
        {
            if (!await IsAuthorizedAsync())
            {
                return;
            }

            using (var transaction = ParentFragmentManager.BeginTransaction())
            {
                transaction.SetStatusBarTitle("Audio");
                transaction.ReplaceContentAnimated(new AudioFragment().WithAgent(this));
                transaction.Commit();
            }
        }
Пример #3
0
        private void NextBtn_Click(object sender, System.EventArgs e)
        {
            nextBtn.Post(() =>
            {
                var extras = new Bundle();
                var phone  = dialcodeTv.Text + phoneEt.EditText.Text;
                extras.PutString(phoneKey, phone);
                smsFragment.Arguments = extras;

                ParentFragmentManager.BeginTransaction()
                .AddToBackStack(null)
                .Replace(Resource.Id.frag_container, smsFragment)
                .CommitAllowingStateLoss();
            });
        }
Пример #4
0
        private void AddElements(List <ButtonElement> list, IEnumerable <ProcessListResponseItem> filtered)
        {
            foreach (var item in filtered.OrderBy(d => d.ProcessName))
            {
                var buttonElement = new ButtonElement();
                buttonElement.Clickable    = true;
                buttonElement.ButtonText   = item.ProcessName;
                buttonElement.ButtonAction = () =>
                {
                    using (var transaction = ParentFragmentManager.BeginTransaction())
                    {
                        transaction.ReplaceContentAnimated(new KillProcessByIdFragment(item.ProcessName).WithAgent(this));
                        transaction.SetStatusBarTitle($"Process: {item.ProcessName}");
                        transaction.Commit();
                    }
                };

                list.Add(buttonElement);
            }
        }
Пример #5
0
        private async void SharePublicKey_Click(object sender, EventArgs e)
        {
            var fragmentTransaction = ParentFragmentManager.BeginTransaction();

            // Remove fragment else it will crash as it is already added to backstack
            var prev = ParentFragmentManager.FindFragmentByTag("publicKeyDialog");

            if (prev != null)
            {
                fragmentTransaction.Remove(prev);
            }

            fragmentTransaction.AddToBackStack(null);

            // Create and show the dialog
            var newFragment = new SharePublicKeyDialogFragment(await encryptionService.GetQRCodeContent());

            //Add fragment
            newFragment.Show(fragmentTransaction, "publicKeyDialog");
        }
        private void OpenScanner()
        {
            // TODO: If scan is valid, open 'Add New Contact' Fragment
            var fragmentTransaction = ParentFragmentManager.BeginTransaction();

            // Remove fragment else it will crash as it is already added to backstack
            var prev = ParentFragmentManager.FindFragmentByTag("scanContactDialog");

            if (prev != null)
            {
                fragmentTransaction.Remove(prev);
            }

            // Create and show the dialog
            var newFragment = new ScanPublicKeyDialogFragment();

            newFragment.SetTargetFragment(this, Constants.Scan_Public_Key_Request_Code);

            //Add fragment
            newFragment.Show(fragmentTransaction, "scanContactDialog");
        }
        private void OpenAddContactDialog(string contactId, string publicKey)
        {
            var fragmentTransaction = ParentFragmentManager.BeginTransaction();

            // Remove fragment else it will crash as it is already added to backstack
            var prev = ParentFragmentManager.FindFragmentByTag("addContactDialog");

            if (prev != null)
            {
                fragmentTransaction.Remove(prev);
            }

            // Create and show the dialog
            var newFragment = new AddContactDialogFragment();
            var dataBundle  = new Bundle();

            dataBundle.PutString("contactId", contactId);
            dataBundle.PutString("publicKey", publicKey);

            newFragment.Arguments = dataBundle;

            // Add fragment
            newFragment.Show(fragmentTransaction, "addContactDialog");
        }
        private async void SaveToDb()
        {
            try
            {
                var profileRef = SessionManager.GetFireDB().GetReference($"users/{SessionManager.UserId}/profile");
                var userMap    = new HashMap();
                var stream     = new System.IO.MemoryStream();
                var bitmap     = MediaStore.Images.Media.GetBitmap(Context.ContentResolver, img_uri);
                await bitmap.CompressAsync(Bitmap.CompressFormat.Webp, 90, stream);

                var imgArray = stream.ToArray();

                var imageRef = FirebaseStorage.Instance.GetReference($"profileImages/{SessionManager.UserId}");
                imageRef.PutBytes(imgArray).ContinueWithTask(new ContinuationTask(
                                                                 then: t =>
                {
                    if (!t.IsSuccessful)
                    {
                        throw t.Exception;
                    }
                })).AddOnCompleteListener(new OncompleteListener(
                                              onComplete: t =>
                {
                    if (!t.IsSuccessful)
                    {
                        throw t.Exception;
                    }

                    userMap.Put(Constants.SNAPSHOT_FNAME, fullnameEt.EditText.Text);
                    userMap.Put(Constants.SNAPSHOT_EMAIL, emailEt.EditText.Text);
                    userMap.Put(Constants.SNAPSHOT_GENDER, (int)userGender);
                    userMap.Put(Constants.SNAPSHOT_PHONE, SessionManager.GetFirebaseAuth().CurrentUser.PhoneNumber);
                    userMap.Put(Constants.SNAPSHOT_PHOTO_URL, t.Result.ToString());
                    profileRef.SetValue(userMap).AddOnCompleteListener(new OncompleteListener(
                                                                           onComplete: task =>
                    {
                        try
                        {
                            if (!task.IsSuccessful)
                            {
                                throw task.Exception;
                            }

                            GetSmsFragment.SetStatus("set_partner");
                            ParentFragmentManager.BeginTransaction()
                            .Replace(Resource.Id.frag_container, new PartnerFragment())
                            .CommitAllowingStateLoss();
                        }
                        catch (DatabaseException de)
                        {
                            OnboardingActivity.ShowError("Database Exception", de.Message);
                        }
                    }));
                    profileRef.KeepSynced(true);
                }));
            }
            catch (DatabaseException fde)
            {
                OnboardingActivity.ShowError("Database Exception", fde.Message);
            }
            catch (FirebaseNetworkException)
            {
                OnboardingActivity.ShowNoNetDialog(false);
            }
            catch (StorageException se)
            {
                OnboardingActivity.ShowError("Storage Exception", se.Message);
            }
            catch (Exception ex)
            {
                OnboardingActivity.ShowError("Exception", ex.Message);
            }
        }