public RunningTaskRow(string title, RunningTaskDetails taskDetails, ThemeConfig theme)
            : base(FlowDirection.TopToBottom)
        {
            this.taskDetails = taskDetails;
            this.theme       = theme;

            this.MinimumSize = new Vector2(100, 20);

            var detailsPanel = new GuiWidget()
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
            };

            var rowContainer = new GuiWidget()
            {
                VAnchor = VAnchor.Fit,
                HAnchor = HAnchor.Stretch,
            };

            this.AddChild(rowContainer);

            var topRow = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                Padding = 0,
            };

            rowContainer.AddChild(topRow);

            progressBar = new ProgressBar()
            {
                HAnchor         = HAnchor.Stretch,
                Height          = 2,
                VAnchor         = VAnchor.Absolute | VAnchor.Bottom,
                FillColor       = ActiveTheme.Instance.PrimaryAccentColor,
                BorderColor     = Color.Transparent,
                BackgroundColor = ActiveTheme.Instance.TertiaryBackgroundColor,
                Margin          = new BorderDouble(32, 7, theme.ButtonHeight * 2 + 14, 0),
            };
            rowContainer.AddChild(progressBar);

            expandButton = new ExpandCheckboxButton(!string.IsNullOrWhiteSpace(title) ? title : taskDetails.Title, theme, 10)
            {
                VAnchor = VAnchor.Center | VAnchor.Fit,
                HAnchor = HAnchor.Stretch,
                Checked = false,
                Padding = 0
            };
            expandButton.CheckedStateChanged += (s, e) =>
            {
                taskDetails.IsExpanded = expandButton.Checked;
                SetExpansionMode(theme, detailsPanel, expandButton.Checked);
            };
            topRow.AddChild(expandButton);

            IconButton resumeButton = null;

            var pauseButton = new IconButton(AggContext.StaticData.LoadIcon("fa-pause_12.png", theme.InvertIcons), theme)
            {
                Margin      = theme.ButtonSpacing,
                Enabled     = taskDetails.Options?.PauseAction != null,
                ToolTipText = taskDetails.Options?.PauseToolTip ?? "Pause".Localize()
            };

            if (taskDetails.Options?.IsPaused != null)
            {
                RunningInterval runningInterval = null;
                runningInterval = UiThread.SetInterval(() =>
                {
                    if (taskDetails.Options.IsPaused())
                    {
                        pauseButton.Visible  = false;
                        resumeButton.Visible = true;
                    }
                    else
                    {
                        pauseButton.Visible  = true;
                        resumeButton.Visible = false;
                    }
                    if (this.HasBeenClosed)
                    {
                        runningInterval.Continue = false;
                    }
                }, .2);
            }
            pauseButton.Click += (s, e) =>
            {
                taskDetails.Options?.PauseAction();
                pauseButton.Visible  = false;
                resumeButton.Visible = true;
            };
            topRow.AddChild(pauseButton);

            resumeButton = new IconButton(AggContext.StaticData.LoadIcon("fa-play_12.png", theme.InvertIcons), theme)
            {
                Visible     = false,
                Margin      = theme.ButtonSpacing,
                ToolTipText = taskDetails.Options?.ResumeToolTip ?? "Resume".Localize(),
                Name        = "Resume Task Button"
            };
            resumeButton.Click += (s, e) =>
            {
                taskDetails.Options?.ResumeAction();
                pauseButton.Visible  = true;
                resumeButton.Visible = false;
            };
            topRow.AddChild(resumeButton);

            var stopButton = new IconButton(AggContext.StaticData.LoadIcon("fa-stop_12.png", theme.InvertIcons), theme)
            {
                Margin      = theme.ButtonSpacing,
                Name        = "Stop Task Button",
                ToolTipText = taskDetails.Options?.StopToolTip ?? "Cancel".Localize()
            };

            stopButton.Click += (s, e) =>
            {
                var stopAction = taskDetails.Options?.StopAction;
                if (stopAction == null)
                {
                    taskDetails.CancelTask();
                }
                else
                {
                    stopAction.Invoke();
                }
            };
            topRow.AddChild(stopButton);

            this.AddChild(detailsPanel);

            // Add rich progress controls
            if (taskDetails.Options?.RichProgressWidget?.Invoke() is GuiWidget guiWidget)
            {
                detailsPanel.AddChild(guiWidget);
            }

            if (taskDetails.Options?.ReadOnlyReporting == true)
            {
                stopButton.Visible   = false;
                pauseButton.Visible  = false;
                resumeButton.Visible = false;

                // Ensure the top row is as big as it would be with buttons
                topRow.MinimumSize = new Vector2(0, resumeButton.Height);
            }

            SetExpansionMode(theme, detailsPanel, taskDetails.IsExpanded);

            taskDetails.ProgressChanged += TaskDetails_ProgressChanged;
        }
        public RunningTaskRow(string title, RunningTaskDetails taskDetails, ThemeConfig theme)
            : base(FlowDirection.TopToBottom)
        {
            this.taskDetails = taskDetails;
            this.theme       = theme;

            this.MinimumSize = new Vector2(100 * GuiWidget.DeviceScale, 20 * GuiWidget.DeviceScale);

            var detailsPanel = new GuiWidget()
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
            };

            var rowContainer = new GuiWidget()
            {
                VAnchor = VAnchor.Fit,
                HAnchor = HAnchor.Stretch,
            };

            this.AddChild(rowContainer);

            var topRow = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                Padding = 0,
            };

            rowContainer.AddChild(topRow);

            progressBar = new ProgressBar()
            {
                HAnchor     = HAnchor.Stretch,
                Height      = 2 * GuiWidget.DeviceScale,
                VAnchor     = VAnchor.Absolute | VAnchor.Bottom,
                FillColor   = theme.PrimaryAccentColor,
                BorderColor = Color.Transparent,
                Margin      = new BorderDouble(32, 7, theme.ButtonHeight * 2 + 14, 0),
                Visible     = !taskDetails.IsExpanded
            };
            rowContainer.AddChild(progressBar);

            expandButton = new ExpandCheckboxButton(!string.IsNullOrWhiteSpace(title) ? title : taskDetails.Title, theme, 10)
            {
                VAnchor         = VAnchor.Center | VAnchor.Fit,
                HAnchor         = HAnchor.Stretch,
                Checked         = false,
                Padding         = 0,
                AlwaysShowArrow = true
            };
            expandButton.CheckedStateChanged += (s, e) =>
            {
                taskDetails.IsExpanded = expandButton.Checked;
                SetExpansionMode(theme, detailsPanel, expandButton.Checked);
            };
            topRow.AddChild(expandButton);

            GuiWidget resumeButton = null;

            GuiWidget pauseButton = CreateIconOrTextButton("fa-pause_12.png",
                                                           taskDetails.Options?.PauseText,
                                                           taskDetails.Options?.PauseAction,
                                                           taskDetails.Options?.PauseToolTip ?? "Pause".Localize(),
                                                           "",
                                                           theme,
                                                           0);

            if (taskDetails.Options?.IsPaused != null)
            {
                RunningInterval runningInterval = null;
                runningInterval = UiThread.SetInterval(() =>
                {
                    if (taskDetails.Options.IsPaused())
                    {
                        pauseButton.Visible  = false;
                        resumeButton.Visible = true;
                    }
                    else
                    {
                        pauseButton.Visible  = true;
                        resumeButton.Visible = false;
                    }
                    if (this.HasBeenClosed)
                    {
                        UiThread.ClearInterval(runningInterval);
                    }
                }, .2);
            }
            pauseButton.Click += (s, e) =>
            {
                taskDetails.Options?.PauseAction();
                pauseButton.Visible  = false;
                resumeButton.Visible = true;
            };
            topRow.AddChild(pauseButton);


            resumeButton = CreateIconOrTextButton("fa-play_12.png",
                                                  taskDetails.Options?.ResumeText,
                                                  taskDetails.Options?.ResumeAction,
                                                  taskDetails.Options?.ResumeToolTip ?? "Resume".Localize(),
                                                  "Resume Task Button",
                                                  theme,
                                                  0);
            // start with it hidden
            resumeButton.Visible = false;

            resumeButton.Click += (s, e) =>
            {
                taskDetails.Options?.ResumeAction();
                pauseButton.Visible  = true;
                resumeButton.Visible = false;
            };
            topRow.AddChild(resumeButton);

            var stopButton = CreateIconOrTextButton("fa-stop_12.png",
                                                    taskDetails.Options?.StopText,
                                                    taskDetails.Options?.StopAction,
                                                    taskDetails.Options?.StopToolTip ?? "Cancel".Localize(),
                                                    "Stop Task Button",
                                                    theme,
                                                    5);

            stopButton.Enabled = true;

            stopButton.Click += (s, e) =>
            {
                var stopAction = taskDetails.Options?.StopAction;
                if (stopAction == null)
                {
                    taskDetails.CancelTask();
                }
                else
                {
                    stopAction.Invoke(() =>
                    {
                        stopButton.Enabled = true;
                    });
                }

                stopButton.Enabled = false;
            };
            topRow.AddChild(stopButton);

            this.AddChild(detailsPanel);

            // Add rich progress controls
            if (taskDetails.Options?.RichProgressWidget?.Invoke() is GuiWidget guiWidget)
            {
                detailsPanel.AddChild(guiWidget);
            }
            else
            {
                expandButton.Expandable = false;
            }

            if (taskDetails.Options?.ReadOnlyReporting == true)
            {
                stopButton.Visible   = false;
                pauseButton.Visible  = false;
                resumeButton.Visible = false;

                // Ensure the top row is as big as it would be with buttons
                topRow.MinimumSize = new Vector2(0, resumeButton.Height);
            }

            SetExpansionMode(theme, detailsPanel, taskDetails.IsExpanded);

            taskDetails.ProgressChanged += TaskDetails_ProgressChanged;
        }
