private void Instance_ChangeOrder(string counter) { if (!CounterTextView.IsNull()) { CounterTextView.Text = OrderManager.Instance.CurrentOrderCount.ToString(); } }
protected virtual void SetupHeaderView() { MenuLine?.SetBackgroundColor(ColorConstants.BackgroundGray); BottomHeaderLine?.SetBackgroundColor(ColorConstants.BlackColor); HeaderRootView?.SetBackgroundColor(ColorConstants.BlackColor); ContentView?.SetBackgroundColor(ColorConstants.BackroundContent); HeaderLeftImageView?.SetSelected(ColorConstants.BlackColor); HeaderRightImageView?.SetSelected(ColorConstants.BlackColor); HeaderLine?.SetBackgroundColor(ColorConstants.BlackColor); if (CounterTextView != null) { CounterTextView.Visibility = ViewState.Invisible; } switch (HeaderAreaAction) { case HeaderAreaActionType.Nothing: HeaderLeftImageView?.SetImageFromResource(null); HeaderRightImageView?.SetImageFromResource(null); if (!HeaderLeftTouchArea.IsNull()) { HeaderLeftTouchArea.Click -= BackAction; HeaderRightTouchArea.Click -= Shop; } break; case HeaderAreaActionType.Back: HeaderLeftImageView?.SetImageFromResource(DrawableConstants.BackIcon); HeaderLeftImageView?.SetSelected(ColorConstants.SelectorHome); if (HeaderLeftImageView != null) { HeaderLeftImageView.Click -= BackAction; HeaderLeftImageView.Click += BackAction; } HeaderRightImageView?.SetImageFromResource(null); if (!HeaderTextView.IsNull()) { HeaderTextView.Text = HeaderText; HeaderTextView.SetTextColor(ColorConstants.WhiteColor); HeaderTextView.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18); } if (!HeaderLeftTouchArea.IsNull() && !HeaderRightTouchArea.IsNull()) { HeaderLeftTouchArea.Click -= BackAction; HeaderLeftTouchArea.Click += BackAction; HeaderRightTouchArea.Click -= Shop; } break; case HeaderAreaActionType.Menu: if (!HeaderLeftImageView.IsNull()) { HeaderLeftImageView?.SetImageFromResource(DrawableConstants.MenuIcon); HeaderLeftImageView?.SetSelected(ColorConstants.SelectorHome); if (HeaderLeftImageView != null) { HeaderLeftImageView.Click -= MenuAction; HeaderLeftImageView.Click += MenuAction; } } HeaderRightImageView?.SetImageFromResource(null); if (!HeaderTextView.IsNull()) { HeaderTextView.Text = HeaderText; HeaderTextView.SetTextColor(ColorConstants.WhiteColor); HeaderTextView.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18); } break; case HeaderAreaActionType.Shop: HeaderLeftImageView?.SetImageFromResource(DrawableConstants.MenuIcon); HeaderLeftImageView?.SetSelected(ColorConstants.SelectorHome); if (HeaderLeftImageView != null) { HeaderLeftImageView.Click -= MenuAction; HeaderLeftImageView.Click += MenuAction; } HeaderRightImageView?.SetImageFromResource(DrawableConstants.ShopIcon); HeaderRightImageView?.SetSelected(ColorConstants.SelectorHome); HeaderRightImageView.Click -= Shop; HeaderRightImageView.Click += Shop; if (!CounterTextView.IsNull()) { CounterTextView.Visibility = ViewState.Visible; CounterTextView.Text = OrderManager.Instance.CurrentOrderCount.ToString(); OrderManager.Instance.ChangeOrder -= Instance_ChangeOrder; OrderManager.Instance.ChangeOrder += Instance_ChangeOrder; CounterTextView.SetTextColor(ColorConstants.WhiteColor); CounterTextView.SetBackgroundColor(ColorConstants.SelectorHome, 8); } if (!HeaderTextView.IsNull()) { HeaderTextView.Text = HeaderText; HeaderTextView.SetTextColor(ColorConstants.WhiteColor); HeaderTextView.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18); } if (!HeaderLeftTouchArea.IsNull() && !HeaderRightTouchArea.IsNull()) { HeaderLeftTouchArea.Click -= MenuAction; HeaderLeftTouchArea.Click += MenuAction; HeaderRightTouchArea.Click -= Shop; HeaderRightTouchArea.Click += Shop; } break; } }