Exemplo n.º 1
0
        public static IControl Create(IProject project, ElementContext elementContext)
        {
            var m = Spacer.Medium.DesiredSize.Width;
            var s = Spacer.Small.DesiredSize.Width;

            var hasClasses   = project.Classes.Select(x => x.Any());
            var searchString = Property.Create("");

            return(Layout.Dock()
                   .Top(Layout.Dock()
                        .Top(Separator.Medium)
                        .Bottom(Separator.Weak)
                        .Bottom(Separator.Medium)
                        .Left(Spacer.Medium)
                        .Left(Icons.ClassesSmall())
                        .Left(Spacer.Small)
                        .Left(Theme.Header("Your classes"))
                        .Fill()
                        .WithHeight(26))
                   .Top(ThemedTextBox
                        .Create(searchString)
                        .WithPlaceholderText(searchString.Select(str => str != ""), "Search your classes")
                        .WithMediumPadding()
                        .ShowWhen(hasClasses))
                   .Top(
                       Layout.StackFromLeft(
                           Icons.DragIconSmall(),
                           Spacer.Small,
                           Label.Create(
                               "Drag classes into the hierarchy \nto insert instances of them",
                               font: Theme.DefaultFont,
                               textAlignment: TextAlignment.Left,
                               color: Theme.DescriptorText),
                           Spacer.Medium)
                       .ShowWhen(hasClasses)
                       .CenterHorizontally())
                   .Top(
                       Layout.StackFromLeft(
                           Icons.ExtractClass(hasClasses),
                           Spacer.Small,
                           Label.Create(
                               "Create a class from elements in the \nhierarchy and it will appear here",
                               font: Theme.DefaultFont,
                               textAlignment: TextAlignment.Left,
                               color: Theme.DescriptorText),
                           Spacer.Medium)
                       .WithMediumPadding()
                       .HideWhen(hasClasses)
                       .CenterHorizontally())
                   .Fill(
                       project.Classes
                       .CachePerElement(e => CreateClassItem(e, project.Context, elementContext, searchString))
                       .StackFromTop()
                       .WithPadding(left: m, top: s, right: m, bottom: s)
                       .MakeScrollable(darkTheme: Theme.IsDark))
                   .MakeResizable(RectangleEdge.Top, "MyClassesHeight"));
        }
Exemplo n.º 2
0
 static IControl CreateButton(
     Command command,
     Brush hoverColor     = default(Brush),
     Command mouseEntered = default(Command),
     Command mouseExited  = default(Command))
 {
     return
         (Layout.StackFromTop(
              ThemedButton.Create(
                  command: command,
                  label: "Make class from selection",
                  icon: Icons.ExtractClass(command.IsEnabled),
                  tooltip: "Make class from selection",
                  hoverColor: hoverColor)
              .WithHeight(45)
              .OnMouse(
                  entered: mouseEntered,
                  exited: mouseExited),
              Separator.Shadow));
 }