Beispiel #3
0
        public PrintLibraryWidget(MainViewWidget mainViewWidget, PartWorkspace workspace, ThemeConfig theme, PopupMenuButton popupMenuButton)
        {
            this.theme          = theme;
            this.mainViewWidget = mainViewWidget;
            this.Padding        = 0;
            this.AnchorAll();

            var allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

            libraryContext = workspace.LibraryView;

            libraryView = new LibraryListView(libraryContext, theme)
            {
                Name = "LibraryView",
                // Drop containers if ShowContainers != 1
                ContainerFilter = (container) => UserSettings.Instance.ShowContainers,
                BackgroundColor = theme.BackgroundColor,
                Border          = new BorderDouble(top: 1)
            };

            navBar = new OverflowBar(theme)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
            };
            allControls.AddChild(navBar);
            theme.ApplyBottomBorder(navBar);

            var toolbar = new OverflowBar(AggContext.StaticData.LoadIcon("fa-sort_16.png", 32, 32, theme.InvertIcons), theme)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                Name    = "Folders Toolbar"
            };

            theme.ApplyBottomBorder(toolbar, shadedBorder: true);

            toolbar.OverflowButton.Name = "Print Library View Options";
            toolbar.Padding             = theme.ToolbarPadding;

            toolbar.ExtendOverflowMenu = (popupMenu) =>
            {
                var siblingList = new List <GuiWidget>();

                popupMenu.CreateBoolMenuItem(
                    "Date Created".Localize(),
                    () => libraryView.ActiveSort == LibraryListView.SortKey.CreatedDate,
                    (v) => libraryView.ActiveSort = LibraryListView.SortKey.CreatedDate,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "Date Modified".Localize(),
                    () => libraryView.ActiveSort == LibraryListView.SortKey.ModifiedDate,
                    (v) => libraryView.ActiveSort = LibraryListView.SortKey.ModifiedDate,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "Name".Localize(),
                    () => libraryView.ActiveSort == LibraryListView.SortKey.Name,
                    (v) => libraryView.ActiveSort = LibraryListView.SortKey.Name,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateSeparator();

                siblingList = new List <GuiWidget>();

                popupMenu.CreateBoolMenuItem(
                    "Ascending".Localize(),
                    () => libraryView.Ascending,
                    (v) => libraryView.Ascending = true,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "Descending".Localize(),
                    () => !libraryView.Ascending,
                    (v) => libraryView.Ascending = false,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);
            };

            allControls.AddChild(toolbar);

            var showFolders = new ExpandCheckboxButton("Folders".Localize(), theme)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit | VAnchor.Center,
                Margin  = theme.ButtonSpacing,
                Name    = "Show Folders Toggle",
                Checked = UserSettings.Instance.ShowContainers,
            };

            showFolders.SetIconMargin(theme.ButtonSpacing);
            showFolders.CheckedStateChanged += async(s, e) =>
            {
                UserSettings.Instance.set(UserSettingsKey.ShowContainers, showFolders.Checked ? "1" : "0");
                await libraryView.Reload();
            };
            toolbar.AddChild(showFolders);

            PopupMenuButton viewMenuButton;

            toolbar.AddChild(
                viewMenuButton = new PopupMenuButton(
                    new ImageWidget(AggContext.StaticData.LoadIcon("mi-view-list_10.png", 32, 32, theme.InvertIcons))
            {
                //VAnchor = VAnchor.Center
            },
                    theme)
            {
                AlignToRightEdge = true
            });

            viewMenuButton.DynamicPopupContent = () =>
            {
                var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);

                var listView = this.libraryView;

                var siblingList = new List <GuiWidget>();

                popupMenu.CreateBoolMenuItem(
                    "View List".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.RowListView,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.RowListView;
                    listView.ListContentView = new RowListView(theme);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);
