コード例 #1
0
ファイル: BrowserWindow.cs プロジェクト: nagyist/monoxide
        private void CreateToolbarTemplate()
        {
            if (ToolbarTemplate.IsDefined("Main")) return;

            var segmentedControl = new SegmentedControl() { Style = SegmentStyle.TextureRounded, SelectionMode = ItemSelectionMode.None };
            segmentedControl.Segments.Add(new Segment() { Image = Image.GoLeftTemplate });
            segmentedControl.Segments.Add(new Segment() { Image = Image.GoRightTemplate });
            var backForwardItem = new ViewToolbarItem("Foo") { PaletteLabel = "Back/Forward", View = segmentedControl };

            ToolbarTemplate.TryDefine
            (
                "Main",
                new []
                {
                    backForwardItem,
                    ToolbarItem.SeparatorToolbarItem,
                    ToolbarItem.SpaceToolbarItem,
                    ToolbarItem.FlexibleSpaceToolbarItem
                },
                new []
                {
                    backForwardItem
                }
            );
        }
コード例 #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            TableView.DeselectRow(TableView.IndexPathForSelectedRow, true);

            NavigationItem.Title = Course.Name;

            SegmentedControl.SetEnabled(Course.AnnouncementIds.Count > 0, AnnouncementSegmentIndex);
            SegmentedControl.SetEnabled(Course.FileIds.Count > 0, FileSegmentIndex);
            SegmentedControl.SetEnabled(Course.AssignmentIds.Count > 0, AssignmentSegmentIndex);

            if (SegmentedControl.SelectedSegment == -1 || !SegmentedControl.IsEnabled(SegmentedControl.SelectedSegment))
            {
                for (int i = 0; i < SegmentedControl.NumberOfSegments; i++)
                {
                    if (SegmentedControl.IsEnabled((nint)i))
                    {
                        SegmentedControl.SelectedSegment = i;
                        break;
                    }
                }
            }

            TableView.Source = new CourseMaterialsSource(Course, (int)SegmentedControl.SelectedSegment);
            TableView.ReloadData();
        }
コード例 #3
0
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// When the queue type is changed
        /// </summary>
        /// <param name="p_Sender">Event sender</param>
        /// <param name="p_Index">Tab index</param>
        private void OnQueueTypeChanged(SegmentedControl p_Sender, int p_Index)
        {
            UnselectSong();
            m_SongsProvider = p_Index == 0 ? ChatRequest.Instance.SongQueue : (p_Index == 1 ? ChatRequest.Instance.SongHistory : ChatRequest.Instance.SongBlackList);
            RebuildSongList(false);
            m_SongInfo_Detail.SetPracticeButtonEnabled(p_Index == 0);
        }
コード例 #4
0
        public static ITouchbarElement ConvertToTouchbarElement(this NodeViewModel container)
        {
            ITouchbarElement element = null;

            switch (container.ContainerContent.Type)
            {
            case ContainerViewModel.ContainerType.ScrollView:
                element = new ScrollViewControl(container.ContainerContent.Id)
                {
                    ChildElements = container.Elements.Select(node => ConvertToButtonElement(node.ElementContent)).ToList()
                };
                break;

            case ContainerViewModel.ContainerType.Popover:
                throw new NotImplementedException();
                break;

            case ContainerViewModel.ContainerType.Segmented:
                element = new SegmentedControl(container.ContainerContent.Id)
                {
                    ChildElements = container.Elements.Select(node => node.ElementContent.ConvertToSegmentElement()).ToList()
                };
                break;
            }

            return(element);
        }
コード例 #5
0
ファイル: LibTests.cs プロジェクト: rubit0/vstouchbartools
        public void RootTouchbarToXmlAsStringNotNull()
        {
            //Arrange
            var space   = new SpecialElement(SpecialElement.Space.Small);
            var segRoot = new SegmentedControl("4")
            {
                Seperated = true
            };
            var seg1 = new SegmentElement("seg1", "a,b,c", "Segment BT 1");

            segRoot.ChildElements.Add(seg1);

            var scroll = new ScrollViewControl("X");

            scroll.ChildElements.Add(new ButtonElement("s1", "1,2,3", "Scroll BT1", CustomIcons.GoToIcon));
            scroll.ChildElements.Add(new ButtonElement("s2", "ctrl+f", "Scroll BT2")
            {
                Width = 80, BackgroundColor = "ff0000"
            });
            scroll.ChildElements.Add(new ButtonElement("s3", "ctrl+f", "Scroll BT3")
            {
                Width = 120
            });
            scroll.ChildElements.Add(new ButtonElement("s4", "ctrl+f", "Scroll BT4")
            {
                Width = 80
            });

            var pop = new PopoverControl("Y", "Pop Items", CustomIcons.SurroundIcon);

            pop.ChildElements.Add(new ButtonElement("p2", "ctrl+f", "Pop BT1")
            {
                Width = 80
            });
            pop.PressAndHoldChildElements.Add(new ButtonElement("p1", "1,2,3", "PopHold BT1", CustomIcons.FormatDocIcon));
            var button3 = new ButtonElement("p3", "alt+f1", "PopHold BT2");

            pop.PressAndHoldChildElements.Add(button3);

            var root = new RootTouchbar();

            root.Elements.Add(new ButtonElement("r1", "1,2,3", "Button1", SystemStandardIcons.Play));
            root.Elements.Add(space);
            root.Elements.Add(new ButtonElement("r2", "ctrl+f", "Button2")
            {
                Width = 80
            });
            root.Elements.Add(segRoot);
            root.Elements.Add(scroll);
            root.Elements.Add(pop);

            //Act
            var doc = root.ToXmlAsString();

            //Assert
            Assert.IsNotNull(doc);

            Debug.Write(doc);
        }
