Beispiel #1
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            NavigationItem.Title = "New Alert";
            AlertTitle.Text      = "Alert Title";
            AlertTitle.TextColor = UIColor.LightGray;
            Content.Text         = "Please enter all information here";
            Content.TextColor    = UIColor.LightGray;
            NSNotificationCenter.DefaultCenter.AddObserver(UITextView.TextDidBeginEditingNotification, TextDidBeginEditing);
            NSNotificationCenter.DefaultCenter.AddObserver(UITextView.TextDidEndEditingNotification, TextDidEndEditing);

            if (NavigationItem.LeftBarButtonItem == null)
            {
                NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Close", UIBarButtonItemStyle.Plain, (x, y) =>
                {
                    DismissModalViewController(true);
                });
            }

            NavigationItem.RightBarButtonItem = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (x, y) =>
            {
                string currentTime = string.Format($"{DateTime.Now.Day:d2}.{DateTime.Now.Month:d2}.{DateTime.Now.Year} {DateTime.Now.Hour:d2}:{DateTime.Now.Minute:d2}:{DateTime.Now.Second:d2}");
                string receiver    = "all";
                Action <bool> popViewController = DismissModalViewController;
                if (User != null)
                {
                    receiver          = User.Email;
                    popViewController = (bool anim) => { navigationController?.PopViewController(anim); };
                }
                if (AlertTitle.Text != "Alert Title" && Content.Text != "Please enter all information here")
                {
                    Alert alert = new Alert()
                    {
                        UserEmail   = receiver,
                        Title       = AlertTitle.Text,
                        Text        = Content.Text,
                        TimeCreated = currentTime,
                        Picture     = "Images/hse_round_logo.png"
                    };
                    new Thread(new ThreadStart(async() =>
                    {
                        await RemoteService.PostAlert(alert);
                        InvokeOnMainThread(() =>
                        {
                            popViewController(true);
                        });
                    })).Start();
                }
                else
                {
                    popViewController(true);
                }
            });
        }
Beispiel #2
0
        void IRouterTools.GoBack(string selectedKey)
        {
            var previousController = _navigationController?.ViewControllers
                                     .FirstOrDefault(x => x is EditContactViewController) as EditContactViewController;

            if (previousController != null)
            {
                previousController.SelectedKey = selectedKey;
            }

            _navigationController?.PopViewController(true);
        }
        /// <summary>
        /// See if the supplied ViewModel matches up with the MvxView at the top of the supplied UINavigationController
        /// and if so, pop that View from the stack
        /// </summary>
        private bool CloseTopView(IMvxViewModel toClose, UINavigationController uiNavigationController)
        {
            if (uiNavigationController == null)
            {
                return(false);
            }

            var mvxTouchView = uiNavigationController.TopViewController as IMvxIosView;

            if (mvxTouchView == null)
            {
                return(false);
            }

            if (mvxTouchView.ReflectionGetViewModel() != toClose)
            {
                return(false);
            }

            uiNavigationController.PopViewController(true);

            return(true);
        }
Beispiel #4
0
        protected virtual bool TryCloseViewControllerInsideStack(UINavigationController navigationController,
                                                                 IMvxViewModel viewModel)
        {
            var topViewController = navigationController.TopViewController.GetIMvxTvosView();

            if (topViewController != null && topViewController.ViewModel == viewModel)
            {
                navigationController.PopViewController(true);
                return(true);
            }

            var viewControllers = navigationController.ViewControllers.ToList();
            var viewController  = viewControllers.FirstOrDefault(vc => vc.GetIMvxTvosView().ViewModel == viewModel);

            if (viewController != null)
            {
                viewControllers.Remove(viewController);
                navigationController.ViewControllers = viewControllers.ToArray();

                return(true);
            }

            return(false);
        }
