示例#1
0
        /// <summary>
        /// Handler for Selected event.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void OnSelected(Control control)
        {
            CategoryButton child = control as CategoryButton;

            if (child == null)
            {
                return;
            }

            if (m_List != null)
            {
                m_List.UnselectAll();
            }
            else
            {
                UnselectAll();
            }

            child.ToggleState = true;

            if (Selected != null)
            {
                Selected.Invoke(this);
            }
        }
示例#2
0
    private void AddButton(ModuleCategory category)
    {
        CategoryButton button = Instantiate(menuButtonPrefab, contentPanel).GetComponent <CategoryButton>();

        button.GetComponent <RectTransform>().localScale = Vector3.one;
        button.SetUpButton(category, OnCategoryButton);
    }
示例#3
0
 // this function will recieve game object
 public void CategorySwitch(CategoryButton btn)
 {                 // All Players
     btn.Switch(); //
     activeButton.Switch();
     activeButton          = btn;
     achvScrollbar.content = btn.achievementMenu.GetComponent <RectTransform>();
 }
示例#4
0
        protected override Size Measure(Size availableSize)
        {
            Size headerSize = m_HeaderButton.DoMeasure(availableSize);

            if (IsCategoryCollapsed)
            {
                return(headerSize);
            }
            else
            {
                int width  = headerSize.Width;
                int height = headerSize.Height + Padding.Top + Padding.Bottom;

                foreach (ControlBase child in Children)
                {
                    CategoryButton button = child as CategoryButton;
                    if (button == null)
                    {
                        continue;
                    }

                    Size size = child.DoMeasure(availableSize);
                    if (size.Width > width)
                    {
                        width = child.Width;
                    }
                    height += size.Height;
                }

                width += Padding.Left + Padding.Right;

                return(new Size(width, height));
            }
        }
示例#5
0
        /// <summary>
        /// Function invoked after layout.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void PostLayout(Skins.Skin skin)
        {
            if (IsCollapsed)
            {
                Height = m_HeaderButton.Height;
            }
            else
            {
                SizeToChildren(false, true);
            }

            // alternate row coloring
            bool b = true;

            foreach (Control child in Children)
            {
                CategoryButton button = child as CategoryButton;
                if (button == null)
                {
                    continue;
                }

                button.m_Alt = b;
                button.UpdateColors();
                b = !b;
            }
        }
示例#6
0
        protected override Size Arrange(Size finalSize)
        {
            m_HeaderButton.DoArrange(new Rectangle(0, 0, finalSize.Width, m_HeaderButton.MeasuredSize.Height));

            if (IsCategoryCollapsed)
            {
                return(new Size(finalSize.Width, m_HeaderButton.MeasuredSize.Height));
            }
            else
            {
                int  y     = m_HeaderButton.MeasuredSize.Height + Padding.Top;
                int  width = finalSize.Width - Padding.Left - Padding.Right;
                bool b     = true;

                foreach (ControlBase child in Children)
                {
                    CategoryButton button = child as CategoryButton;
                    if (button == null)
                    {
                        continue;
                    }

                    button.m_Alt = b;
                    button.UpdateColors();
                    b = !b;

                    child.DoArrange(new Rectangle(Padding.Left, y, width, child.MeasuredSize.Height));
                    y += child.MeasuredSize.Height;
                }

                y += Padding.Bottom;

                return(new Size(finalSize.Width, y));
            }
        }
示例#7
0
    private void AddButton(ModuleScriptableObject module)
    {
        CategoryButton button = Instantiate(menuButtonPrefab, contentPanel).GetComponent <CategoryButton>();

        button.GetComponent <RectTransform>().localScale = Vector3.one;
        button.SetUpButton(module, OnModuleButton);
    }
示例#8
0
        public void SearchInfoTech()
        {
            // wait for results to show
            wait.Until(d => FirstRow.Displayed);

            // filter results
            CategoryButton.Click();
            wait.Until(d => Categories.Displayed);

            // highlight info tech
            IList <IWebElement> categories = driver.FindElements(CategoriesListSelector);

            categories.First(e => e.Text.Contains(infoTech)).Click();

            Search.Click();

            // wait for page to load results
            wait.Until(d => SearchResult.Displayed);

            // determine if results were shown
            if (Status.Text == noRecords)
            {
                Assert.Inconclusive("no openings at this time");
                driver.Close();
            }
        }