コード例 #6
0
        public void OnDidSelectTab(SegmentedControl segmentedControl, int _)
        {
            _tabIndex = segmentedControl.selectedCellNumber;
            int index = GetPlatformIndexForTabIndex(_tabIndex);

            _listTables[segmentedControl.selectedCellNumber].tableView.ScrollToCellWithIdx(index, TableView.ScrollPositionType.Beginning, false);
            _listTables[segmentedControl.selectedCellNumber].tableView.SelectCellWithIdx(index, true);
        }
コード例 #7
0
        public DifficultyHighlighter(StandardLevelDetailViewController standardLevelDetailViewController)
        {
            StandardLevelDetailView standardLevelDetailView = Accessors.StandardLevelDetailViewAccessor(ref standardLevelDetailViewController);

            beatmapCharacteristicSegmentedControlController = Accessors.BeatmapCharacteristicSegmentedControlController(ref standardLevelDetailView);
            beatmapCharacteristicSegmentedControl           = Accessors.BeatmapCharacteristicsSegmentedControlAccessor(ref beatmapCharacteristicSegmentedControlController);
            beatmapDifficultySegmentedControlController     = Accessors.BeatmapDifficultySegmentedControlControllerAccessor(ref standardLevelDetailView);
            beatmapDifficultySegmentedControl = Accessors.BeatmapDifficultySegmentedControlAccessor(ref beatmapDifficultySegmentedControlController);
        }
コード例 #8
0
        public SegmentSelectedBackgroundPage()
        {
            var matSegCtrl = new SegmentedControl
            {
                Padding         = 4,
                BackgroundColor = Color.FromRgb(112, 128, 144),
                OutlineColor    = Color.FromRgb(112, 128, 144).WithLuminosity(0.25),
                Segments        =
                {
                    new Segment {
                        Text = "Orange"
                    },
                    new Segment {
                        Text = "Blue"
                    },
                    new Segment {
                        Text = "Yellow"
                    }
                }
            };

            matSegCtrl.SegmentSelected += (sender, e) =>
            {
                switch (e.Segment.Text)
                {
                case "Orange":
                    matSegCtrl.SelectedBackgroundColor = Color.Orange;
                    matSegCtrl.SelectedTextColor       = Color.Default;
                    break;

                case "Blue":
                    matSegCtrl.SelectedBackgroundColor = Color.Blue;
                    matSegCtrl.SelectedTextColor       = Color.White;
                    break;

                case "Yellow":
                    matSegCtrl.SelectedBackgroundColor = Color.Yellow;
                    matSegCtrl.SelectedTextColor       = Color.Default;
                    break;
                }
            };

            Content = new Xamarin.Forms.StackLayout
            {
                Padding  = new Thickness(20),
                Children =
                {
                    new Xamarin.Forms.Label {
                        Text = "SegmentSelectedBackgroundPage"
                    },
                    matSegCtrl
                }
            };
        }
コード例 #9
0
 private void SettingsCellSelected(SegmentedControl sender, int selectedIndex)
 {
     foreach (var obj in _generalSettings)
     {
         obj.SetActive(selectedIndex == 0);
     }
     foreach (var obj in _voiceSettings)
     {
         obj.SetActive(selectedIndex == 1);
     }
 }
コード例 #10
0
        void ReleaseDesignerOutlets()
        {
            if (SegmentedControl != null)
            {
                SegmentedControl.Dispose();
                SegmentedControl = null;
            }

            if (TableView != null)
            {
                TableView.Dispose();
                TableView = null;
            }
        }
コード例 #11
0
        void ReleaseDesignerOutlets()
        {
            if (primaryGraphLabel != null)
            {
                primaryGraphLabel.Dispose();
                primaryGraphLabel = null;
            }

            if (primaryGraph != null)
            {
                primaryGraph.Dispose();
                primaryGraph = null;
            }

            if (UpdateIntervalLabel != null)
            {
                UpdateIntervalLabel.Dispose();
                UpdateIntervalLabel = null;
            }

            if (SegmentedControl != null)
            {
                SegmentedControl.Dispose();
                SegmentedControl = null;
            }

            if (xLabel != null)
            {
                xLabel.Dispose();
                xLabel = null;
            }

            if (yLabel != null)
            {
                yLabel.Dispose();
                yLabel = null;
            }

            if (zLabel != null)
            {
                zLabel.Dispose();
                zLabel = null;
            }

            if (UpdateIntervalSlider != null)
            {
                UpdateIntervalSlider.Dispose();
                UpdateIntervalSlider = null;
            }
        }