Beispiel #5
0
        public override void Execute(CallbackActionWaiter callbackActionWaiter, bool animated)
        {
            UINavigationController  navigationController = (UINavigationController)HostStack.Host;
            List <UIViewController> vcs = navigationController.ViewControllers.ToList();

            if (CountToPop == 1)
            {
                UIViewController poppedViewController = vcs[vcs.Count - 1];
                callbackActionWaiter.Add(() => poppedViewController.SafeDispose());
                navigationController.PopViewController(animated);
            }
            else
            {
                int popToIndex = vcs.Count - 1 - CountToPop;
                navigationController.PopToViewController(vcs[popToIndex], animated);
                callbackActionWaiter.Add(() =>
                {
                    for (int i = popToIndex + 1; i < vcs.Count; ++i)
                    {
                        vcs[i].SafeDispose();
                    }
                });
            }
        }
        protected virtual bool TryCloseViewControllerInsideStack(UINavigationController navController, IMvxViewModel toClose)
        {
            // check for top view controller
            var topView = navController.TopViewController.GetIMvxIosView();

            if (topView != null && topView.ViewModel == toClose)
            {
                navController.PopViewController(true);
                return(true);
            }

            // loop through stack
            foreach (var viewController in navController.ViewControllers)
            {
                var mvxView = viewController.GetIMvxIosView();
                if (mvxView.ViewModel == toClose)
                {
                    var newViewControllers = navController.ViewControllers.Where(v => v != viewController).ToArray();
                    navController.ViewControllers = newViewControllers;
                    return(true);
                }
            }
            return(false);
        }
Beispiel #7
0
 public override void NotifyPagePopped(INavigationPage poppedPage)
 {
     // just pop and be happy
     _navigationController.PopViewController(true);
 }