#if DEBUG
                popupMenu.CreateBoolMenuItem(
                    "View XSmall Icons".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.IconListView18,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.IconListView18;
                    listView.ListContentView = new IconListView(theme, 18);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "View Small Icons".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.IconListView70,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.IconListView70;
                    listView.ListContentView = new IconListView(theme, 70);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);
#endif
                popupMenu.CreateBoolMenuItem(
                    "View Icons".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.IconListView,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.IconListView;
                    listView.ListContentView = new IconListView(theme);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "View Large Icons".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.IconListView256,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.IconListView256;
                    listView.ListContentView = new IconListView(theme, 256);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                return(popupMenu);
            };

            breadCrumbWidget = new FolderBreadCrumbWidget(workspace.LibraryView, theme);
            navBar.AddChild(breadCrumbWidget);

            var searchPanel = new SearchInputBox(theme)
            {
                Visible = false,
                Margin  = new BorderDouble(10, 0, 5, 0),
            };
            searchPanel.searchInput.ActualTextEditWidget.EnterPressed += (s, e) =>
            {
                this.PerformSearch();
            };
            searchPanel.ResetButton.Click += (s, e) =>
            {
                breadCrumbWidget.Visible = true;
                searchPanel.Visible      = false;

                searchPanel.searchInput.Text = "";

                this.ClearSearch();
            };

            // Store a reference to the input field
            this.searchInput = searchPanel.searchInput;

            navBar.AddChild(searchPanel);

            searchButton         = theme.CreateSearchButton();
            searchButton.Enabled = false;
            searchButton.Name    = "Search Library Button";
            searchButton.Click  += (s, e) =>
            {
                if (searchPanel.Visible)
                {
                    PerformSearch();
                }
                else
                {
                    searchContainer = libraryView.ActiveContainer;

                    breadCrumbWidget.Visible = false;
                    searchPanel.Visible      = true;
                    searchInput.Focus();
                }
            };
            navBar.AddChild(searchButton);

            allControls.AddChild(libraryView);

            buttonPanel = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.Stretch,
                Padding = theme.ToolbarPadding,
            };
            AddLibraryButtonElements();
            allControls.AddChild(buttonPanel);

            allControls.AnchorAll();

            this.AddChild(allControls);

            // Register listeners
            libraryView.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;
            libraryContext.ContainerChanged             += Library_ContainerChanged;
        }
