示例#1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.OnFavoritesBtn.TouchUpInside += (sender, e) => {
                m_list = new BaseListVC(RecipeSrcType.Favourites, this);
                this.NavigationController.PushViewController(this.m_list, true);
            };

            this.OnFirstCoursesBtn.TouchUpInside += (sender, e) => {
                m_list = new BaseListVC(RecipeSrcType.FirstCourses, this);
                this.NavigationController.PushViewController(this.m_list, true);
            };

            this.OnSecondCoursesBtn.TouchUpInside += (sender, e) => {
                m_list = new BaseListVC(RecipeSrcType.SecondCourses, this);
                this.NavigationController.PushViewController(this.m_list, true);
            };

            this.OnSaladsBtn.TouchUpInside += (sender, e) => {
                m_list = new BaseListVC(RecipeSrcType.Salads, this);
                this.NavigationController.PushViewController(this.m_list, true);
            };

            this.OnSnacksBtn.TouchUpInside += (sender, e) => {
                m_list = new BaseListVC(RecipeSrcType.Snacks, this);
                this.NavigationController.PushViewController(this.m_list, true);
            };

            this.OnBakeryBtn.TouchUpInside += (sender, e) =>
            {
                m_list = new BaseListVC(RecipeSrcType.Bakery, this);
                this.NavigationController.PushViewController(this.m_list, true);
            };

            this.OnDrinksBtn.TouchUpInside += (sender, e) =>
            {
                m_list = new BaseListVC(RecipeSrcType.Drinks, this);
                this.NavigationController.PushViewController(this.m_list, true);
            };

            this.OnSaucesBtn.TouchUpInside += (sender, e) =>
            {
                m_list = new BaseListVC(RecipeSrcType.Sauces, this);
                this.NavigationController.PushViewController(this.m_list, true);
            };

            this.OnHomeBtn.TouchUpInside += (sender, e) =>
            {
                this.NavigationController.PopToRootViewController(true);
            };
        }
示例#2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // add stages buttons
            this.RecipeBgImg.BackgroundColor = UIColor.FromRGB(0x54, 0x54, 0x54);
            this.RecipeNameTxt.TextColor     = UIColor.White;
            float strt_x = this.View.ViewWithTag(1).Frame.Left;
            float strt_y = this.View.ViewWithTag(1).Frame.Top;

            //set color fo stage btn text
            this.AtckBtn.TitleLabel.TextColor     = UIColor.FromRGB(0x47, 0xBA, 0xA4);
            this.CruiseBtn.TitleLabel.TextColor   = UIColor.FromRGB(0x47, 0xBA, 0xA4);
            this.ConsolidBtn.TitleLabel.TextColor = UIColor.FromRGB(0x47, 0xBA, 0xA4);
            this.StabBtn.TitleLabel.TextColor     = UIColor.FromRGB(0x47, 0xBA, 0xA4);
            this.View.BackgroundColor             = UIColor.Clear;
            // wihin sorted list check phases
            foreach (DietPhase dp in m_d_p)
            {
                if (this.View.ViewWithTag(1).Frame.Right - strt_x < this.ConsolidBtn.Bounds.Width)
                {
                    strt_y = this.View.ViewWithTag(2).Frame.Top;
                    strt_x = this.View.ViewWithTag(2).Frame.Left;
                }
                if (dp == DietPhaseId.DP_Attack)
                {
                    this.AtckBtn.Frame  = new RectangleF(strt_x, strt_y, this.AtckBtn.Bounds.Width, this.AtckBtn.Bounds.Height);
                    strt_x             += this.AtckBtn.Bounds.Width;
                    this.AtckBtn.Hidden = false;
                    this.AtckBtn.UserInteractionEnabled = true;
                    continue;
                }
                if (dp == DietPhaseId.DP_Cruise)
                {
                    this.CruiseBtn.Frame = new RectangleF(strt_x, strt_y, this.CruiseBtn.Bounds.Width, this.CruiseBtn.Bounds.Height);
                    strt_x += this.CruiseBtn.Bounds.Width;
                    this.CruiseBtn.Hidden = false;
                    this.CruiseBtn.UserInteractionEnabled = true;
                    continue;
                }

                if (dp == DietPhaseId.DP_Consolidation)
                {
                    this.ConsolidBtn.Frame = new RectangleF(strt_x, strt_y, this.ConsolidBtn.Bounds.Width, this.ConsolidBtn.Bounds.Height);
                    strt_x += this.ConsolidBtn.Bounds.Width;
                    this.ConsolidBtn.Hidden = false;
                    this.ConsolidBtn.UserInteractionEnabled = true;
                    continue;
                }
                if (dp == DietPhaseId.DP_Stabilization)
                {
                    this.StabBtn.Frame  = new RectangleF(strt_x, strt_y, this.StabBtn.Bounds.Width, this.StabBtn.Bounds.Height);
                    this.StabBtn.Hidden = false;
                    this.StabBtn.UserInteractionEnabled = true;
                }
            }

            this.HeadImg.Image     = UIImage.FromFile("images/png/divisions/[email protected]");
            m_table                = new UITableView(View.ViewWithTag(5).Frame);
            m_table.Source         = m_table_source;
            m_table.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            Add(m_table);

            this.AddToFavBtn.SetBackgroundImage(UIImage.FromFile(m_recipe.isFavourite == 1 ?
                                                                 "images/png/[email protected]" :
                                                                 "images/png/[email protected]"), UIControlState.Normal);
            this.AddAllBtn.SetBackgroundImage(UIImage.FromFile("images/png/[email protected]"), UIControlState.Normal);
            this.RecipeNameTxt.Text = m_recipe.RecipeName;

            this.AddToFavBtn.TouchUpInside += (sender, e) =>
            {
                m_recipe.isFavourite ^= 1;
                this.AddToFavBtn.SetBackgroundImage(UIImage.FromFile(m_recipe.isFavourite == 1 ?
                                                                     "images/png/[email protected]" :
                                                                     "images/png/[email protected]"), UIControlState.Normal);
                RecipeManager.SaveRecipeRecord(m_recipe);
            };

            this.OnBackBtn.TouchUpInside += (sender, e) =>
            {
                this.NavigationController.PopViewControllerAnimated(true);
            };

            this.OnHomeBtn.TouchUpInside += (sender, e) =>
            {
                this.NavigationController.PopToRootViewController(true);
            };

            this.AtckBtn.TouchUpInside += (sender, e) =>
            {
                BaseListVC bl = m_parent as BaseListVC;
                if (bl != null)
                {
                    bl.clearTable();
                    bl.addTable(DietPhaseId.DP_Attack);
                }
                this.NavigationController.PopViewControllerAnimated(false);
            };

            this.CruiseBtn.TouchUpInside += (sender, e) =>
            {
                this.NavigationController.PopViewControllerAnimated(false);
            };

            this.ConsolidBtn.TouchUpInside += (sender, e) =>
            {
                this.NavigationController.PopViewControllerAnimated(false);
            };

            this.StabBtn.TouchUpInside += (sender, e) =>
            {
                this.NavigationController.PopViewControllerAnimated(false);
            };
        }