Example #1
0
        private void EditTotal(int count)
        {
            BasketView basketView = OnePage.redirectApp.basketView;
            double     sum        = count * BasketItem.Price;
            double     total      = basketView.total;

            total += sum;
            basketView.lblTotal.Text = total.ToString() + "р.";
            basketView.total         = total;
        }
Example #2
0
        /// <summary>
        /// Метод перенаправляет на другую страницу и изменяет индикатор текущей страницы
        /// </summary>
        /// <param name="item">Item.</param>
        /// <param name="isHistory">If set to <c>true</c> is history.</param>
        /// <param name="IsRedirectToBack">If set to <c>true</c> is redirect to back.</param>
        /// <param name="isLoadAllCategories">If set to <c>true</c> is load all categories.</param>
        public void RedirectToPage(PageName page, bool isHistory, bool IsRedirectToBack, bool isLoadAllCategories)
        {
            IKeyboardInteractions keyboardInteractions = DependencyService.Get <IKeyboardInteractions>();

            keyboardInteractions.HideKeyboard();

            StackLayout layoutContent = OnePage.bodyLayout;


            History history = GetCurrentTransition();

            if (history != null && history.Page == PageName.Order)
            {
                CrearHistory();
            }
            if (history != null && history.Page == PageName.Catalog && history.Step == HistoryStep.FilterProduct)
            {
                DeleteLastTransition();
            }

            //if (newView == catalogView && catalogView != null)
            //	catalogView.StopLoad();

            switch (page)
            {
            case PageName.Main:
                if (!isHistory && !AddTransition(page, "Главная"))
                {
                    return;
                }
                ShowIndicator(layoutContent);
                //if (mainPageView == null)
                mainPageView = new MainPageView();

                newView = mainPageView;
                break;

            case PageName.Info:
                if (!isHistory && !AddTransition(page, "Инфо"))
                {
                    return;
                }
                ShowIndicator(layoutContent);
                newView = new InfoView();
                break;

            case PageName.Catalog:
                if (!isHistory && !AddTransition(page, "Каталог"))
                {
                    return;
                }
                ShowIndicator(layoutContent);

                if (catalogView != null)
                {
                    catalogView.StopLoad();
                }

                if (catalogView == null)
                {
                    catalogView             = new CatalogView(isLoadAllCategories);
                    catalogView.filterParam = filterParam;
                }
                newView = catalogView;
                break;

            case PageName.Login:
                string text;
                if (User.Singleton == null)
                {
                    text = "Вход";
                }
                else
                {
                    text = "Мой профиль";
                }
                if (!isHistory && !AddTransition(page, text, IsRedirectToBack))
                {
                    return;
                }
                if (newView != basketView)
                {
                    ShowIndicator(layoutContent);
                }

                loginView.GotoPage(history.Step);
                newView = loginView;
                break;

            case PageName.Search:
                if (!isHistory && !AddTransition(page, "Поиск", IsRedirectToBack))
                {
                    return;
                }
                ShowIndicator(layoutContent);

                newView = searchView;
                searchView.ClearText();
                break;

            case PageName.Basket:
                if (!isHistory && !AddTransition(page, "Корзина", false, true))
                {
                    return;
                }
                ShowIndicator(layoutContent);

                basketView = new BasketView();
                newView    = basketView;
                break;

            case PageName.Image:
                if (catalogView != null)
                {
                    filterParam = catalogView.filterParam;
                }
                if (!isHistory && !AddTransition(page, "Просмотр", false, true))
                {
                    return;
                }
                ShowIndicator(layoutContent);

                newView = imageView;
                break;

            default:
                break;
            }

            //if (catalogView != null)
            //	catalogView.StopLoad();

            Device.BeginInvokeOnMainThread(() => {
                if (layoutContent.Children.Count > 0)
                {
                    layoutContent.Children.RemoveAt(0);
                }
                layoutContent.Children.Insert(0, newView);
            });
        }