Beispiel #4
0
        public PrintLibraryWidget(PartPreviewContent partPreviewContent, ThemeConfig theme)
        {
            this.theme = theme;
            this.partPreviewContent = partPreviewContent;
            this.Padding            = 0;
            this.AnchorAll();

            var allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

            libraryView = new ListView(ApplicationController.Instance.Library, theme)
            {
                Name = "LibraryView",
                // Drop containers if ShowContainers != 1
                ContainerFilter = (container) => UserSettings.Instance.ShowContainers,
                BackgroundColor = theme.ActiveTabColor,
                Border          = new BorderDouble(top: 1)
            };

            libraryView.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;

            ApplicationController.Instance.Library.ContainerChanged += Library_ContainerChanged;

            navBar = new OverflowBar(theme)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
            };
            allControls.AddChild(navBar);
            theme.ApplyBottomBorder(navBar);

            var toolbar = new OverflowBar(AggContext.StaticData.LoadIcon("fa-sort_16.png", 32, 32, theme.InvertIcons), theme)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                Name    = "Folders Toolbar"
            };

            theme.ApplyBottomBorder(toolbar, shadedBorder: true);

            toolbar.OverflowButton.Name = "Print Library View Options";
            toolbar.Padding             = theme.ToolbarPadding;

            toolbar.ExtendOverflowMenu = (popupMenu) =>
            {
                var siblingList = new List <GuiWidget>();

                popupMenu.CreateBoolMenuItem(
                    "Date Created".Localize(),
                    () => libraryView.ActiveSort == ListView.SortKey.CreatedDate,
                    (v) => libraryView.ActiveSort = ListView.SortKey.CreatedDate,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "Date Modified".Localize(),
                    () => libraryView.ActiveSort == ListView.SortKey.ModifiedDate,
                    (v) => libraryView.ActiveSort = ListView.SortKey.ModifiedDate,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "Name".Localize(),
                    () => libraryView.ActiveSort == ListView.SortKey.Name,
                    (v) => libraryView.ActiveSort = ListView.SortKey.Name,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateHorizontalLine();

                siblingList = new List <GuiWidget>();

                popupMenu.CreateBoolMenuItem(
                    "Ascending".Localize(),
                    () => libraryView.Ascending,
                    (v) => libraryView.Ascending = true,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "Descending".Localize(),
                    () => !libraryView.Ascending,
                    (v) => libraryView.Ascending = false,
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);
            };

            allControls.AddChild(toolbar);

            var showFolders = new ExpandCheckboxButton("Folders".Localize(), theme)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit | VAnchor.Center,
                Margin  = theme.ButtonSpacing,
                Name    = "Show Folders Toggle",
                Checked = UserSettings.Instance.ShowContainers,
            };

            showFolders.SetIconMargin(theme.ButtonSpacing);
            showFolders.CheckedStateChanged += async(s, e) =>
            {
                UserSettings.Instance.set(UserSettingsKey.ShowContainers, showFolders.Checked ? "1" : "0");
                await libraryView.Reload();
            };
            toolbar.AddChild(showFolders);

            var openButton = new TextButton("Open", theme)
            {
                Margin = theme.ButtonSpacing,
            };

            openButton.Click += (s, e) =>
            {
                var extensionsWithoutPeriod = new HashSet <string>(ApplicationSettings.OpenDesignFileParams.Split('|').First().Split(',').Select(t => t.Trim().Trim('.')));

                foreach (var extension in ApplicationController.Instance.Library.ContentProviders.Keys)
                {
                    extensionsWithoutPeriod.Add(extension.ToUpper());
                }

                var extensionsArray = extensionsWithoutPeriod.OrderBy(t => t).ToArray();

                string filter = string.Format(
                    "{0}|{1}",
                    string.Join(",", extensionsArray),
                    string.Join("", extensionsArray.Select(t => $"*.{t.ToLower()};").ToArray()));

                UiThread.RunOnIdle(() =>
                {
                    AggContext.FileDialogs.OpenFileDialog(
                        new OpenFileDialogParams(filter, multiSelect: true),
                        (openParams) =>
                    {
                        ViewControls3D.LoadAndAddPartsToPlate(this, openParams.FileNames, ApplicationController.Instance.DragDropData.SceneContext);
                    });
                });
            };

            toolbar.AddChild(openButton);

            PopupMenuButton viewMenuButton;

            toolbar.AddChild(
                viewMenuButton = new PopupMenuButton(
                    new ImageWidget(AggContext.StaticData.LoadIcon("mi-view-list_10.png", 32, 32, theme.InvertIcons))
            {
                //VAnchor = VAnchor.Center
            },
                    theme)
            {
                AlignToRightEdge = true
            });

            viewMenuButton.DynamicPopupContent = () =>
            {
                var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);

                var listView = this.libraryView;

                var siblingList = new List <GuiWidget>();

                popupMenu.CreateBoolMenuItem(
                    "View List".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.RowListView,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.RowListView;
                    listView.ListContentView = new RowListView(theme);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);
