-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppShell.xaml.cs
More file actions
43 lines (41 loc) · 1.74 KB
/
AppShell.xaml.cs
File metadata and controls
43 lines (41 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.ComponentModel;
using CommunityToolkit.Maui.Views;
using MauiApp_AnyThingLM_RAG.ViewModels;
namespace MauiApp_AnyThingLM_RAG
{
public partial class AppShell : Shell
{
private AppShellViewModel _appShellViewModel;
public AppShell(AppShellViewModel appShellViewModel)
{
InitializeComponent();
this._appShellViewModel = appShellViewModel;
this.BindingContext = this._appShellViewModel;
this._appShellViewModel.PropertyChanged += WorkspacesListViewModel_PropertyChanged;
}
private async void WorkspacesListViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if(e.PropertyName == nameof(AppShellViewModel.IsExpanderItemsLoaded) && this._appShellViewModel.IsExpanderItemsLoaded)
{
this.stackLayoutWorkspaces.Clear();
this.labelNotConnectedAnythingllm.IsVisible = false;
if(this._appShellViewModel.ExpanderItems.Count > 0)
{
this.labelNoThereAreWorkspaces.IsVisible = false;
this.stackLayoutWorkspaces.IsVisible = true;
foreach (Expander expander in this._appShellViewModel.ExpanderItems)
{
this.stackLayoutWorkspaces.Add(expander);
}
await Task.Delay(1000);
}
else
{
this.labelNoThereAreWorkspaces.IsVisible = true;
}
this.CreateWorkspaceButton.IsEnabled = true;
this._appShellViewModel.IsExpanderItemsLoaded = false;
}
}
}
}