コード例 #12
0
        LayoutOptions LayoutOption(SegmentedControl control)
        {
            switch (control.SelectedSegments[0].Text)
            {
            case _layoutOptionStartText: return(LayoutOptions.Start);

            case _layoutOptionCenterText: return(LayoutOptions.Center);

            case _layoutOptionEndText: return(LayoutOptions.End);

            case _layoutOptionFillText: return(LayoutOptions.Fill);
            }
            return(LayoutOptions.Center);
        }
コード例 #13
0
        void ReleaseDesignerOutlets()
        {
            if (SegmentedControl != null)
            {
                SegmentedControl.Dispose();
                SegmentedControl = null;
            }

            if (TableDiscussions != null)
            {
                TableDiscussions.Dispose();
                TableDiscussions = null;
            }
        }
コード例 #14
0
        private void _characteristicControl_didSelectCellEvent(SegmentedControl arg1, int arg2)
        {
            selectedCharacteristic = _selectedSong.beatmapCharacteristics[arg2];

            IDifficultyBeatmap[] difficulties = _selectedSong.difficultyBeatmapSets.First(x => x.beatmapCharacteristic == selectedCharacteristic).difficultyBeatmaps;

            _difficultyControl.SetTexts(difficulties.Select(x => x.difficulty.ToString().Replace("Plus", "+")).ToArray());

            int closestDifficultyIndex = CustomExtensions.GetClosestDifficultyIndex(difficulties, selectedDifficulty);

            _difficultyControl.SelectCellWithNumber(closestDifficultyIndex);

            if (!difficulties.Any(x => x.difficulty == selectedDifficulty))
            {
                _difficultyControl_didSelectCellEvent(null, closestDifficultyIndex);
            }
            else
            {
                levelOptionsChanged?.Invoke();
            }
        }
コード例 #15
0
        private void OnCellSelected(SegmentedControl control, int index)
        {
            _currentTab.Visible = false;

            if (_tabs[index] == null)
            {
                switch (index)
                {
                case 1:
                    _tabs[index] = new QuickFiltersTab(_container);
                    break;

                case 2:
                    _tabs[index] = new InfoTab(_container);
                    break;
                }
            }

            _tabs[index].Visible = true;
            _currentTab          = _tabs[index];
        }
        private void HandleCellSelectedEvent(SegmentedControl _, int cellIdx)
        {
            selectedGroup?.OnDisable();

            selectedGroup = loadedSettingsGroups[cellIdx];

            selectedGroup.OnEnable();

            tableList.data.Clear();

            tableList.cellSize = selectedGroup.GetSize();

            for (var i = 0; i < selectedGroup.NumberOfCells(); i++)
            {
                tableList.data.Add(selectedGroup.CellInfoForIdx(i));
            }

            tableList.tableView.ReloadData();

            tableList.tableView.ScrollToCellWithIdx(0, TableView.ScrollPositionType.Beginning, false);
            tableList.tableView.SelectCellWithIdx(selectedGroup.CellToSelect(), false);

            ScrollView_scrollPositionChangedEvent(0f);
        }
 private void HandleCellSelectedEvent(SegmentedControl control, int cell)
 {
     SettingsGroupChanged?.Invoke((SettingsGroupType)cell);
 }
