From b9668ef25a88119494e99d4d1c84799fb935487a Mon Sep 17 00:00:00 2001 From: DmitryZhutkov Date: Sat, 11 Apr 2026 14:25:13 +0500 Subject: [PATCH 1/3] Adding HotReload support --- build/Package.props | 8 ++- .../PleasantUI.Example.Desktop.csproj | 12 ++++ .../Factories/ControlPageCardsFactory.cs | 68 +++++++++---------- .../Models/ControlPageCard.cs | 6 +- .../PleasantUI.Example.csproj | 3 + 5 files changed, 59 insertions(+), 38 deletions(-) diff --git a/build/Package.props b/build/Package.props index dd69d21e..c60946e5 100644 --- a/build/Package.props +++ b/build/Package.props @@ -23,7 +23,13 @@ true 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..840e5458 100644 --- a/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj +++ b/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj @@ -16,13 +16,25 @@ embedded true + $(DefineConstants);ENABLE_XAML_HOT_RELOAD + + + $(MSBuildProjectDirectory)\..\..\src\PleasantUI + + + + + + + + diff --git a/samples/PleasantUI.Example/Factories/ControlPageCardsFactory.cs b/samples/PleasantUI.Example/Factories/ControlPageCardsFactory.cs index 88ea2db4..8babe097 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,28 +35,28 @@ 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/StepDialog", MaterialIcons.OrderNumericAscending, "Card/StepDialog", new StepDialogPage(), _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/StepDialog", MaterialIcons.OrderNumericAscending, "Card/StepDialog", () => new StepDialogPage(), _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), ]; } @@ -64,8 +64,8 @@ public AvaloniaList CreateToolkitControlPageCards() { return [ - new("CardTitle/MessageBox", MaterialIcons.MessageOutline, "Card/MessageBox", new MessageBoxPage(), _eventAggregator), - new("CardTitle/Docking", MaterialIcons.ViewDashboardOutline, "Card/Docking", new DockingPage(), _eventAggregator), + new("CardTitle/MessageBox", MaterialIcons.MessageOutline, "Card/MessageBox", () => new MessageBoxPage(), _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 @@ + + + From b0322323203f65d621cd4e92310b40c1e44ad731 Mon Sep 17 00:00:00 2001 From: Dmitry Zhutkov Date: Sat, 11 Apr 2026 14:40:06 +0500 Subject: [PATCH 2/3] Update PleasantUI.Example.Desktop.csproj --- .../PleasantUI.Example.Desktop.csproj | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj b/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj index 840e5458..4de84deb 100644 --- a/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj +++ b/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj @@ -13,20 +13,6 @@ true - - embedded - true - $(DefineConstants);ENABLE_XAML_HOT_RELOAD - - - - $(MSBuildProjectDirectory)\..\..\src\PleasantUI - - - - - - From f17f2e2090d609373614199805c004350c9e1ec0 Mon Sep 17 00:00:00 2001 From: Dmitry Zhutkov Date: Sat, 11 Apr 2026 14:40:57 +0500 Subject: [PATCH 3/3] Update PleasantUI.Example.Desktop.csproj --- .../PleasantUI.Example.Desktop.csproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj b/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj index 4de84deb..8db2d6c6 100644 --- a/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj +++ b/samples/PleasantUI.Example.Desktop/PleasantUI.Example.Desktop.csproj @@ -12,6 +12,11 @@ PleasantUIIcon.ico true + + + embedded + true +