Пример #1
0
        IControl CreateContent(CreateProject createProject, IDialog <object> dialog, string fuseVersion)
        {
            var projectList           = new ProjectList(new Shell(), createProject, dialog);
            var openProjectFromDialog =
                Command.Enabled(() => Application.ShowOpenDocumentDialog(DocumentTypes.Project));

            return(Popover.Host(popover =>
                                Layout.Dock()
                                .Top(
                                    CreateDashTopBar(fuseVersion)
                                    )
                                .Top(Separator.Medium)

                                .Right(Layout.StackFromTop(
                                           Layout.Dock()
                                           .Fill(
                                               Layout.SubdivideVertically(
                                                   InfoItem("Learn", "New to Fuse? Explore our Handbook,\r\nTutorials and Examples.", "http://go.fusetools.com/tutorials", "Outracks.Fuse.Icons.Dashboard.Learn.png"),
                                                   InfoItem("Docs", "Need some technical information?\r\nSearch the reference docs.", "https://go.fusetools.com/docs", "Outracks.Fuse.Icons.Dashboard.Docs.png"),
                                                   InfoItem("Community", "Made something cool? Join a thriving\r\ncommunity of Fuse enthusiasts.", "https://go.fusetools.com/community", "Outracks.Fuse.Icons.Dashboard.Community.png"))
                                               .WithPadding(
                                                   left: new Points(32),
                                                   top: new Points(40))
                                               .WithHeight(300)),
                                           Separator.Weak,
                                           CreateOpenButtons(openProjectFromDialog, projectList)
                                           )
                                       .WithWidth(260)
                                       .WithHeight(600)
                                       .WithBackground(Theme.PanelBackground))
                                .Fill(projectList.Page)
                                .WithBackground(Theme.WorkspaceBackground)
                                .WithHeight(608)
                                .WithWidth(970)));
        }
Пример #2
0
        public static IControl Create(IProject project)
        {
            var element = project.Context.CurrentSelection;

            var nothingSelected = element.SimulatorId.Select(id => id == ObjectIdentifier.None);

            var elementChanged = element.SimulatorId.Select(id => (object)id);


            return(Popover.Host(popover =>
            {
                var uneditableElementMessage = UneditableElementMessage(project);
                var uneditableElementIsSelected = uneditableElementMessage.Select(x => x.HasValue);
                var uneditablePlaceholder = UneditablePlaceholder(uneditableElementMessage).ShowWhen(uneditableElementIsSelected);

                return Layout.StackFromTop(
                    Sections.CommonSection.Create(element, project, new Factory(elementChanged, popover), popover),
                    Sections.AdvancedSection.Create(element, new Factory(elementChanged, popover))
                    .MakeCollapsable(RectangleEdge.Top, uneditableElementIsSelected.IsFalse(), animate: false))
                .WithWidth(Width)
                .DockLeft()
                .MakeScrollable(darkTheme: Theme.IsDark, horizontalScrollBarVisible: false)
                .WithBackground(uneditablePlaceholder.ShowWhen(uneditableElementIsSelected))
                .WithOverlay(Placeholder().ShowWhen(nothingSelected));
            }));
        }
Пример #3
0
        public static Window Create(
            IObservable <string> projectName,
            IControl search,
            IControl outline,
            IControl bookmarks,
            StageController stage,
            IControl notifications,
            IControl inspector,
            IControl attributes,
            LogView logview,
            Menu menu,
            Command closed,
            IProperty <bool> selectionEnabled,
            IObservable <bool> topMost,
            IProperty <Mode> mode,
            Command mainWindowFocused,
            IContext context,
            CodeView codeView)
        {
            IControl topBar = null;

            var newView = stage.NewViewport;

            var content =
                Popover.Host(
                    popover =>
            {
                topBar = CreateTopBar(
                    popover,
                    selectionEnabled: selectionEnabled,
                    mode: mode,
                    addViewport: newView,
                    codeView: codeView);

                return(CreateContent(
                           logview: logview,
                           outline: outline,
                           search: search,
                           notifications: notifications,
                           attributes: attributes,
                           bookmarks: bookmarks,
                           inspector: inspector,
                           stage: new StageView(stage, context, mode),
                           topBar: topBar,
                           mode: mode));
            });

            var mainWindowSize     = UserSettings.Size("MainWindowSize");
            var mainWindowPosition = UserSettings.Position("MainWindowPosition");
            var mainWindowState    = UserSettings.Settings.Property <WindowState>("MainWindowState");

            var compactSize     = UserSettings.Size("CompactWindowSize");
            var compactPosition = UserSettings.Position("CompactWindowPosition");


            var compactContentSize =
                compactSize.With(value:
                                 compactSize.Merge(
                                     stage.DefaultViewportSize.Select(Optional.Some)
                                     .CombineLatest(
                                         topBar.DesiredSize.Height,
                                         (deviceSize, topBarHeight) =>
                                         deviceSize.Select(s =>
                                                           Size.Create(
                                                               s.Width + ResizeBorderSize * 2 /* padding */,
                                                               s.Height + topBarHeight + ResizeBorderSize * 2 + LogViewHeader.HeaderHeight /* padding */)))));


            var windowSize     = mode.Select(x => x == Mode.Normal ? mainWindowSize : compactContentSize).Switch();
            var windowState    = mode.Select(x => x == Mode.Normal ? mainWindowState : Property.Constant(Optional.Some(WindowState.Normal))).Switch();
            var windowPosition = mode.Select(x => x == Mode.Normal ? mainWindowPosition : compactPosition).Switch();


            return(new Window
            {
                Closed = closed,
                Title = projectName
                        .Select(Optional.Some)
                        .StartWith(Optional.None())
                        .Select(
                    maybePath => maybePath.MatchWith(
                        some: name => name + " - Fuse",
                        none: () => "Fuse")),
                Size = Optional.Some(windowSize),
                Position = Optional.Some(windowPosition),
                State = Optional.Some(windowState),
                Menu = menu,
                Content = content,
                TopMost = Optional.Some(topMost),
                Focused = mainWindowFocused,
                Foreground = Theme.DefaultText,
                Background = Theme.PanelBackground,
                Border = Separator.MediumStroke,
                Style = WindowStyle.Fat
            });
        }