コード例 #18
0
        public PopupsPage()
        {
            Padding = 20;
            _hzLayoutOptions.SelectIndex(1);
            _vtLayoutOptions.SelectIndex(1);

            #region ModalPopup
            cancelModalButton.Clicked += async(sender, e) => await _modalPopup.CancelAsync();

            popPushModalButton.Clicked += (sender, e) =>
            {
                _modalPopup.IsVisible = false;
                _modalPopup.IsVisible = true;
            };
            showModalButton.Clicked += (sender, e) =>
            {
                _modalPopup.HasShadow         = _hasShadow;
                _modalPopup.ShadowInverted    = _shadowInverted;
                _modalPopup.OutlineWidth      = _blueOutline ? 1 : 0;
                _modalPopup.IsVisible         = true;
                _modalPopup.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                _modalPopup.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region BubblePopups


            var showBubbleLeftButton = new Forms9Patch.Button(bubbleLeftText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleRightButton = new Forms9Patch.Button(bubbleRightText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleUpButton = new Forms9Patch.Button(bubbleUpText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleDownButton = new Forms9Patch.Button(bubbleDownText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleHzButton = new Forms9Patch.Button(bubbleHzText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleVtButton = new Forms9Patch.Button(bubbleVtText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleAnyButton = new Forms9Patch.Button(bubbleAnyText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleNoneButton = new Forms9Patch.Button(bubbleNoneText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };

            var bubblePointerDirectionControl = new SegmentedControl
            {
                Segments =
                {
                    new Segment("←"),
                    new Segment("↑"),
                    new Segment("→"),
                    new Segment("↓"),
                    new Segment("↔"),
                    new Segment("↕"),
                    new Segment("↔ ↕"),
                    new Segment(" ")
                },
                SyncSegmentFontSizes = false,
            };

            var cancelBubbleButton = new Forms9Patch.Button("CANCEL");

            var bubbleTarget = new Forms9Patch.Frame
            {
                OutlineWidth      = 1,
                OutlineColor      = Color.Black,
                OutlineRadius     = 4,
                Content           = new Forms9Patch.Label("BUBBLE TARGET"),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };

            bubble = new BubblePopup(bubbleTarget)
            {
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new Forms9Patch.Label("BubblePopup")
                        {
                            FontAttributes = FontAttributes.Bold
                        },
                        bubblePointerDirectionControl,
                        cancelBubbleButton
                    },
                },
            };

            bubblePointerDirectionControl.SegmentTapped += (sender, e) =>
            {
                switch (e.Segment.Text)
                {
                case "←": bubble.PointerDirection = PointerDirection.Left; break;

                case "↑": bubble.PointerDirection = PointerDirection.Up; break;

                case "→": bubble.PointerDirection = PointerDirection.Right; break;

                case "↓": bubble.PointerDirection = PointerDirection.Down; break;

                case "↔": bubble.PointerDirection = PointerDirection.Horizontal; break;

                case "↕": bubble.PointerDirection = PointerDirection.Vertical; break;

                case "↔↕": bubble.PointerDirection = PointerDirection.Any; break;

                case " ": bubble.PointerDirection = PointerDirection.None; break;
                }
            };

            cancelBubbleButton.Clicked += async(sender, e) => await bubble.CancelAsync();

            showBubbleLeftButton.Clicked  += OnBubbleButtonClicked;
            showBubbleRightButton.Clicked += OnBubbleButtonClicked;
            showBubbleUpButton.Clicked    += OnBubbleButtonClicked;
            showBubbleDownButton.Clicked  += OnBubbleButtonClicked;
            showBubbleHzButton.Clicked    += OnBubbleButtonClicked;
            showBubbleVtButton.Clicked    += OnBubbleButtonClicked;
            showBubbleAnyButton.Clicked   += OnBubbleButtonClicked;
            showBubbleNoneButton.Clicked  += OnBubbleButtonClicked;
            #endregion


            #region ActivityPopup
            Forms9Patch.Button showActivityPopupButton = new Forms9Patch.Button("ActivityIndicatorPopup")
            {
                BackgroundColor = Color.White
            };
            showActivityPopupButton.Clicked += (sender, e) =>
            {
                //var activity = Forms9Patch.ActivityIndicatorPopup.Create();
                _activity.CancelOnPageOverlayTouch = true;
                _activity.IsVisible = true;
            };
            #endregion


            #region PermissionPopup
            var showPermissionButton = new Forms9Patch.Button("PermissionPopup")
            {
                BackgroundColor = Color.White
            };
            showPermissionButton.Clicked += (sender, e) =>
            {
                var permission = PermissionPopup.Create("PermissionPopup", "Do you agree?");
                permission.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                permission.VerticalOptions   = LayoutOption(_vtLayoutOptions);
                permission.OutlineColor      = Color.Blue;
                permission.HasShadow         = _hasShadow;
                permission.ShadowInverted    = _shadowInverted;
                permission.OutlineWidth      = _blueOutline ? 1 : 0;
            };
            #endregion


            #region Toast
            var showToastButton = new Forms9Patch.Button("Toast")
            {
                BackgroundColor = Color.White
            };
            showToastButton.Clicked += (sender, e) =>
            {
                var toast = Toast.Create("Toast", "... of the town!");
                toast.OutlineColor      = Color.Blue;
                toast.HasShadow         = _hasShadow;
                toast.ShadowInverted    = _shadowInverted;
                toast.OutlineWidth      = _blueOutline ? 1 : 0;
                toast.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                toast.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region TargetedToast
            var showTargetedToash = new Forms9Patch.Button("TargetedToast")
            {
                BackgroundColor = Color.White
            };
            showTargetedToash.Clicked += (sender, e) =>
            {
                var toast = TargetedToast.Create(showTargetedToash, "TargetedToast", "... has the far getted most!");
                toast.OutlineColor      = Color.Blue;
                toast.HasShadow         = _hasShadow;
                toast.ShadowInverted    = _shadowInverted;
                toast.OutlineWidth      = _blueOutline ? 1 : 0;
                toast.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                toast.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region TargetedMenu
            showTargetedMenu = new Forms9Patch.Button("TargetedMenu")
            {
                BackgroundColor = Color.White
            };
            var targetedMenu = new Forms9Patch.TargetedMenu(showTargetedMenu)
            {
                Segments =
                {
                    new Segment("Copy",       "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14D;</font>"),
                    new Segment("Cut",        "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14E;</font>"),
                    new Segment("Paste",      "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14F;</font>"),
                    new Segment("Segment A"),
                    new Segment("Segment B"),
                    new Segment("Segment C"),
                    new Segment("Segment D"),
                    new Segment("Segment E"),
                    new Segment("Segment F"),
                    new Segment("Segment G"),
                    new Segment("Segment H"),
                },
                TextColor = Color.White
            };
            showTargetedMenu.Clicked += (s, e) =>
            {
                targetedMenu.IsVisible      = true;
                targetedMenu.HasShadow      = _hasShadow;
                targetedMenu.ShadowInverted = _shadowInverted;
                targetedMenu.IsVisible      = true;
            };
            targetedMenu.SegmentTapped += (s, e) => System.Diagnostics.Debug.WriteLine("TargetedMenu.SegmentTapped: " + e.Segment.Text);
            #endregion


            #region Vertical TargetedMenu
            var showVerticalTargetedMenu = new Forms9Patch.Button("Vertical TargetedMenu")
            {
                BackgroundColor = Color.White
            };
            var verticalTargetedMenu = new Forms9Patch.TargetedMenu(showVerticalTargetedMenu)
            {
                Orientation = StackOrientation.Vertical,
                Segments    =
                {
                    new Segment("Copy",       "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14D;</font>"),
                    new Segment("Cut",        "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14E;</font>"),
                    new Segment("Paste",      "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14F;</font>"),
                    new Segment("Segment A"),
                    new Segment("Segment B"),
                    new Segment("Segment C"),
                    new Segment("Segment D"),
                    new Segment("Segment E"),
                    new Segment("Segment F"),
                    new Segment("Segment G"),
                    new Segment("Segment H"),
                },
            };
            showVerticalTargetedMenu.Clicked += (s, e) =>
            {
                //verticalTargetedMenu.OutlineColor = Color.Blue;
                verticalTargetedMenu.IsVisible      = true;
                verticalTargetedMenu.HasShadow      = _hasShadow;
                verticalTargetedMenu.ShadowInverted = _shadowInverted;
                verticalTargetedMenu.IsVisible      = true;
            };
            verticalTargetedMenu.SegmentTapped += (s, e) => System.Diagnostics.Debug.WriteLine("TargetedMenu.SegmentTapped: " + e.Segment.Text);
            #endregion


            #region SoftwareKeyboardTest

            var yearPicker = new Xamarin.Forms.Picker
            {
                Title       = "SELECT YEAR",
                ItemsSource = new List <string> {
                    "SELECT YEAR", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2006", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020"
                },
                SelectedItem  = "SELECT YEAR",
                SelectedIndex = 0,
                TextColor     = Color.LightGray,
            };
            yearPicker.SelectedIndexChanged += (s, e) => yearPicker.TextColor = yearPicker.SelectedIndex == 0 ? Color.LightGray : Color.Blue;

            var monthPicker = new Xamarin.Forms.Picker
            {
                Title       = "SELECT MONTH",
                ItemsSource = new List <string> {
                    "SELECT MONTH", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
                },
                SelectedItem = "SELECT MONTH",
                TextColor    = Color.LightGray,
            };
            monthPicker.SelectedIndexChanged += (s, e) => monthPicker.TextColor = monthPicker.SelectedIndex == 0 ? Color.LightGray : Color.Blue;


            var softwareKeyboardTestButton = new Forms9Patch.Button("Software Keyboard Test")
            {
                BackgroundColor = Color.White
            };
            var softwareKeyboardTestPopup = new ModalPopup
            {
                HorizontalOptions = LayoutOption(_hzLayoutOptions),
                VerticalOptions   = LayoutOption(_vtLayoutOptions),
                Content           =
                    new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        yearPicker,
                        monthPicker,
                        new Xamarin.Forms.Entry
                        {
                            Placeholder      = "ENTER FIRST NAME",
                            TextColor        = Color.Blue,
                            PlaceholderColor = Color.LightGray,
                        },
                        new Xamarin.Forms.Entry
                        {
                            Placeholder      = "ENTER LAST NAME",
                            TextColor        = Color.Blue,
                            PlaceholderColor = Color.LightGray,
                        },
                    }
                }
            };
            softwareKeyboardTestButton.Clicked += (s, e) =>
            {
                softwareKeyboardTestPopup.OutlineColor      = Color.Blue;
                softwareKeyboardTestPopup.HasShadow         = _hasShadow;
                softwareKeyboardTestPopup.ShadowInverted    = _shadowInverted;
                softwareKeyboardTestPopup.OutlineWidth      = _blueOutline ? 1 : 0;
                softwareKeyboardTestPopup.IsVisible         = true;
                softwareKeyboardTestPopup.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                softwareKeyboardTestPopup.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion

            Content = new Xamarin.Forms.ScrollView
            {
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new BoxView {
                            HeightRequest = 1
                        },
                        _decoration,
                        new Forms9Patch.Label("HZ LAYOUT ALIGNMENT:"),
                        _hzLayoutOptions,
                        new Forms9Patch.Label("VT LAYOUT ALIGNMENT:"),
                        _vtLayoutOptions,
                        new BoxView {
                            HeightRequest = 1
                        },
                        showModalButton,
                        showBubbleLeftButton,
                        showBubbleRightButton,
                        showBubbleUpButton,
                        showBubbleDownButton,
                        showBubbleHzButton,
                        showBubbleVtButton,
                        showBubbleAnyButton,
                        showBubbleNoneButton,
                        bubbleTarget,
                        showActivityPopupButton,
                        showPermissionButton,
                        showToastButton,
                        showTargetedToash,
                        showTargetedMenu,
                        showVerticalTargetedMenu,
                        softwareKeyboardTestButton,
                        new BoxView {
                            HeightRequest = 1
                        },
                    }
                }
            };

            _decoration.SegmentTapped += (s, e) =>
            {
                switch (e.Segment.Text)
                {
                case _hasShadowText:
                    _hasShadow = !_hasShadow;
                    break;

                case _shadowInvertedText:
                    _shadowInverted = !_shadowInverted;
                    break;

                case _blueOutlineText:
                    _blueOutline = !_blueOutline;
                    break;
                }
            };

            BackgroundColor = Color.LightSlateGray;
        }
コード例 #19
0
ファイル: MainWindow.cs プロジェクト: nagyist/monoxide
        private void CreateToolbarTemplate()
        {
            if (ToolbarTemplate.IsDefined("Main")) return;

            var segmentedControl = new SegmentedControl() { Style = SegmentStyle.TextureRounded, SelectionMode = ItemSelectionMode.None };
            segmentedControl.Segments.Add(new Segment() { Image = Image.GoLeftTemplate });
            segmentedControl.Segments.Add(new Segment() { Image = Image.GoRightTemplate });
            var myItem1 = new ImageToolbarItem("Foo") { Label = "Foo", Image = Image.Info };
            var myItem2 = new ImageToolbarItem("Bar") { Label = "Bar", Image = Image.UserAccounts };
            var myItem3 = new ViewToolbarItem("FooBar") { Label = "FooBar", View = segmentedControl };
            var myItem4 = new ViewToolbarItem("Search") { Label = "Search", View = new SearchField() };

            ToolbarTemplate.TryDefine
            (
                "Main",
                new []
                {
                    ToolbarItem.ColorsToolbarItem,
                    ToolbarItem.FontsToolbarItem,
                    ToolbarItem.SeparatorToolbarItem,
                    ToolbarItem.SpaceToolbarItem,
                    ToolbarItem.FlexibleSpaceToolbarItem,
                    myItem1,
                    myItem2,
                    myItem3,
                    myItem4
                },
                new []
                {
                    ToolbarItem.ColorsToolbarItem,
                    myItem1,
                    myItem3,
                    ToolbarItem.FlexibleSpaceToolbarItem,
                    myItem4
                }
            );
        }
 static bool Prefix(SegmentedControlCell changedCell, ref int ____selectedCellNumber, Action <SegmentedControl, int> ___didSelectCellEvent, SegmentedControl __instance)
 {
     if (____selectedCellNumber == -1)
     {
         ____selectedCellNumber = changedCell.cellNumber;
         ___didSelectCellEvent?.Invoke(__instance, changedCell.cellNumber);
         return(false);
     }
     return(true);
 }
コード例 #21
0
        public EmbeddedResourceFontEffectPage()
        {
            Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(_label);
            _editor.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect());
            _entry.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect());

            Forms9Patch.SegmentedControl segmentedControl = new SegmentedControl
            {
                Margin     = new Thickness(10, 0),
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf",
                Segments   =
                {
                    new Forms9Patch.Segment("label"),
                    new Forms9Patch.Segment("editor"),
                    new Forms9Patch.Segment("entry"),
                }
            };

            Content = new Xamarin.Forms.StackLayout
            {
                Children =
                {
                    _label,
                    _editor,
                    _entry,
                    new Xamarin.Forms.Label {
                        Text = "Focus:"
                    },
                    segmentedControl
                }
            };

            segmentedControl.SegmentTapped += (sender, e) =>
            {
                switch (e.Segment.Text)
                {
                case "label": _label.HardwareKeyFocus(); break;

                case "editor": _editor.HardwareKeyFocus(); break;

                case "entry": _entry.HardwareKeyFocus(); break;
                }
            };

            HardwareKeyPage.FocusedElementChanged += (sender, e) =>
            {
                if (sender == _label)
                {
                    segmentedControl.SelectIndex(0);
                }
                else if (sender == _editor)
                {
                    segmentedControl.SelectIndex(1);
                }
                else if (sender == _entry)
                {
                    segmentedControl.SelectIndex(2);
                }
                else
                {
                    segmentedControl.DeselectAll();
                }
            };

            _label.Focused  += (sender, e) => System.Diagnostics.Debug.WriteLine("label.Focused " + e.IsFocused);
            _editor.Focused += (sender, e) => System.Diagnostics.Debug.WriteLine("editor.Focused " + e.IsFocused);
            _entry.Focused  += (sender, e) => System.Diagnostics.Debug.WriteLine("entry.Focused " + e.IsFocused);

            _label.Unfocused  += (sender, e) => System.Diagnostics.Debug.WriteLine("label.Unfocused " + e.IsFocused);
            _editor.Unfocused += (sender, e) => System.Diagnostics.Debug.WriteLine("editor.Unfocused " + e.IsFocused);
            _entry.Unfocused  += (sender, e) => System.Diagnostics.Debug.WriteLine("entry.Unfocused " + e.IsFocused);

            _label.FocusChangeRequested  += (object sender, FocusRequestArgs e) => System.Diagnostics.Debug.WriteLine("label.FocusChangeRequested ");
            _editor.FocusChangeRequested += (object sender, FocusRequestArgs e) => System.Diagnostics.Debug.WriteLine("editor.FocusChangeRequested ");
            _entry.FocusChangeRequested  += (object sender, FocusRequestArgs e) => System.Diagnostics.Debug.WriteLine("entry.FocusChangeRequested ");

            this.AddHardwareKeyListener("ç", OnHardwareKeyPressed);
            this.AddHardwareKeyListener("é", OnHardwareKeyPressed);
            this.AddHardwareKeyListener("ф", OnHardwareKeyPressed);

            this.AddHardwareKeyListener("A", OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.PlatformKey, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.Control, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.Alternate, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.CapsLock, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.FunctionKey, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.Shift, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.Shift | HardwareKeyModifierKeys.Alternate, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.Shift | HardwareKeyModifierKeys.Control, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.Shift | HardwareKeyModifierKeys.PlatformKey, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.Control | HardwareKeyModifierKeys.Alternate, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("a", HardwareKeyModifierKeys.Control | HardwareKeyModifierKeys.PlatformKey, OnHardwareKeyPressed);


            this.AddHardwareKeyListener("5", OnHardwareKeyPressed);
            this.AddHardwareKeyListener("5", HardwareKeyModifierKeys.NumericPadKey, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("5", HardwareKeyModifierKeys.PlatformKey, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("5", HardwareKeyModifierKeys.Control, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("5", HardwareKeyModifierKeys.Alternate, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("5", HardwareKeyModifierKeys.CapsLock, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("5", HardwareKeyModifierKeys.FunctionKey, OnHardwareKeyPressed);
            this.AddHardwareKeyListener("5", HardwareKeyModifierKeys.Shift, OnHardwareKeyPressed);



            this.AddHardwareKeyListener("/", OnHardwareKeyPressed);
            this.AddHardwareKeyListener("/", HardwareKeyModifierKeys.Alternate, OnHardwareKeyPressed);

            this.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.BackspaceDeleteKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.ForwardDeleteKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.InsertKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.TabKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.EnterReturnKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.PageUpKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.PageDownKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.HomeKeyInput, OnHardwareKeyPressed);
            this.AddHardwareKeyListener(HardwareKey.EndKeyInput, OnHardwareKeyPressed);

            _entry.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed);
            _entry.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed);
            _entry.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed);
            _entry.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed);
            _entry.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed);

            _editor.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed);
            _editor.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed);
            _editor.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed);
            _editor.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed);
            _editor.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed);

            _label.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed);
            _label.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed);
            _label.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed);
            _label.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed);
            _label.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed);
        }
