예제 #1
0
        private IEnumerable <IInspectorContentView> MakeContentViews(ITweakable tweakable)
        {
            yield return(contentFactory.MakeDescriptionView(tweakable.Description));

            if (tweakable.TweakableType == typeof(string))
            {
                yield return(contentFactory.MakeEditStringView(tweakable));
            }
            else if (tweakable.TweakableType == typeof(bool))
            {
                yield return(contentFactory.MakeEditBoolView(tweakable));
            }
            else if (!tweakable.TweakableType.IsEnum)
            {
                if (tweakable.TweakableType.IsNumericType())
                {
                    yield return(contentFactory.MakeEditNumericView(tweakable));

                    if (tweakable.HasRange && !TweakerFlagsUtil.IsSet(TweakableUIFlags.HideRangeSlider, tweakable))
                    {
                        yield return(contentFactory.MakeSliderView(tweakable));
                    }
                }
                else
                {
                    yield return(contentFactory.MakeEditSerializedStringView(tweakable, gridController.Console.Serializer));
                }
            }
            if (tweakable.HasStep)
            {
                yield return(contentFactory.MakeStepperView(tweakable));
            }
            if (tweakable.HasToggle)
            {
                InspectorToggleGroupView groupView = contentFactory.MakeToggleGroupView();
                yield return(groupView);

                IToggleTweakable toggle = tweakable.Toggle;
                for (int i = 0; i < toggle.ToggleCount; i++)
                {
                    yield return(contentFactory.MakeToggleValueView(tweakable, toggle, i, groupView.ToggleGroup));
                }
            }
        }
 protected override void ViewTapped(TileView view)
 {
     logger.Trace("Invokable was tapped: {0}", base.View.Name);
     if (base.Node == grid.CurrentDisplayNode)
     {
         if (base.Node.Parent != null)
         {
             grid.DisplayNode(base.Node.Parent);
         }
     }
     else if (invokable == null && grid.CurrentDisplayNode.Type == BaseNode.NodeType.Invokable)
     {
         InvokableNode invokableNode = grid.CurrentDisplayNode as InvokableNode;
         try
         {
             invokableNode.Invoke();
             view.ShowSuccess();
         }
         catch (Exception ex)
         {
             view.ShowError();
             logger.Error(ex.ToString());
             if (TweakerFlagsUtil.IsSet(TweakableUIFlags.RethrowExceptions, invokableNode.Invokable))
             {
                 if (ex.InnerException == null)
                 {
                     throw ex;
                 }
                 if (ex.InnerException.InnerException == null)
                 {
                     throw ex.InnerException;
                 }
                 throw ex.InnerException.InnerException;
             }
         }
     }
     else
     {
         grid.DisplayNode(base.Node);
     }
 }