示例#9
0
        /// <summary>
        /// Handler for Selected event.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void OnSelected(ControlBase control, EventArgs args)
        {
            CategoryButton child = control as CategoryButton;

            if (child == null)
            {
                return;
            }

            if (m_List != null)
            {
                m_List.UnselectAll();
            }
            else
            {
                UnselectAll();
            }

            child.ToggleState = true;

            if (Selected != null)
            {
                Selected.Invoke(this, new ItemSelectedEventArgs(control));
            }
        }
示例#10
0
        /// <summary>
        /// Called when the user selects something in the UIPicker
        /// </summary>
        public void PickerSelected(int row)
        {
            // set the category's text to be the item they selected. Note that we now change the color to Active from the original Placeholder
            CategoryButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor), UIControlState.Normal);
            CategoryButton.SetTitle(RockLaunchData.Instance.Data.PrayerCategories[row].Key, UIControlState.Normal);

            //PickerAdjustManager.TogglePicker( false );
        }
示例#11
0
        private void ReloadData()
        {
            var exerciseDescription = MaxWeightCalculator.ExerciseDescription(dataSource.Calculator.Exercise);

            CategoryButton.SetTitle(exerciseDescription, UIControlState.Normal);
            CategoryButton.SetTitle(exerciseDescription, UIControlState.Selected);
            TableView.ReloadData();
        }
示例#12
0
        //Agregar Categoria Boton
        private void AddCategory(object sender, EventArgs e)
        {
            Control control = ((Control)sender);
            Control parent  = control.Parent;
            int     zIndex  = parent.Controls.GetChildIndex(control);

            //mostrar formulario y crear boton
            using (MsgBox_AddCategory NewCatForm = new MsgBox_AddCategory())
            {
                //Agregar Boton de categoria.
                NewCatForm.bt_Confirm.Click += new EventHandler(delegate(object o, EventArgs a)
                {
                    if (NewCatForm.textBox1.Text != string.Empty)
                    {
                        CategoryButton catbutton = new CategoryButton()
                        {
                            // FlatStyle = Left_Button_add.FlatStyle,
                            Text = NewCatForm.textBox1.Text,
                            Name = NewCatForm.textBox1.Text
                        };
                        // catbutton.FlatAppearance.BorderSize = 0;
                        catbutton.label1.Click += FiltrarCategoria;
                        catbutton.Paint        += Catbutton_Paint;



                        //buscar si existe.
                        if (!parent.Controls.ContainsKey(catbutton.Name))
                        {
                            parent.Controls.Add(catbutton);
                        }
                        else
                        {
                            return;
                        }


                        parent.Controls.SetChildIndex(control, zIndex + 1);

                        FiltrarCategoria(catbutton.label1, e);
                        NewCatForm.Close();
                    }
                    else
                    {
                        return;
                    }
                });
                NewCatForm.ShowDialog();
            }

            //mostrar boton de agregar.
            if (CategoryPanel.Controls.Count > 1)
            {
                AddIPButton.Visible     = true;
                this.bt_ShowAll.Visible = true;
            }
        }