コード例 #22
0
 void ReleaseDesignerOutlets()
 {
     if (CommentsView != null)
     {
         CommentsView.Dispose();
         CommentsView = null;
     }
     if (CommentTextBox != null)
     {
         CommentTextBox.Dispose();
         CommentTextBox = null;
     }
     if (CostLabel != null)
     {
         CostLabel.Dispose();
         CostLabel = null;
     }
     if (DateLabel != null)
     {
         DateLabel.Dispose();
         DateLabel = null;
     }
     if (DistanceLabel != null)
     {
         DistanceLabel.Dispose();
         DistanceLabel = null;
     }
     if (DriverLabel != null)
     {
         DriverLabel.Dispose();
         DriverLabel = null;
     }
     if (EndLabel != null)
     {
         EndLabel.Dispose();
         EndLabel = null;
     }
     if (FromLabel != null)
     {
         FromLabel.Dispose();
         FromLabel = null;
     }
     if (MakerLabel != null)
     {
         MakerLabel.Dispose();
         MakerLabel = null;
     }
     if (ModelLabel != null)
     {
         ModelLabel.Dispose();
         ModelLabel = null;
     }
     if (RateLabel != null)
     {
         RateLabel.Dispose();
         RateLabel = null;
     }
     if (ResumeView != null)
     {
         ResumeView.Dispose();
         ResumeView = null;
     }
     if (SegmentedControl != null)
     {
         SegmentedControl.Dispose();
         SegmentedControl = null;
     }
     if (StartLabel != null)
     {
         StartLabel.Dispose();
         StartLabel = null;
     }
     if (ToLabel != null)
     {
         ToLabel.Dispose();
         ToLabel = null;
     }
     if (VehicleImage != null)
     {
         VehicleImage.Dispose();
         VehicleImage = null;
     }
 }
