diff --git a/build/Package.props b/build/Package.props index e271d107..8b02683c 100644 --- a/build/Package.props +++ b/build/Package.props @@ -26,7 +26,13 @@ https://github.com/Onebeld/PleasantUI - + + + + + + + diff --git a/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj b/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj index eaa15cbe..8db2d6c6 100644 --- a/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj +++ b/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj @@ -12,7 +12,7 @@ PleasantUIIcon.ico true - + embedded true @@ -23,6 +23,9 @@ + + + diff --git a/samples/PleasantUI.Example/Factories/ControlPageCardsFactory.cs b/samples/PleasantUI.Example/Factories/ControlPageCardsFactory.cs index 27813d5a..4a01c051 100644 --- a/samples/PleasantUI.Example/Factories/ControlPageCardsFactory.cs +++ b/samples/PleasantUI.Example/Factories/ControlPageCardsFactory.cs @@ -18,16 +18,16 @@ public AvaloniaList CreateBasicControlPageCards() { return [ - new("CardTitle/Button", MaterialIcons.ButtonCursor, "Card/Button", new ButtonPage(), _eventAggregator), - new("CardTitle/Checkbox", MaterialIcons.CheckboxMarkedOutline,"Card/Checkbox", new CheckBoxPage(), _eventAggregator), - new("CardTitle/Progress", MaterialIcons.ProgressHelper, "Card/Progress", new ProgressPage(), _eventAggregator), - new("CardTitle/Calendar", MaterialIcons.CalendarOutline, "Card/Calendar", new CalendarPage(), _eventAggregator), - new("CardTitle/Carousel", MaterialIcons.ViewCarouselOutline, "Card/Carousel", new CarouselPage(), _eventAggregator), - new("CardTitle/ComboBox", MaterialIcons.ExpandAllOutline, "Card/ComboBox", new ComboBoxPage(), _eventAggregator), - new("CardTitle/TextBox", MaterialIcons.FormTextbox, "Card/TextBox", new TextBoxPage(), _eventAggregator), - new("CardTitle/DataGrid", MaterialIcons.Grid, "Card/DataGrid", new DataGridPage(), _eventAggregator), - new("CardTitle/PinCode", MaterialIcons.KeyboardOutline, "Card/PinCode", new PinCodePage(), _eventAggregator), - new("CardTitle/SelectionList", MaterialIcons.ViewListOutline, "Card/SelectionList", new SelectionListPage(), _eventAggregator), + new("CardTitle/Button", MaterialIcons.ButtonCursor, "Card/Button", () => new ButtonPage(), _eventAggregator), + new("CardTitle/Checkbox", MaterialIcons.CheckboxMarkedOutline,"Card/Checkbox", () => new CheckBoxPage(), _eventAggregator), + new("CardTitle/Progress", MaterialIcons.ProgressHelper, "Card/Progress", () => new ProgressPage(), _eventAggregator), + new("CardTitle/Calendar", MaterialIcons.CalendarOutline, "Card/Calendar", () => new CalendarPage(), _eventAggregator), + new("CardTitle/Carousel", MaterialIcons.ViewCarouselOutline, "Card/Carousel", () => new CarouselPage(), _eventAggregator), + new("CardTitle/ComboBox", MaterialIcons.ExpandAllOutline, "Card/ComboBox", () => new ComboBoxPage(), _eventAggregator), + new("CardTitle/TextBox", MaterialIcons.FormTextbox, "Card/TextBox", () => new TextBoxPage(), _eventAggregator), + new("CardTitle/DataGrid", MaterialIcons.Grid, "Card/DataGrid", () => new DataGridPage(), _eventAggregator), + new("CardTitle/PinCode", MaterialIcons.KeyboardOutline, "Card/PinCode", () => new PinCodePage(), _eventAggregator), + new("CardTitle/SelectionList", MaterialIcons.ViewListOutline, "Card/SelectionList", () => new SelectionListPage(), _eventAggregator), ]; } @@ -35,27 +35,27 @@ public AvaloniaList CreatePleasantControlPageCards() { return [ - new("CardTitle/PleasantSnackbar", MaterialIcons.InformationOutline, "Card/PleasantSnackbar", new PleasantSnackbarPage(), _eventAggregator), - new("CardTitle/InformationBlock", MaterialIcons.InformationBoxOutline, "Card/InformationBlock", new InformationBlockPage(), _eventAggregator), - new("CardTitle/OptionsDisplayItem", MaterialIcons.ViewListOutline, "Card/OptionsDisplayItem", new OptionsDisplayItemPage(), _eventAggregator), - new("CardTitle/PleasantTabView", MaterialIcons.Tab, "Card/PleasantTabView", new PleasantTabViewPage(), _eventAggregator), - new("CardTitle/PleasantMenu", MaterialIcons.MenuOpen, "Card/PleasantMenu", new PleasantMenuPage(), _eventAggregator), - new("CardTitle/Timeline", MaterialIcons.TimelineOutline, "Card/Timeline", new TimelinePage(), _eventAggregator), - new("CardTitle/InstallWizard", MaterialIcons.WizardHat, "Card/InstallWizard", new InstallWizardPage(), _eventAggregator), - new("CardTitle/PleasantDrawer", MaterialIcons.DrawingBox, "Card/PleasantDrawer", new PleasantDrawerPage(), _eventAggregator), - new("CardTitle/PopConfirm", MaterialIcons.CheckboxMarkedCircle, "Card/PopConfirm", new PopConfirmPage(), _eventAggregator), - new("CardTitle/PathPicker", MaterialIcons.FolderOpenOutline, "Card/PathPicker", new PathPickerPage(), _eventAggregator), - new("CardTitle/PleasantMiniWindow", MaterialIcons.WindowMinimize, "Card/PleasantMiniWindow", new PleasantMiniWindowPage(), _eventAggregator), - new("CardTitle/BreadcrumbBar", MaterialIcons.PageNextOutline, "Card/BreadcrumbBar", new BreadcrumbBarPage(), _eventAggregator), - new("CardTitle/CommandBar", MaterialIcons.ViewGridOutline, "Card/CommandBar", new CommandBarPage(), _eventAggregator), - new("CardTitle/DashboardCard", MaterialIcons.ViewDashboardOutline, "Card/DashboardCard", new DashboardCardPage(), _eventAggregator), - new("CardTitle/LogViewerPanel", MaterialIcons.TextBoxOutline, "Card/LogViewerPanel", new LogViewerPanelPage(), _eventAggregator), - new("CardTitle/TerminalPanel", MaterialIcons.ConsoleLine, "Card/TerminalPanel", new TerminalPanelPage(), _eventAggregator), - new("CardTitle/TreeViewPanel", MaterialIcons.FileTreeOutline, "Card/TreeViewPanel", new TreeViewPanelPage(), _eventAggregator), - new("CardTitle/ItemListPanel", MaterialIcons.FormatListBulletedType, "Card/ItemListPanel", new ItemListPanelPage(), _eventAggregator), - new("CardTitle/PropertyGrid", MaterialIcons.TableColumnPlusAfter, "Card/PropertyGrid", new PropertyGridPage(), _eventAggregator), - new("CardTitle/DownloadPanel", MaterialIcons.DownloadOutline, "Card/DownloadPanel", new DownloadPanelPage(), _eventAggregator), - new("CardTitle/CrashReportDialog", MaterialIcons.BugOutline, "Card/CrashReportDialog", new CrashReportDialogPage(), _eventAggregator), + new("CardTitle/PleasantSnackbar", MaterialIcons.InformationOutline, "Card/PleasantSnackbar", () => new PleasantSnackbarPage(), _eventAggregator), + new("CardTitle/InformationBlock", MaterialIcons.InformationBoxOutline, "Card/InformationBlock", () => new InformationBlockPage(), _eventAggregator), + new("CardTitle/OptionsDisplayItem", MaterialIcons.ViewListOutline, "Card/OptionsDisplayItem", () => new OptionsDisplayItemPage(), _eventAggregator), + new("CardTitle/PleasantTabView", MaterialIcons.Tab, "Card/PleasantTabView", () => new PleasantTabViewPage(), _eventAggregator), + new("CardTitle/PleasantMenu", MaterialIcons.MenuOpen, "Card/PleasantMenu", () => new PleasantMenuPage(), _eventAggregator), + new("CardTitle/Timeline", MaterialIcons.TimelineOutline, "Card/Timeline", () => new TimelinePage(), _eventAggregator), + new("CardTitle/InstallWizard", MaterialIcons.WizardHat, "Card/InstallWizard", () => new InstallWizardPage(), _eventAggregator), + new("CardTitle/PleasantDrawer", MaterialIcons.DrawingBox, "Card/PleasantDrawer", () => new PleasantDrawerPage(), _eventAggregator), + new("CardTitle/PopConfirm", MaterialIcons.CheckboxMarkedCircle, "Card/PopConfirm", () => new PopConfirmPage(), _eventAggregator), + new("CardTitle/PathPicker", MaterialIcons.FolderOpenOutline, "Card/PathPicker", () => new PathPickerPage(), _eventAggregator), + new("CardTitle/PleasantMiniWindow", MaterialIcons.WindowMinimize, "Card/PleasantMiniWindow", () => new PleasantMiniWindowPage(), _eventAggregator), + new("CardTitle/BreadcrumbBar", MaterialIcons.PageNextOutline, "Card/BreadcrumbBar", () => new BreadcrumbBarPage(), _eventAggregator), + new("CardTitle/CommandBar", MaterialIcons.ViewGridOutline, "Card/CommandBar", () => new CommandBarPage(), _eventAggregator), + new("CardTitle/DashboardCard", MaterialIcons.ViewDashboardOutline, "Card/DashboardCard", () => new DashboardCardPage(), _eventAggregator), + new("CardTitle/LogViewerPanel", MaterialIcons.TextBoxOutline, "Card/LogViewerPanel", () => new LogViewerPanelPage(), _eventAggregator), + new("CardTitle/TerminalPanel", MaterialIcons.ConsoleLine, "Card/TerminalPanel", () => new TerminalPanelPage(), _eventAggregator), + new("CardTitle/TreeViewPanel", MaterialIcons.FileTreeOutline, "Card/TreeViewPanel", () => new TreeViewPanelPage(), _eventAggregator), + new("CardTitle/ItemListPanel", MaterialIcons.FormatListBulletedType, "Card/ItemListPanel", () => new ItemListPanelPage(), _eventAggregator), + new("CardTitle/PropertyGrid", MaterialIcons.TableColumnPlusAfter, "Card/PropertyGrid", () => new PropertyGridPage(), _eventAggregator), + new("CardTitle/DownloadPanel", MaterialIcons.DownloadOutline, "Card/DownloadPanel", () => new DownloadPanelPage(), _eventAggregator), + new("CardTitle/CrashReportDialog", MaterialIcons.BugOutline, "Card/CrashReportDialog", () => new CrashReportDialogPage(), _eventAggregator), ]; } @@ -63,10 +63,10 @@ public AvaloniaList CreateToolkitControlPageCards() { return [ - new("CardTitle/MessageBox", MaterialIcons.MessageOutline, "Card/MessageBox", new MessageBoxPage(), _eventAggregator), - new("CardTitle/NoticeDialog", MaterialIcons.InformationOutline, "Card/NoticeDialog", new NoticeDialogPage(), _eventAggregator), - new("CardTitle/StepDialog", MaterialIcons.OrderNumericAscending, "Card/StepDialog", new StepDialogPage(), _eventAggregator), - new("CardTitle/Docking", MaterialIcons.ViewDashboardOutline, "Card/Docking", new DockingPage(), _eventAggregator), + new("CardTitle/MessageBox", MaterialIcons.MessageOutline, "Card/MessageBox", () => new MessageBoxPage(), _eventAggregator), + new("CardTitle/NoticeDialog", MaterialIcons.InformationOutline, "Card/NoticeDialog", () => new NoticeDialogPage(), _eventAggregator), + new("CardTitle/StepDialog", MaterialIcons.OrderNumericAscending, "Card/StepDialog", () => new StepDialogPage(), _eventAggregator), + new("CardTitle/Docking", MaterialIcons.ViewDashboardOutline, "Card/Docking", () => new DockingPage(), _eventAggregator), ]; } } \ No newline at end of file diff --git a/samples/PleasantUI.Example/Models/ControlPageCard.cs b/samples/PleasantUI.Example/Models/ControlPageCard.cs index 11f01e3f..b0ecec72 100644 --- a/samples/PleasantUI.Example/Models/ControlPageCard.cs +++ b/samples/PleasantUI.Example/Models/ControlPageCard.cs @@ -19,7 +19,7 @@ public class ControlPageCard : INotifyPropertyChanged public string TitleKey { get; } public string DescriptionKey { get; } public Geometry Icon { get; set; } - public IPage Page { get; set; } + public Func Page { get; set; } public string Title { @@ -43,7 +43,7 @@ private set } } - public ControlPageCard(string titleKey, Geometry icon, string descriptionKey, IPage page, IEventAggregator eventAggregator) + public ControlPageCard(string titleKey, Geometry icon, string descriptionKey, Func page, IEventAggregator eventAggregator) { _eventAggregator = eventAggregator; TitleKey = titleKey; @@ -79,5 +79,5 @@ private static string Resolve(string key) => Localizer.Instance.TryGetString(key, out string value) ? value : key; public void OpenPage() => - _eventAggregator.PublishAsync(new ChangePageMessage(Page)); + _eventAggregator.PublishAsync(new ChangePageMessage(Page.Invoke())); } diff --git a/samples/PleasantUI.Example/PleasantUI.Example.csproj b/samples/PleasantUI.Example/PleasantUI.Example.csproj index e86aa45d..7a538881 100644 --- a/samples/PleasantUI.Example/PleasantUI.Example.csproj +++ b/samples/PleasantUI.Example/PleasantUI.Example.csproj @@ -23,6 +23,9 @@ + + +