示例#13
0
        private void LoadFile(string FilePath)
        {
            //reset All
            Clear();
            //load all
            try
            {
                XDocument doc = XDocument.Load(FilePath);

                this.waitTime = int.Parse(doc.Root.Attribute("WaitTime").Value);

                var cat = doc.Descendants("Category");
                var IPs = doc.Elements().Descendants("Device");

                foreach (var category in cat)
                {
                    CategoryButton CatButton = new CategoryButton()
                    {
                        Name = category.Attribute("Name").Value,
                        Text = category.Attribute("Name").Value
                    };
                    CatButton.label1.Text = CatButton.Text;

                    int zIndex = CategoryPanel.Controls.GetChildIndex(Left_Button_add);

                    CatButton.label1.Click += FiltrarCategoria;
                    CatButton.Paint        += Catbutton_Paint;
                    CategoryPanel.Controls.Add(CatButton);
                    CategoryPanel.Controls.SetChildIndex(Left_Button_add, zIndex + 1);
                    // CatButton.Show();
                    Console.WriteLine("OK?");
                }

                foreach (var ip in IPs)
                {
                    int       zIndex   = ButtonPanel.Controls.GetChildIndex(AddIPButton);
                    LineChart IpButton = new LineChart()
                    {
                        interval = waitTime,
                        Enabled  = true,
                        tag      = ip.Attribute("Category").Value
                    };
                    IpButton.nombre.Text = ip.Element("Name").Value;
                    IpButton.txt_ip.Text = ip.Element("IP").Value;

                    ButtonPanel.Controls.Add(IpButton);
                    ButtonPanel.Controls.SetChildIndex(AddIPButton, zIndex + 1);
                }

                this.bt_ShowAll.Visible = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
示例#14
0
 void initalCategories()
 {
     Cate[] cateList = ReadHandler.readCategories();
     for (int i = 0; i < 9; i++)
     {
         CategoryButton cateBtn  = categoryContainer.transform.GetChild(i).GetComponent <CategoryButton>();
         Cate           cate     = cateList[i];
         Song[]         songList = ReadHandler.readSongs(cate.ID);
         cateBtn.initial(cate.ID, cate.name, songList);
     }
 }
示例#15
0
        /// <summary>
        /// Adds a new entry.
        /// </summary>
        /// <param name="name">Entry name (displayed).</param>
        /// <returns>Newly created control.</returns>
        public Button Add(string name)
        {
            CategoryButton button = new CategoryButton(this);

            button.Text     = name;
            button.Padding  = new Padding(5, 2, 2, 2);
            button.Clicked += OnSelected;

            Invalidate();

            return(button);
        }
示例#16
0
        /// <summary>
        /// Prepare to edit a CategoryButton
        /// </summary>
        /// <param name="cb">CategoryButton to be edited</param>
        public void EnterCategoryEditMode(CategoryButton cb)
        {
            questionLabel.Text      = "Category:";
            questionTextBox.Enabled = true;
            questionTextBox.Text    = cb.Text;

            answerTextBox.Enabled = false;
            answerTextBox.Text    = "";

            editColumn = cb.Column;
            editRow    = 0;
        }
示例#17
0
        /// <summary>
        /// Unselects all entries.
        /// </summary>
        public void UnselectAll()
        {
            foreach (ControlBase child in Children)
            {
                CategoryButton button = child as CategoryButton;
                if (button == null)
                {
                    continue;
                }

                button.ToggleState = false;
            }
        }
示例#18
0
        /// <summary>
        /// Adds a new entry.
        /// </summary>
        /// <param name="name">Entry name (displayed).</param>
        /// <returns>Newly created control.</returns>
        public Button Add(String name)
        {
            CategoryButton button = new CategoryButton(this);

            button.Text = name;
            button.Dock = Pos.Top;
            button.SizeToContents();
            button.SetSize(button.Width + 4, button.Height + 4);
            button.Padding  = new Padding(5, 2, 2, 2);
            button.Clicked += OnSelected;

            return(button);
        }
示例#19
0
        /// <summary>
        /// Creates and adds Buttons of categories in addon list
        /// </summary>
        private static void InitializeCategoryButtonsForAddons()
        {
            foreach (Enum e in Enum.GetValues(typeof(AddonCategories.Categories)))
            {
                CategoryButton cb = new CategoryButton()
                {
                    AddonCategory = (AddonCategories.Categories)e
                };
                cb.Margin = new System.Windows.Thickness(10, 5, 10, 0);

                cb.Container.Opacity = 0.7d;
                MainWindow.Instance.AddonList.AddCategories(cb);
                //MainWindow.Instance.AddonList.CategoryStackPanel.Children.Add(cb);
            }
        }
 public void SetCategoryButtonDisabledState(string key, bool isDisabled)
 {
     if (categoryButtons.ContainsKey(key))
     {
         CategoryButton categoryButton = categoryButtons[key];
         categoryButton.GetComponent <Button>().interactable = !isDisabled;
         if (isDisabled)
         {
             categoryButton.GetComponentInChildren <Text>().color = new Color(1f, 1f, 1f, 0.5f);
         }
         else
         {
             categoryButton.GetComponentInChildren <Text>().color = new Color(1f, 1f, 1f, 1f);
         }
     }
 }
        /// <summary>
        /// Adds the 'View' button and all the category buttons to the page.
        /// </summary>
        private void InitializeButtons()
        {
            // 'View' button in the top right
            _rightButton          = new UIBarButtonItem();
            _rightButton.Title    = "View";
            _rightButton.Clicked += ViewButtonClicked;
            NavigationItem.SetRightBarButtonItem(_rightButton, false);

            // All category buttons
            int x = 7, y = 40;
            int width = 150, height = 50;

            _categoryButtons.Clear();

            // This could be replaced with a static button creation?
            List <Category> selectedCategories = Settings.Current.LastCategories.ToList();

            foreach (var category in Repository.Default.ListCategories())
            {
                // The category button
                CategoryButton button = new CategoryButton(category);
                button.SetTitle(category.Title, UIControlState.Normal);
                button.SetTitleColor(UIColor.White, UIControlState.Normal);
                button.SetTitleColor(UIColor.Orange, UIControlState.Selected);

                button.SetBackgroundImage(UIImage.FromFile("Assets/Images/category-button.png"), UIControlState.Normal);
                button.Frame      = new RectangleF(x, y, width, height);
                button.Font       = UIFont.BoldSystemFontOfSize(16.0f);
                button.TouchDown += CategoryButtonTouchDown;

                // Work out which are highlighted from Settings
                if (selectedCategories.Exists(c => c.Equals(category)))
                {
                    button.Selected = true;
                }

                x += width + 5;
                if (x > 220)
                {
                    x  = 7;
                    y += 60;
                }

                _categoryButtons.Add(button);
                View.AddSubview(button);
            }
        }
示例#22
0
        /// <summary>
        /// Gets the selected entry.
        /// </summary>
        public Button GetSelectedButton()
        {
            foreach (ControlBase child in Children)
            {
                CategoryButton button = child as CategoryButton;
                if (button == null)
                {
                    continue;
                }

                if (button.ToggleState)
                {
                    return(button);
                }
            }

            return(null);
        }
示例#23
0
        /// <summary>
        /// Function invoked after layout.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void PostLayout()
        {
            base.PostLayout();
            // alternate row coloring
            bool b = false;

            foreach (ControlBase child in Children)
            {
                CategoryButton button = child as CategoryButton;
                if (button == null)
                {
                    continue;
                }

                button.m_Alt = b;
                b            = !b;
            }
        }
        /// <summary>
        /// Selects or deselects the pushed category button from the list.
        /// </summary>
        private void CategoryButtonTouchDown(object sender, EventArgs e)
        {
            // Add or remove from the current list of categories
            CategoryButton button = (CategoryButton)sender;

            button.Selected = !button.Selected;

            if (_selectedCategories.Contains(button.Category))
            {
                _selectedCategories.Remove(button.Category);
            }
            else
            {
                _selectedCategories.Add(button.Category);
            }

            // Save the selected categories
            Settings.Current.LastCategories = _selectedCategories.ToList();
        }
示例#25
0
    void CreateCategoryButton(CategoryInfo info)
    {
        if (CategoryButtonPrefab != null)
        {
            GameObject unitObj = Instantiate(CategoryButtonPrefab) as GameObject;
            unitObj.transform.SetParent(Panel.transform);
            unitObj.transform.localScale    = Vector3.one;
            unitObj.transform.localPosition = Vector3.zero;
            unitObj.transform.localRotation = Quaternion.identity;
            unitObj.name = "CategoryBtn" + info.name;

            CategoryButton btn = unitObj.GetComponentInChildren <CategoryButton>();

            // initilze the unit
            btn.Init(info, cateButtons.Count, this);

            // save the unit in the listx
            cateButtons.Add(btn);
        }
    }
    private void createCategoryButton(EquipmentCategoryDefinitionContentKey categoryDataKey, bool isDisabled = false, string categoryToSelect = "")
    {
        GameObject gameObject = Object.Instantiate(categoryButtonPrefab);

        gameObject.transform.SetParent(base.transform, worldPositionStays: false);
        CategoryButton component = gameObject.GetComponent <CategoryButton>();

        component.Init(categoryDataKey, eventProxy);
        categoryButtons.Add(categoryDataKey.Key, component);
        SetCategoryButtonDisabledState(categoryDataKey.Key, isDisabled);
        if (!string.IsNullOrEmpty(categoryToSelect) && categoryDataKey.Key == categoryToSelect)
        {
            gameObject.GetComponent <TintToggleGroupButton>().OnClick();
            categoryToSelectButtonIndex = categoryButtons.Count;
        }
        else
        {
            gameObject.GetComponent <TintToggleGroupButton>().SetTint(on: false);
        }
    }
示例#27
0
    // Start is called before the first frame update
    void Start()
    {
        activeButton = GameObject.Find("CurrentPLayerButton").GetComponent <CategoryButton>();
        activeButton.Switch();
        PlayerScore = 0;
        isPaused    = false;
        // Players
        txtCollectedCoins.text = PlayerPrefs.GetInt("CollectedCoins").ToString();
        txtPlayer1Coins.text   = player1RequiredCoins.ToString();
        txtPlayer2Coins.text   = player2RequiredCoins.ToString();
        int player1 = PlayerPrefs.GetInt("player1");

        int curPlayerID = PlayerPrefs.GetInt("Player", 1);

        Player2Button.GetComponent <CharacterUnlock>().Activate();

        if (curPlayerID == 1)
        {
            characterPlayer1.SetActive(true);
            characterPlayer2.SetActive(false);

            player = characterPlayer1;
        }
        else if (curPlayerID == 2)
        {
            characterPlayer1.SetActive(false);
            characterPlayer2.SetActive(true);

            player = characterPlayer2;
        }

        BuildingController[] bCs = (BuildingController[])GameObject.FindObjectsOfType(typeof(BuildingController));
        foreach (BuildingController bC in bCs)
        {
            bC.player = player.transform;
        }
        CarController[] cCs = (CarController[])GameObject.FindObjectsOfType(typeof(CarController));
        foreach (CarController cC in cCs)
        {
            cC.player = player.transform;
        }

        CameraController[] cameraCs = (CameraController[])GameObject.FindObjectsOfType(typeof(CameraController));
        foreach (CameraController cC in cameraCs)
        {
            cC.player = player.transform;
        }

        /*if (player1 == 1) // 0 -> locked  1 -> unlocked  2 -> active
         * {
         *  player1Button.GetComponent<CharacterUnlock>().Unlock();
         *  coinsPlayer1.SetActive(false);
         *  coinsPlayer2.SetActive(false);
         *  characterPlayer1.SetActive(false);
         * }
         * else if (player1 == 2)
         * {
         *  player1Button.GetComponent<CharacterUnlock>().Activate();
         *  Player2Button.GetComponent<CharacterUnlock>().Unlock();
         *  coinsPlayer1.SetActive(false);
         *  coinsPlayer2.SetActive(false);
         *  characterPlayer2.SetActive(false);
         * }
         * else
         * {
         *  if (PlayerPrefs.GetInt("CollectedCoins") >= player1RequiredCoins)
         *  {
         *      player1Button.GetComponent<CharacterUnlock>().Unlock();
         *      coinsPlayer1.SetActive(false);
         *      coinsPlayer2.SetActive(false);
         *      characterPlayer1.SetActive(false);
         *      PlayerPrefs.SetInt("player1", 1);
         *      PlayerPrefs.SetInt("CollectedCoins", PlayerPrefs.GetInt("CollectedCoins") - player1RequiredCoins);
         *
         *  }
         *  else
         *  {
         *      coinsPlayer2.SetActive(false);
         *      characterPlayer1.SetActive(false);
         *  }
         * }*/
    }
示例#28
0
        /// <summary>
        /// Builds a prayer request from data in the UI Fields and kicks off the post UI Control
        /// </summary>
        void SubmitPrayerRequest(object sender, EventArgs e)
        {
            if (PickerAdjustManager.Revealed == true)
            {
                OnToggleCategoryPicker(false);
            }
            else
            {
                // if first and last name are valid, OR anonymous is on
                // and if there's text in the request field.
                if (CheckDebug( ) == false)
                {
                    if (ValidateInput( ))
                    {
                        Rock.Client.PrayerRequest prayerRequest = new Rock.Client.PrayerRequest();

                        EnableControls(false);

                        prayerRequest.FirstName = FirstName.Field.Text;
                        prayerRequest.LastName  = LastName.Field.Text;
                        prayerRequest.Email     = Email.Field.Text;

                        // see if there's a person alias ID to use.
                        int?personAliasId = null;
                        if (MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.HasValue)
                        {
                            personAliasId = MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId;
                        }

                        prayerRequest.Text                   = PrayerRequest.Text;
                        prayerRequest.EnteredDateTime        = DateTime.Now;
                        prayerRequest.ExpirationDate         = DateTime.Now.Add(PrivatePrayerConfig.PrayerExpirationTime);
                        prayerRequest.CategoryId             = RockLaunchData.Instance.Data.PrayerCategoryToId(CategoryButton.Title(UIControlState.Normal));
                        prayerRequest.IsActive               = true;
                        prayerRequest.IsPublic               = UIPublicSwitch.On; // use the public switch's state to determine whether it's a public prayer or not.
                        prayerRequest.Guid                   = Guid.NewGuid( );
                        prayerRequest.IsApproved             = false;
                        prayerRequest.CreatedByPersonAliasId = /*UISwitchAnonymous.On == true ? null :*/ personAliasId;

                        // launch the post view controller
                        Prayer_PostUIViewController postPrayerVC = new Prayer_PostUIViewController();
                        postPrayerVC.PrayerRequest = prayerRequest;
                        Task.PerformSegue(this, postPrayerVC);
                    }
                }
            }
        }
示例#29
0
        bool ValidateInput( )
        {
            bool result = true;

            // Update the first name background color
            uint targetNameColor = ControlStylingConfig.BG_Layer_Color;

            if (string.IsNullOrEmpty(FirstName.Field.Text) /*&& UISwitchAnonymous.On == false*/)
            {
                targetNameColor = ControlStylingConfig.BadInput_BG_Layer_Color;
                result          = false;
            }
            Rock.Mobile.PlatformSpecific.iOS.UI.Util.AnimateViewColor(targetNameColor, FirstName.Background);


            // Update the LAST name background color
            uint targetLastNameColor = ControlStylingConfig.BG_Layer_Color;

            if (string.IsNullOrEmpty(LastName.Field.Text) /*&& UISwitchAnonymous.On == false*/)
            {
                targetLastNameColor = ControlStylingConfig.BadInput_BG_Layer_Color;
                result = false;
            }
            Rock.Mobile.PlatformSpecific.iOS.UI.Util.AnimateViewColor(targetLastNameColor, LastName.Background);

            // Update the email background color
            uint targetEmailColor = ControlStylingConfig.BG_Layer_Color;

            if ((string.IsNullOrEmpty(Email.Field.Text) || Email.Field.Text.IsEmailFormat( ) == false) /*&& UISwitchAnonymous.On == false*/)
            {
                targetEmailColor = ControlStylingConfig.BadInput_BG_Layer_Color;
                result           = false;
            }
            Rock.Mobile.PlatformSpecific.iOS.UI.Util.AnimateViewColor(targetEmailColor, Email.Background);


            // Update the prayer background color
            uint targetPrayerColor = ControlStylingConfig.BG_Layer_Color;

            if (string.IsNullOrEmpty(PrayerRequest.Text) == true)
            {
                targetPrayerColor = ControlStylingConfig.BadInput_BG_Layer_Color;
                result            = false;
            }
            Rock.Mobile.PlatformSpecific.iOS.UI.Util.AnimateViewColor(targetPrayerColor, PrayerRequestLayer);


            // update the category
            int categoryId = RockLaunchData.Instance.Data.PrayerCategoryToId(CategoryButton.Title(UIControlState.Normal));

            uint targetCategoryColor = ControlStylingConfig.BG_Layer_Color;

            if (categoryId == -1)
            {
                targetCategoryColor = ControlStylingConfig.BadInput_BG_Layer_Color;
                result = false;
            }
            Rock.Mobile.PlatformSpecific.iOS.UI.Util.AnimateViewColor(targetCategoryColor, CategoryLayer);

            return(result);
        }
        /// <summary>
        /// Adds the 'View' button and all the category buttons to the page.
        /// </summary>
        private void InitializeButtons()
        {
            // 'View' button in the top right
            _rightButton = new UIBarButtonItem();
            _rightButton.Title = "View";
            _rightButton.Clicked += ViewButtonClicked;
            NavigationItem.SetRightBarButtonItem(_rightButton,false);

            // All category buttons
            int x = 7, y = 40;
            int width = 150, height = 50;
            _categoryButtons.Clear();

            // This could be replaced with a static button creation?
            List<Category> selectedCategories = Settings.Current.LastCategories.ToList();
            foreach (var category in Repository.Default.ListCategories())
            {
                // The category button
                CategoryButton button = new CategoryButton(category);
                button.SetTitle(category.Title,UIControlState.Normal);
                button.SetTitleColor(UIColor.White,UIControlState.Normal);
                button.SetTitleColor(UIColor.Orange,UIControlState.Selected);

                button.SetBackgroundImage(UIImage.FromFile("Assets/Images/category-button.png"),UIControlState.Normal);
                button.Frame = new RectangleF(x,y,width,height);
                button.Font = UIFont.BoldSystemFontOfSize(16.0f);
                button.TouchDown += CategoryButtonTouchDown;

                // Work out which are highlighted from Settings
                if (selectedCategories.Exists(c => c.Equals(category)))
                    button.Selected = true;

                x += width + 5;
                if (x > 220)
                {
                    x = 7;
                    y += 60;
                }

                _categoryButtons.Add(button);
                View.AddSubview(button);
            }
        }
示例#31
0
 public void AddCategories(CategoryButton obj)
 {
     CategoryStackPanel.Children.Add(obj);
 }