Internal changes to policy list viewer (extensibility), fix duplicating change handler for room list page (performance), use /state in room list page before sync
2 files changed, 26 insertions, 10 deletions
diff --git a/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml b/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml
index c773b8d..bc6b75d 100644
--- a/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml
+++ b/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml
@@ -4,9 +4,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="MatrixRoomUtils.Desktop.Components.NavigationStack">
- <DockPanel x:Name="dock">
- <StackPanel x:Name="navPanel"></StackPanel>
- <UserControl x:Name="content"></UserControl>
- </DockPanel>
-
-</UserControl>
+ <StackPanel x:Name="dock">
+ <Label>NagivationStack</Label>
+ <StackPanel x:Name="navPanel" Orientation="Horizontal"></StackPanel>
+ <ContentControl x:Name="content"></ContentControl>
+ </StackPanel>
+</UserControl>
\ No newline at end of file
diff --git a/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs b/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs
index d6343e2..92c617b 100644
--- a/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs
+++ b/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs
@@ -1,4 +1,5 @@
using Avalonia.Controls;
+using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
namespace MatrixRoomUtils.Desktop.Components;
@@ -8,12 +9,24 @@ public partial class NavigationStack : UserControl {
InitializeComponent();
}
- private void InitializeComponent() {
- AvaloniaXamlLoader.Load(this);
+ // private void InitializeComponent() {
+ // AvaloniaXamlLoader.Load(this);
+ // buildView();
+ // }
+
+ protected override void OnLoaded(RoutedEventArgs e) {
+ base.OnLoaded(e);
buildView();
}
-
+
private void buildView() {
+ if (navPanel is null) {
+ Console.WriteLine("NavigationStack buildView called while navpanel is null!");
+ // await Task.Delay(100);
+ // if (navPanel is null)
+ // await buildView();
+ // else Console.WriteLine("navpanel is not null!");
+ }
navPanel.Children.Clear();
foreach (var item in _stack) {
Button btn = new() {
@@ -25,7 +38,7 @@ public partial class NavigationStack : UserControl {
};
navPanel.Children.Add(btn);
}
- content = Current?.View ?? new UserControl();
+ content.Content = Current?.View ?? new UserControl();
}
@@ -44,13 +57,16 @@ public partial class NavigationStack : UserControl {
Name = name,
View = view
});
+ buildView();
}
public void Pop() {
_stack.RemoveAt(_stack.Count - 1);
+ buildView();
}
public void PopTo(int index) {
_stack.RemoveRange(index, _stack.Count - index);
+ buildView();
}
}
|