Begin work on QBrowserPage

This commit is contained in:
Joel Wetzell
2020-06-21 09:02:00 -05:00
parent 7d9f725029
commit 2afec2bc7e
16 changed files with 5504 additions and 46 deletions
+6 -1
View File
@@ -6,5 +6,10 @@
<On Platform="Android" Value="qfont.ttf#qfont" />
<On Platform="iOS" Value="qfont" />
</OnPlatform>
</Application.Resources>
<OnPlatform x:Key="MaterialFontFamily" x:TypeArguments="x:String">
<On Platform="iOS" Value="Material Design Icons" />
<On Platform="Android" Value="materialdesignicons-webfont.ttf#Material Design Icons" />
</OnPlatform>
</Application.Resources>
</Application>
+1 -1
View File
@@ -85,7 +85,7 @@ namespace qController
});
}
public void ChangeToWorkspace(QWorkspace workspace)
public void ChangeToWorkspace(QOldWorkspace workspace)
{
for(int i = 0; i < workspace.data.Count; i++)
{
+17 -3
View File
@@ -16,19 +16,33 @@
</ListView>
<ListView x:Name="serverListView" GroupDisplayBinding="{Binding name}" IsGroupingEnabled="True">
<ListView x:Name="serverListView"
GroupDisplayBinding="{Binding name}"
IsGroupingEnabled="True"
d:IsGroupingEnabled="False"
ItemsSource="{Binding ServersGrouped}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid BackgroundColor="Blue">
<Grid Margin="20,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Text="{Binding name}"
<Label Grid.Column="0" Text="{Binding Name}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"/>
<Label Grid.Column="1" Text="&#xf1184;"
FontFamily="{StaticResource MaterialFontFamily}"
FontSize="Large"
IsVisible="{Binding HasPasscode}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
+11 -25
View File
@@ -1,5 +1,4 @@
using QSharp;
using System.Collections.Generic;
using Xamarin.Forms;
using Serilog;
using System.Collections.ObjectModel;
@@ -8,21 +7,23 @@ using Acr.UserDialogs;
using qController.Dialogs;
using Xamarin.Essentials;
using System;
using qController.ViewModels;
namespace qController.Pages
{
public partial class QBrowserPage : ContentPage
{
public ObservableCollection<ServerGroup> servers = new ObservableCollection<ServerGroup>();
public QBrowserPage()
{
InitializeComponent();
App.rootPage.MenuItemSelected += OnMenuItemSelected;
serverListView.ItemsSource = servers;
QBrowser browser = new QBrowser();
browser.ServerUpdatedWorkspaces += Browser_ServerUpdatedWorkspaces;
serverListView.ItemSelected += ServerListView_ItemSelected;
serverListView.BindingContext = new QBrowserViewModel(new QBrowser());
serverListView.ItemSelected += QWorkspaceSelected;
storageListView.ItemsSource = QStorage.qInstances;
storageListView.ItemTemplate = new DataTemplate(typeof(QInstanceCell));
@@ -36,25 +37,17 @@ namespace qController.Pages
}
async void ServerListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
async void QWorkspaceSelected(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem == null)
return;
QWorkspace selectedWorkspace = e.SelectedItem as QWorkspace;
QWorkspace selectedWorkspace = (e.SelectedItem as QWorkspaceViewModel).workspace;
Log.Debug($"[demo] workspace: {selectedWorkspace.nameWithoutPathExtension} has been selected");
((ListView)sender).SelectedItem = null;
await Navigation.PushAsync(new WorkspacePage(selectedWorkspace));
}
private void Browser_ServerUpdatedWorkspaces(object source, QServerUpdatedArgs args)
{
ServerGroup serverGroup = new ServerGroup(args.server.name);
serverGroup.AddRange(args.server.workspaces);
Device.BeginInvokeOnMainThread(() =>
{
servers.Add(serverGroup);
});
}
void AddWorkspace()
@@ -79,12 +72,5 @@ namespace qController.Pages
}
}
public class ServerGroup : List<QWorkspace>
{
public string name { get; set; }
public ServerGroup(string name)
{
this.name = name;
}
}
}