コード例 #23
0
        void InitSubviews()
        {
            scrollView = new UIScrollView (View.Bounds) {
                BackgroundColor = UIColor.Clear,
                AutoresizingMask = UIViewAutoresizing.All,
                ContentSize = View.Bounds.Size
            };

            progressBar = new PopoverProgressBar (new RectangleF (10, 30, 292, 28));
            progressBar.Progress = 0.5f;
            progressBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;

            scrollView.Add (progressBar);

            var label = new UILabel (new RectangleF (10, 70, 292, 28)) {
                Text = "Move slider below to see progress",

                //Font = UIFont.SystemFontOfSize (14),
                BackgroundColor = UIColor.Clear,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth
            };

            scrollView.Add (label);

            slider = new UISlider (new RectangleF (10, 110, 292, 28)) {
                MaxValue = 1,
                MinValue = 0,
                Value = 0.5f,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth
            };

            slider.ValueChanged += OnValueChanged;

            // Applies theme styles on specified element
            ProlificTheme.Apply (slider);

            scrollView.Add (slider);

            var segments = new List<object> (3) { "Featured", "Top Charts", "Categories" };

            var segmentControl = new SegmentedControl (segments) {
                Frame = new RectangleF (10, 140, 292, 44),
                SelectedIndex = 1,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth
            };

            scrollView.Add (segmentControl);

            var switchControl = new SwitchOnOff (new RectangleF (120, 230, 80, 27));
            switchControl.SetState (true, false);
            switchControl.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;

            scrollView.Add (switchControl);

            var textField = new UITextField (new RectangleF (10, 300, 292, 31)) {
                LeftView = new UIView (new RectangleF (0, 0, 5, 20)),
                LeftViewMode = UITextFieldViewMode.Always,
                Text = "Type your text!",
                TextColor = UIColor.DarkGray,
                VerticalAlignment = UIControlContentVerticalAlignment.Center,
                Background = ProlificTheme.SharedTheme.TextFielBackground,
                Delegate = new TextFieldDelegate (),
                Font = UIFont.SystemFontOfSize (14),
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth
                //this.textField.text = "";

            };

            scrollView.Add (textField);

            InitLabels ();

            View.Add (scrollView);

            base.ViewDidLoad ();
        }