#if DEBUG
                popupMenu.CreateBoolMenuItem(
                    "View XSmall Icons".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.IconListView18,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.IconListView18;
                    listView.ListContentView = new IconListView(theme, 18);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "View Small Icons".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.IconListView70,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.IconListView70;
                    listView.ListContentView = new IconListView(theme, 70);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);
#endif
                popupMenu.CreateBoolMenuItem(
                    "View Icons".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.IconListView,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.IconListView;
                    listView.ListContentView = new IconListView(theme);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                popupMenu.CreateBoolMenuItem(
                    "View Large Icons".Localize(),
                    () => ApplicationController.Instance.ViewState.LibraryViewMode == ListViewModes.IconListView256,
                    (isChecked) =>
                {
                    ApplicationController.Instance.ViewState.LibraryViewMode = ListViewModes.IconListView256;
                    listView.ListContentView = new IconListView(theme, 256);
                    listView.Reload().ConfigureAwait(false);
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);

                return(popupMenu);
            };

            breadCrumbWidget = new FolderBreadCrumbWidget(libraryView, theme);
            navBar.AddChild(breadCrumbWidget);

            var searchPanel = new SearchInputBox(theme)
            {
                Visible = false,
                Margin  = new BorderDouble(10, 0, 5, 0),
            };
            searchPanel.searchInput.ActualTextEditWidget.EnterPressed += (s, e) =>
            {
                this.PerformSearch();
            };
            searchPanel.ResetButton.Click += (s, e) =>
            {
                breadCrumbWidget.Visible = true;
                searchPanel.Visible      = false;

                searchPanel.searchInput.Text = "";

                this.ClearSearch();
            };

            // Store a reference to the input field
            this.searchInput = searchPanel.searchInput;

            navBar.AddChild(searchPanel);

            searchButton         = theme.CreateSearchButton();
            searchButton.Enabled = false;
            searchButton.Name    = "Search Library Button";
            searchButton.Click  += (s, e) =>
            {
                if (searchPanel.Visible)
                {
                    PerformSearch();
                }
                else
                {
                    searchContainer = ApplicationController.Instance.Library.ActiveContainer;

                    breadCrumbWidget.Visible = false;
                    searchPanel.Visible      = true;
                    searchInput.Focus();
                }
            };
            navBar.AddChild(searchButton);

            allControls.AddChild(libraryView);

            buttonPanel = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.Stretch,
                Padding = theme.ToolbarPadding,
            };
            AddLibraryButtonElements();
            allControls.AddChild(buttonPanel);

            allControls.AnchorAll();

            this.AddChild(allControls);
        }