Beispiel #8
0
 public void NavigateBack()
 {
     _navigation.PopViewController(true);
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            thisController = NavigationController;
            NavigationItem.Customize(NavigationController);

            btnSubmit.SetCustomButton();
            btnScaneCard.SetCustomButton();

            edtCCV.ShouldReturn            += TextFieldShouldReturn;
            edtZipCode.ShouldReturn        += TextFieldShouldReturn;
            edtCreditDate.ShouldReturn     += TextFieldShouldReturn;
            edtCreditCardData.ShouldReturn += TextFieldShouldReturn;
            edtCardHolderName.ShouldReturn += TextFieldShouldReturn;

            var tap = new UITapGestureRecognizer(() => { View.EndEditing(true); });

            View.AddGestureRecognizer(tap);

            edtCreditCardData.EditingDidBegin += (object sender, EventArgs e) => {
                paymentViewController = new CardIOPaymentViewController(this, false);
                NavigationController.PresentViewController(paymentViewController, true, null);
            };

            btnSubmit.TouchUpInside += async(object sender, EventArgs e) => {
                var dic = new Dictionary <String, String>
                {
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_CCNAME, edtCardHolderName.Text },
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_CCNUM, creditCardInfo.CardNumber },
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_CCTYPE, crditCardType.ToString() },
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_CID, creditCardInfo.Cvv },
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_CUSTOMERID, AppSettings.UserID },
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_EXPDATE, creditCardInfo.ExpiryMonth + creditCardInfo.ExpiryYear.ToString().Substring(2, 2) },
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_LOGINTYPE, "0" },                    // do not use the actual login types
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_TOKENID, string.Empty },             // do not use the actual token
                    { Constant.INSERTCREDITCARDDETAILSFORPHONE_ZIP, edtZipCode.Text }
                };

                var result = string.Empty;

                try
                {
                    result = await AppData.ApiCall(Constant.INSERTCREDITCARDDETAILSFORPHONE, dic);
                }
                catch (Exception ex)
                {
                    InvokeOnMainThread(() => new UIAlertView(
                                           "Exception:", ex.Message, null, "Ok", null).Show());
                    CrashReporter.Report(ex);
                    return;
                }

                var tt = (InsertCreditCardDetailsForPhoneResponse)AppData.ParseResponse(Constant.INSERTCREDITCARDDETAILSFORPHONE, result);

                UIAlertView alert = new UIAlertView(tt.Result, tt.Msg, null, "Ok", null);
                alert.Clicked += (object senderObj, UIButtonEventArgs buttonArgs) =>
                {
                    if (buttonArgs.ButtonIndex == 0 && (tt.Result == "Success" || tt.Result == "Sucess"))
                    {
                        if (fromWhere == string.Empty)
                        {
                            return;
                        }

                        if (fromWhere == "signup")
                        {
                            var dvc = (HomeViewController)Storyboard.InstantiateViewController("HomeViewController");
                            PresentViewController(dvc, true, null);
                        }
                        else
                        {
                            thisController.PopViewController(true);
                        }
                    }
                    else
                    {
                        //negativeCallback();
                    }
                };

                InvokeOnMainThread(alert.Show);
            };

            btnScaneCard.TouchUpInside += async(object sender, EventArgs e) => {
                paymentViewController = new CardIOPaymentViewController(this);
                NavigationController.PresentViewController(paymentViewController, true, null);
            };
        }
 public void GoBack()
 {
     _navigationController.PopViewController(false);
 }
 public void GoBack()
 {
     _navigation.PopViewController(animated: true);
 }
        public override async void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            CardsCreatingProcessViewController.came_from = Constants.email_confirmation_waiting;
            if (!methods.IsConnected())
            {
                PushNoConnection();
                return;
            }
            InvokeInBackground(async() =>
            {
                AccountActions.cycledRequestCancelled = false;
                string res = "";
                try
                {
                    var actionJwt = databaseMethods.GetActionJwt();
                    if (String.IsNullOrEmpty(actionJwt))
                    {
                        InvokeOnMainThread(() =>
                        {
                            PopThis();
                            return;
                        });
                    }
                    else
                    {
                        res = await accountActions.AccountActionsGet(actionJwt, UDID);
                    }
                }
                catch
                {
                    if (!methods.IsConnected())
                    {
                        InvokeOnMainThread(() =>
                        {
                            PushNoConnection();
                            return;
                        });
                    }
                    return;
                }
                InvokeOnMainThread(() =>
                {
                    try
                    {
                        if (!String.IsNullOrEmpty(res))
                        {
                            if (res.Contains("processed"))
                            {
                                var deserialized_get = JsonConvert.DeserializeObject <AccountActionsGetModel>(res);
                                InvokeInBackground(async() =>
                                {
                                    string res_auth = null;
                                    try
                                    {
                                        res_auth = await accounts.AccountAuthorize(deserialized_get.accountClientJwt, UDID);
                                    }
                                    catch
                                    {
                                        if (!methods.IsConnected())
                                        {
                                            InvokeOnMainThread(() =>
                                            {
                                                PushNoConnection();
                                                return;
                                            });
                                        }
                                        return;
                                    }
                                    AuthorizeRootObject deserialized = null;
                                    if (res_auth != null)
                                    {
                                        deserialized = JsonConvert.DeserializeObject <AuthorizeRootObject>(res_auth);
                                    }
                                    else
                                    {
                                        InvokeOnMainThread(() => { PopThis(); return; });
                                        return;
                                    }
                                    if (deserialized == null)
                                    {
                                        InvokeOnMainThread(() => { PopThis(); return; });
                                        return;
                                    }
                                    if (deserialized.subscriptions == null)
                                    {
                                        InvokeOnMainThread(() => { PopThis(); return; });
                                        return;
                                    }

                                    int lastSubscription = deserialized.subscriptions[deserialized.subscriptions.Count - 1].id;
                                    databaseMethods.InsertLoginAfter(deserialized.accessJwt, deserialized.accountUrl, lastSubscription);
                                    try
                                    {
                                        foreach (var subs in deserialized.subscriptions)
                                        {
                                            if (subs.limitations != null)
                                            {
                                                if (subs.limitations.allowMultiClients)
                                                {
                                                    QRViewController.is_premium = true;
                                                    break;
                                                }
                                            }
                                        }
                                        //if (!is_premium)
                                        foreach (var subscription in deserialized.subscriptions)
                                        {
                                            if (subscription.limitations != null)
                                            {
                                                if (subscription.limitations?.cardsRemaining == null)
                                                {
                                                    QRViewController.cards_remaining = 10;
                                                    break;
                                                }
                                                else
                                                {
                                                    if (subscription.limitations != null)
                                                    {
                                                        if (subscription.limitations?.cardsRemaining != null)
                                                        {
                                                            if (subscription.limitations?.cardsRemaining > QRViewController.cards_remaining)
                                                            {
                                                                QRViewController.cards_remaining = subscription.limitations.cardsRemaining.Value;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        foreach (var subscription in deserialized.subscriptions)
                                        {
                                            NativeMethods.ClearFeatures();
                                            if (subscription.features != null)
                                            {
                                                foreach (var feature in subscription.features)
                                                {
                                                    if (feature == Constants.ExtraEmploymentData)
                                                    {
                                                        QRViewController.ExtraEmploymentData = feature;
                                                    }
                                                    if (feature == Constants.CompanyLogoInQr)
                                                    {
                                                        QRViewController.CompanyLogoInQr = feature;
                                                    }
                                                    if (feature == Constants.ExtraPersonData)
                                                    {
                                                        QRViewController.ExtraPersonData = feature;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                            }
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    if (!String.IsNullOrEmpty(res_auth))
                                    {
                                        if (!res_auth.Contains("userTermsAccepted"))
                                        {
                                            var UDID = UIDevice.CurrentDevice.IdentifierForVendor.ToString();
                                            //var UDID = UIDevice.CurrentDevice.Name;
                                            string res_apply_terms = null;
                                            try
                                            {
                                                res_apply_terms = await accounts.ApplyUserTerms(deserialized.accessJwt, deserialized_get.processed, UDID);
                                            }
                                            catch
                                            {
                                                if (!methods.IsConnected())
                                                {
                                                    InvokeOnMainThread(() =>
                                                    {
                                                        PushNoConnection();
                                                        return;
                                                    });
                                                }
                                                return;
                                            }
                                            if (String.IsNullOrEmpty(res_apply_terms))
                                            {
                                                InvokeOnMainThread(() => { thisNavController?.PopViewController(true); return; });
                                                return;
                                            }
                                            if (res_apply_terms.ToLower().Contains(": 20") || res_apply_terms.ToLower().Contains("accepted"))
                                            {
                                                if (databaseMethods.GetLoginedFrom() == Constants.from_card_creating)
                                                {
                                                    InvokeOnMainThread(() =>
                                                    {
                                                        try
                                                        {
                                                            thisNavController.PushViewController(sb.InstantiateViewController(nameof(CardsCreatingProcessViewController)), true);
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            Analytics.TrackEvent($"{"218 push nav controller exception"}{ex}");
                                                        }
                                                    });
                                                }
                                                else if (databaseMethods.GetLoginedFrom() == Constants.from_slide_menu)
                                                {
                                                    InvokeOnMainThread(() =>
                                                    {
                                                        try
                                                        {
                                                            thisNavController.PushViewController(sb.InstantiateViewController(nameof(RootMyCardViewController)), true);
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            Analytics.TrackEvent($"{"232 push nav controller exception"}{ex}");
                                                        }
                                                    });
                                                }
                                                else if (databaseMethods.GetLoginedFrom() == Constants.from_card_creating_premium)
                                                {
                                                    InvokeOnMainThread(() => { thisNavController.PushViewController(sb.InstantiateViewController(nameof(PersonalDataViewControllerNew)), true); });
                                                }
                                                else
                                                {
                                                    InvokeOnMainThread(() =>
                                                    {
                                                        try
                                                        {
                                                            if (!QRViewController.is_premium)
                                                            {
                                                                thisNavController.PushViewController(sb.InstantiateViewController(nameof(RootMyCardViewController)), true);
                                                            }
                                                            else
                                                            {
                                                                thisNavController.PushViewController(sb.InstantiateViewController(nameof(RootQRViewController)), true);
                                                            }
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            Analytics.TrackEvent($"{"251 or 251 push nav controller exception"}{ex}");
                                                        }
                                                    });
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (databaseMethods.GetLoginedFrom() == Constants.from_card_creating)
                                            {
                                                InvokeOnMainThread(() =>
                                                {
                                                    try
                                                    {
                                                        thisNavController.PushViewController(sb.InstantiateViewController(nameof(CardsCreatingProcessViewController)), true);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Analytics.TrackEvent($"{"271 push nav controller exception"}{ex}");
                                                    }
                                                });
                                            }
                                            else if (databaseMethods.GetLoginedFrom() == Constants.from_slide_menu)
                                            {
                                                InvokeOnMainThread(() =>
                                                {
                                                    try
                                                    {
                                                        if (!QRViewController.is_premium)
                                                        {
                                                            thisNavController.PushViewController(sb.InstantiateViewController(nameof(RootMyCardViewController)), true);
                                                        }
                                                        else
                                                        {
                                                            thisNavController.PushViewController(sb.InstantiateViewController(nameof(RootQRViewController)), true);
                                                        }
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Analytics.TrackEvent($"{"286 or 288 push nav controller exception"}{ex}");
                                                    }
                                                });
                                            }
                                            else if (databaseMethods.GetLoginedFrom() == Constants.from_card_creating_premium)
                                            {
                                                InvokeOnMainThread(() => { thisNavController.PushViewController(sb.InstantiateViewController(nameof(PersonalDataViewControllerNew)), true); });
                                            }
                                            else
                                            {
                                                InvokeOnMainThread(() =>
                                                {
                                                    try
                                                    {
                                                        if (!QRViewController.is_premium)
                                                        {
                                                            thisNavController.PushViewController(sb.InstantiateViewController(nameof(RootMyCardViewController)), true);
                                                        }
                                                        else
                                                        {
                                                            thisNavController.PushViewController(sb.InstantiateViewController(nameof(RootQRViewController)), true);
                                                        }
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Analytics.TrackEvent($"{"307 or 309 push nav controller exception"}{ex}");
                                                    }
                                                });
                                            }
                                        }
                                    }
                                });
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Analytics.TrackEvent($"{"ViewWillAppear:"}{ex}");
                    }
                });
            });
        }
 private void PopThis()
 {
     thisNavController.PopViewController(true);
 }
Beispiel #14
0
 protected void ReturnWithData(string data)
 {
     returnWithData?.Invoke(data, thisTask.Id);
     navController.PopViewController(true);
 }
 /// <summary>
 /// Pops the presenter.
 /// </summary>
 /// <returns>The presenter.</returns>
 /// <param name="animated">Animated.</param>
 public void PopPresenter(bool animated)
 {
     _navigationController.PopViewController(animated);
 }
Beispiel #16
0
 void OnGoBackToTasks(DetailViewModel vm) => _navigationController.PopViewController(true);
 partial void cancelTouchUpInside(NSObject sender)
 {
     Navigation.PopViewController(false);
     DismissViewController(false, null);
 }
Beispiel #18
0
        public override Task <TEditorResponse> ShowTEditor(string html, ToolbarBuilder toolbarBuilder = null, EventHandler <ToolbarBuilderEventArgs> toolbarBuilderOnClick = null, bool autoFocusInput = false)
        {
            TaskCompletionSource <TEditorResponse> taskRes = new TaskCompletionSource <TEditorResponse>();
            var            tvc     = new TEditorViewController();
            ToolbarBuilder builder = toolbarBuilder;

            if (toolbarBuilder == null)
            {
                builder = new ToolbarBuilder();
            }
            tvc.BuildToolbar(builder, toolbarBuilderOnClick);
            tvc.SetHTML(html);
            tvc.SetAutoFocusInput(autoFocusInput);
            tvc.Title = CrossTEditor.PageTitle;

            UINavigationController nav = null;

            tvc.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(CrossTEditor.CancelText, UIBarButtonItemStyle.Plain, (item, args) =>
            {
                if (nav != null)
                {
                    if (UIKit.UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
                    {
                        nav.DismissModalViewController(true);
                    }
                    else
                    {
                        nav.PopViewController(true);
                    }
                }
                taskRes.SetResult(new TEditorResponse()
                {
                    IsSave = false, HTML = string.Empty
                });
            }), true);
            tvc.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(CrossTEditor.SaveText, UIBarButtonItemStyle.Done, async(item, args) =>
            {
                if (nav != null)
                {
                    if (UIKit.UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
                    {
                        nav.DismissModalViewController(true);
                    }
                    else
                    {
                        nav.PopViewController(true);
                    }
                }
                taskRes.SetResult(new TEditorResponse()
                {
                    IsSave = true, HTML = await tvc.GetHTML()
                });
            }), true);

            var root   = UIApplication.SharedApplication.KeyWindow.RootViewController;
            var window = UIApplication.SharedApplication.Windows;

            var rootWindow = window?.FirstOrDefault()?.RootViewController?.ModalViewController;

            if (rootWindow != null)
            {
                nav = GetNavController(rootWindow);
            }
            else
            {
                nav = GetNavController(root);
            }

            if (nav != null)
            {
                if (UIKit.UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
                {
                    var childViewControllers = nav.ChildViewControllers;

                    var newnav = new UINavigationController(tvc);
                    newnav.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
                    nav.PresentModalViewController(newnav, true);
                }
                else
                {
                    nav.PushViewController(tvc, true);
                }
            }
            return(taskRes.Task);
        }
 private void GoBack(object sender, EventArgs e)
 {
     _navController.PopViewController(true);
 }
        /// <summary>
        /// See if the supplied ViewModel matches up with the MvxView at the top of the supplied UINavigationController
        /// and if so, pop that View from the stack
        /// </summary>
        private bool CloseTopView(IMvxViewModel toClose, UINavigationController uiNavigationController)
        {
            if (uiNavigationController == null)
            {
                return false;
            }

            var mvxTouchView = uiNavigationController.TopViewController as IMvxIosView;

            if (mvxTouchView == null)
            {
                return false;
            }

            if (mvxTouchView.ReflectionGetViewModel() != toClose)
            {
                return false;
            }

            uiNavigationController.PopViewController(true);

            return true;
        }
Beispiel #21
0
 public void NavigateBack()
 {
     _rootViewController.PopViewController(true);
 }