Beispiel #1
0
        void OnMenuSelectionChanged(object sender, EventArgs e)
        {
            OptionsSelect option = (OptionsSelect)sender;

            if (option.Type == OptionSelectType.Style)
            {
                vectorStyleName = option.Value;
            }
            else if (option.Type == OptionSelectType.Language)
            {
                vectorStyleLang = option.Value;
            }
            else if (option.Type == OptionSelectType.TileType)
            {
                vectorStyleTileType = option.Value;
            }
            else if (option.Type == OptionSelectType.OSM)
            {
                vectorStyleOSM = option.Value;

                if (OSMChanged != null)
                {
                    OSMChanged(vectorStyleOSM, EventArgs.Empty);
                }
            }

            UpdateBaseLayer();
        }
        public OptionsMenuBox(string text, Dictionary <string, string> items, OptionSelectType type)
        {
            title      = new UILabel();
            title.Text = text;
            title.Font = UIFont.FromName("Helvetica", 13);

            AddSubview(title);

            title.SizeToFit();

            foreach (KeyValuePair <string, string> item in items)
            {
                OptionsSelect option = new OptionsSelect(item, type);
                option.TouchUpInside += OnOptionSelected;

                AddSubview(option);
                options.Add(option);
            }

            Layer.CornerRadius = 5;
            BackgroundColor    = UIColor.White;
        }
        public void Update(Dictionary <string, string> items, OptionSelectType type)
        {
            foreach (UIView subview in Subviews)
            {
                if (subview is OptionsSelect)
                {
                    (subview as OptionsSelect).TouchUpInside -= OnOptionSelected;
                    subview.RemoveFromSuperview();
                }
            }

            options.Clear();

            foreach (KeyValuePair <string, string> item in items)
            {
                OptionsSelect option = new OptionsSelect(item, type);
                option.TouchUpInside += OnOptionSelected;

                AddSubview(option);
                options.Add(option);
            }
        }
        void OnOptionSelected(object sender, EventArgs e)
        {
            OptionsSelect option = (OptionsSelect)sender;

            if (current == option)
            {
                return;
            }

            option.Highlight();

            if (current != null)
            {
                current.Unhighlight();
            }

            current = option;

            if (SelectionChanged != null)
            {
                SelectionChanged(sender, e);
            }
        }