コード例 #1
0
 private void OnRemoveClicked(ContextMenuButton button)
 {
     _editor.Remove(_key);
 }
コード例 #2
0
            private void OnEditClicked(ContextMenuButton button)
            {
                var keyType = _editor.Values.Type.GetGenericArguments()[0];

                if (keyType == typeof(string) || keyType.IsPrimitive)
                {
                    var popup = RenamePopup.Show(Parent, Bounds, Text, false);
                    popup.Validate += (renamePopup, value) =>
                    {
                        object newKey;
                        if (keyType.IsPrimitive)
                        {
                            newKey = JsonSerializer.Deserialize(value, keyType);
                        }
                        else
                        {
                            newKey = value;
                        }
                        return(!((IDictionary)_editor.Values[0]).Contains(newKey));
                    };
                    popup.Renamed += renamePopup =>
                    {
                        object newKey;
                        if (keyType.IsPrimitive)
                        {
                            newKey = JsonSerializer.Deserialize(renamePopup.Text, keyType);
                        }
                        else
                        {
                            newKey = renamePopup.Text;
                        }

                        _editor.ChangeKey(_key, newKey);
                        _key = newKey;
                        Text = _key.ToString();
                    };
                }
                else if (keyType.IsEnum)
                {
                    var popup  = RenamePopup.Show(Parent, Bounds, Text, false);
                    var picker = new EnumComboBox(keyType)
                    {
                        AnchorPreset  = AnchorPresets.StretchAll,
                        Offsets       = Margin.Zero,
                        Parent        = popup,
                        EnumTypeValue = _key,
                    };
                    picker.ValueChanged += () =>
                    {
                        popup.Hide();
                        object newKey = picker.EnumTypeValue;
                        if (!((IDictionary)_editor.Values[0]).Contains(newKey))
                        {
                            _editor.ChangeKey(_key, newKey);
                            _key = newKey;
                            Text = _key.ToString();
                        }
                    };
                }
                else
                {
                    throw new NotImplementedException("Missing editing for dictionary key type " + keyType);
                }
            }
コード例 #3
0
 private void OnRemoveClicked(ContextMenuButton button)
 {
     Editor.Remove(Index);
 }
コード例 #4
0
 private void OnMoveDownClicked(ContextMenuButton button)
 {
     Editor.Move(Index, Index + 1);
 }
コード例 #5
0
 private void OnMoveUpClicked(ContextMenuButton button)
 {
     Editor.Move(Index, Index - 1);
 }
コード例 #6
0
ファイル: ModelWindow.cs プロジェクト: kingland/FlaxAPI
 private void OnShowCurrentLODClicked(ContextMenuButton obj)
 {
     _showCurrentLOD            = !_showCurrentLOD;
     _showCurrentLODButton.Icon = _showCurrentLOD ? Style.Current.CheckBoxTick : SpriteHandle.Invalid;
 }
コード例 #7
0
ファイル: ModelWindow.cs プロジェクト: kingland/FlaxAPI
 private void OnShowFloorModelClicked(ContextMenuButton obj)
 {
     _floorModel.IsActive  = !_floorModel.IsActive;
     _showFloorButton.Icon = _floorModel.IsActive ? Style.Current.CheckBoxTick : SpriteHandle.Invalid;
 }