コード例 #24
0
 private void BeatmapDifficultySegmentedControl_didSelectCellEvent(SegmentedControl arg1, int arg2)
 {
     RaiseDifficultyChangedEvent();
 }
コード例 #25
0
 private void BeatmapCharacteristicSegmentedControl_DidSelectCellEvent(SegmentedControl _, int __)
 {
     HighlightDifficultiesForSelectedCharacteristic();
 }
 private void _tabControl_didSelectCellEvent(SegmentedControl arg1, int selectedIndex)
 {
     _playersTab.gameObject.SetActive(selectedIndex == 0);
     _modifiersTab.gameObject.SetActive(selectedIndex == 1);
 }
コード例 #27
0
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// When the queue type is changed
        /// </summary>
        /// <param name="p_Sender">Event sender</param>
        /// <param name="p_Index">Tab index</param>
        private void OnTabChanged(SegmentedControl p_Sender, int p_Index)
        {
            UnselectSong();

            /// todo...
        }
コード例 #28
0
 private void SettingsSubviewSelected(SegmentedControl _, int index)
 {
     ((ISettingsSubviewController)settingsSubviewControllers[currentSubviewIndex]).Deactivate();
     ((ISettingsSubviewController)settingsSubviewControllers[index]).Activate(rootTransform);
     currentSubviewIndex = index;
 }
コード例 #29
0
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// When the type is changed
        /// </summary>
        /// <param name="p_Sender">Event sender</param>
        /// <param name="p_Index">Tab index</param>
        private void OnTypeChanged(SegmentedControl p_Sender, int p_Index)
        {
            m_MenuPanel.SetActive(p_Index == 0);
            m_DevToolsTestingPanel.SetActive(p_Index == 1);
        }
コード例 #30
0
 private void HandleCellSelectedEvent(SegmentedControl control, int cellIdx)
 {
     OnSettingsGroupChanged?.Invoke(cellIdx);
 }
コード例 #31
0
 private void TabSelected(SegmentedControl segmentedControl, int index)
 {
     OnButtonClicked?.Invoke(index);
 }
コード例 #32
0
 private void RegisterSegmentedControlCallbacks(SegmentedControl item)
 {
     item.onValueChanged.AddListener(arg => OnCurrentEventChanged?.Invoke());
     item.onValueChanged.AddListener(arg => ShowInfo());
 }
コード例 #33
0
 [UIAction("update-tab")] internal void UpdateTab(SegmentedControl _, int tab)
 {
     SelectedTab = tab;
     TabWasChangedEvent(tab);
 }