* AppDelegate.cs:

* packages.config:
* packages.config:
* qController.iOS.csproj:
* qController.Droid.csproj:
* qController.csproj: Update Packages

* App.xaml: Add some static styles

* App.xaml.cs: Trying out Sharpnado Stuff

* QCueGrid.cs: Move QCueGrid Recursive stuff inside class

* QBrowserViewModel.cs: Hook into new ServerFound/Lost Methods

* QCueViewModel.cs: Start work on cue children updating

* QServerViewModel.cs: Hook into WorkspaceAdded/Removed methods

* MenuPage.xaml.cs: Remove Add from side menu

* QBrowserPage.xaml: Further work on front page design

* QBrowserPage.xaml.cs: Add Manually add button to main page

* QWorkspacePage.xaml.cs: Move recursive stuff out of Page code behind
This commit is contained in:
2021-01-08 23:31:55 -06:00
parent 12ec5905f1
commit 9cf241f9c8
16 changed files with 309 additions and 165 deletions
+36
View File
@@ -28,5 +28,41 @@
Value="{DynamicResource PrimaryTextColor}" />
</Style>
<Style TargetType="Button"
Class="PrimaryButton"
ApplyToDerivedTypes="true">
<Setter Property="TextColor"
Value="{DynamicResource PrimaryTextColor}" />
</Style>
<x:Double x:Key="SmallPadding">4</x:Double>
<x:Double x:Key="MediumPadding">8</x:Double>
<x:Double x:Key="StandardPadding">16</x:Double>
<Thickness x:Key="SmallTopThickness" Top="{StaticResource SmallPadding}" />
<Thickness x:Key="MediumTopThickness" Top="{StaticResource MediumPadding}" />
<Thickness x:Key="StandardTopThickness" Top="{StaticResource StandardPadding}" />
<Thickness x:Key="SmallThickness"
Bottom="{StaticResource SmallPadding}"
Left="{StaticResource SmallPadding}"
Right="{StaticResource SmallPadding}"
Top="{StaticResource SmallPadding}" />
<Thickness x:Key="MediumThickness"
Bottom="{StaticResource MediumPadding}"
Left="{StaticResource MediumPadding}"
Right="{StaticResource MediumPadding}"
Top="{StaticResource MediumPadding}" />
<Thickness x:Key="StandardThickness"
Bottom="{StaticResource StandardPadding}"
Left="{StaticResource StandardPadding}"
Right="{StaticResource StandardPadding}"
Top="{StaticResource StandardPadding}" />
</Application.Resources>
</Application>
+1
View File
@@ -36,6 +36,7 @@ namespace qController
public App()
{
InitializeComponent();
Sharpnado.MaterialFrame.Initializer.Initialize(loggerEnable: false, debugLogEnable: false);
AppActions.OnAppAction += AppActions_OnAppAction;
/*MainPage = new NavigationPage(new QConnectionPage());
+27 -2
View File
@@ -1,17 +1,24 @@
using Xamarin.Forms;
using qController.ViewModels;
using QControlKit;
using Serilog;
namespace qController.UI
{
public class QCueGrid : Grid
{
private QCueViewModel qCueViewModel;
public QCueGrid(QCue cue)
{
QCueViewModel qCueViewModel = new QCueViewModel(cue, true);
qCueViewModel = new QCueViewModel(cue, true);
RowSpacing = 0;
RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
RowDefinitions.Add(
new RowDefinition {
Height = new GridLength(40),
BindingContext = qCueViewModel
}
);
ColumnDefinitions = new ColumnDefinitionCollection
{
new ColumnDefinition{Width = GridLength.Star},
@@ -141,6 +148,24 @@ namespace qController.UI
Children.Add(cueTypeLabel, 0, 0);
Children.Add(cueLabel, 1, 0);
if (cue.cues.Count > 0)
{
foreach (var aCue in cue.cues)
{
this.RowDefinitions.Add(
new RowDefinition {
Height = GridLength.Auto,
BindingContext = new QCueViewModel(aCue, false)
}
);
var aCueGrid = new QCueGrid(aCue);
//cueGridDict.Add(aCue.uid, aCueGrid);
aCueGrid.Margin = new Thickness(0, 0, 0, 0);
Children.Add(aCueGrid, 0, aCue.sortIndex + 1);
Grid.SetColumnSpan(aCueGrid, this.ColumnDefinitions.Count);
}
}
}
}
}
@@ -5,6 +5,8 @@ using Xamarin.Forms;
using QControlKit;
using QControlKit.Events;
using System;
using System.Threading.Tasks;
namespace qController.ViewModels
{
@@ -21,6 +23,18 @@ namespace qController.ViewModels
ServersGrouped = new ObservableCollection<QServerViewModel>();
this.browser.ServerFound += OnServerFound;
this.browser.ServerLost += OnServerLost;
Device.StartTimer(TimeSpan.FromSeconds(4), () =>
{
Task.Run(async () =>
{
this.browser.ProbeForQLabInstances();
// do something with time...
});
return true;
});
}
private void OnServerFound(object source, QServerFoundArgs args)
@@ -32,6 +46,30 @@ namespace qController.ViewModels
});
}
private void OnServerLost(object source, QServerLostArgs args)
{
QServerViewModel serverToRemove = null;
foreach(var serverGroup in ServersGrouped)
{
if (serverGroup.host.Equals(args.server.host))
{
serverToRemove = serverGroup;
break;
}
}
if(serverToRemove != null)
{
Device.BeginInvokeOnMainThread(() =>
{
System.Console.WriteLine($"[QBrowserViewModel] removing server: {args.server.description}");
ServersGrouped.Remove(serverToRemove);
});
}
}
void OnPropertyChanged([CallerMemberName] string name = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
@@ -6,12 +6,13 @@ using Xamarin.Forms;
using QControlKit;
using QControlKit.Constants;
using QControlKit.Events;
using System.Collections.Generic;
namespace qController.ViewModels
{
public class QCueViewModel : INotifyPropertyChanged
{
QCue cue;
public QCue cue;
bool isSelected = false;
bool isCollapsed = false;
public event PropertyChangedEventHandler PropertyChanged;
@@ -46,7 +47,11 @@ namespace qController.ViewModels
}
else if (property.Equals(QOSCKey.Children))
{
Log.Debug("children property updated");
//Log.Debug("children property updated");
if (cue.IsGroup)
{
OnPropertyChanged("cues");
}
}
}
}
@@ -136,6 +141,14 @@ namespace qController.ViewModels
}
}
public List<QCue> cues
{
get
{
return cue.cues;
}
}
public bool IsSelected
{
get
@@ -67,25 +67,48 @@ namespace qController.ViewModels
this.Add(new QWorkspaceViewModel(workspace));
});
}
this.server.WorkspaceAdded += Server_WorkspaceAdded;
this.server.WorkspaceRemoved += Server_WorkspaceRemoved;
this.server.ServerUpdated += OnServerUpdated;
}
private void Server_WorkspaceRemoved(object source, QServerWorkspaceChangedArgs args)
{
QWorkspaceViewModel workspaceToRemove = null;
foreach(var workspaceViewModel in this)
{
if(workspaceViewModel.workspace.uniqueID == args.workspace.uniqueID)
{
workspaceToRemove = workspaceViewModel;
break;
}
}
if(workspaceToRemove != null)
{
Device.BeginInvokeOnMainThread(() =>
{
Remove(workspaceToRemove);
});
}
}
private void Server_WorkspaceAdded(object source, QServerWorkspaceChangedArgs args)
{
QWorkspaceViewModel workspaceViewModel = new QWorkspaceViewModel(args.workspace);
Device.BeginInvokeOnMainThread(() =>
{
Add(workspaceViewModel);
});
}
private void OnServerUpdated(object source, QServerUpdatedArgs args)
{
OnPropertyChanged("GroupName");
OnPropertyChanged("version");
foreach (var workspace in this.server.workspaces)
{
QWorkspaceViewModel workspaceViewModel = new QWorkspaceViewModel(workspace);
if (!Contains(workspaceViewModel))
{
Device.BeginInvokeOnMainThread(() =>
{
Add(workspaceViewModel);
});
}
}
}
void OnPropertyChanged([CallerMemberName] string name = "")
@@ -110,12 +110,6 @@ namespace qController
Command = "scan"
});
items.Add(new MenuPageItem
{
Title = "Add Manually",
Icon = "\uE801",
Command = "add"
});
items.Add(new MenuPageItem
{
Title = "Send Feedback",
Icon = QIcon.MAIL,
+97 -81
View File
@@ -4,6 +4,7 @@
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
xmlns:materialFrame="clr-namespace:Sharpnado.MaterialFrame;assembly=Sharpnado.MaterialFrame"
xmlns:qui="clr-namespace:qController.UI"
mc:Ignorable="d"
x:Class="qController.Pages.QBrowserPage"
@@ -37,101 +38,116 @@
<!--Beginning of new style of "server" view-->
<Frame BackgroundColor="{DynamicResource PageBackgroundColor}"
CornerRadius="0"
HasShadow="False"
Margin="0"
Padding="0"
Grid.Row="3">
<!--Need to try and remove the group spacing caused by ios:GroupHeaderStyle-->
<ListView x:Name="serverListView"
ios:ListView.GroupHeaderStyle="Grouped"
GroupDisplayBinding="{Binding name}"
IsGroupingEnabled="True"
d:IsGroupingEnabled="False"
BackgroundColor="Transparent"
SeparatorVisibility="None"
ItemsSource="{Binding ServersGrouped}"
Margin="0">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<Frame BackgroundColor="{DynamicResource ServerCellBackgroundColor}"
Margin="0,0,0,0"
Padding="10,0,10,0"
CornerRadius="0">
<Grid BackgroundColor="Transparent" VerticalOptions="FillAndExpand"
RowSpacing="0"
ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackLayout Spacing="0" BackgroundColor="Transparent">
<Label Margin="0,10,0,10"
Padding="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
HorizontalTextAlignment="Center"
FontSize="Header"
Text="Discovered QLab Instances" />
<!--Need to try and remove the group spacing caused by ios:GroupHeaderStyle-->
<ListView x:Name="serverListView"
ios:ListView.GroupHeaderStyle="Grouped"
GroupDisplayBinding="{Binding name}"
IsGroupingEnabled="True"
d:IsGroupingEnabled="False"
BackgroundColor="Transparent"
SeparatorVisibility="None"
ItemsSource="{Binding ServersGrouped}"
Margin="0">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<Frame BackgroundColor="{DynamicResource ServerCellBackgroundColor}"
Margin="0,0,0,0"
Padding="10,0,10,0"
CornerRadius="0">
<Grid BackgroundColor="Transparent" VerticalOptions="FillAndExpand"
RowSpacing="0"
ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Text="{Binding GroupName}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"
StyleClass="PrimaryText"/>
<Label Grid.Column="1"
Text="{Binding version}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="End"
StyleClass="PrimaryText"/>
</Grid>
</Frame>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Frame BackgroundColor="{DynamicResource WorkspaceCellBackgroundColor}"
BorderColor="Black"
Margin="5,0,5,0"
Padding="10,0,10,0"
CornerRadius="0"
HasShadow="False">
<Grid Margin="0"
BackgroundColor="Transparent"
RowSpacing="0"
ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Name}"
<Label Grid.Column="0"
Text="{Binding GroupName}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"
StyleClass="PrimaryText"/>
<Label Grid.Column="1" Text="&#xf1184;"
FontFamily="{StaticResource MaterialFontFamily}"
FontSize="Large"
IsVisible="{Binding HasPasscode}"
<Label Grid.Column="1"
Text="{Binding version}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="End"
StyleClass="PrimaryText"/>
</Grid>
</Frame>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Frame>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Frame BackgroundColor="{DynamicResource WorkspaceCellBackgroundColor}"
BorderColor="Black"
Margin="5,0,5,0"
Padding="10,0,10,0"
CornerRadius="0"
HasShadow="False">
<Grid Margin="0"
BackgroundColor="Transparent"
RowSpacing="0"
ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Name}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"
StyleClass="PrimaryText"/>
<Label Grid.Column="1" Text="&#xf1184;"
FontFamily="{StaticResource MaterialFontFamily}"
FontSize="Large"
IsVisible="{Binding HasPasscode}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="End"
StyleClass="PrimaryText"/>
</Grid>
</Frame>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Button Text="Manually Add..."
VerticalOptions="Center"
HorizontalOptions="FillAndExpand"
Clicked="AddInstance"
BackgroundColor="White"
StyleClass="PrimaryButton"/>
</StackLayout>
</Frame>
<qui:QNavBar x:Name="qNavBar"
@@ -84,11 +84,7 @@ namespace qController.Pages
private void OnMenuItemSelected(object source, MenuEventArgs args)
{
if (args.Command == "add")
{
AddWorkspace();
}
else if (args.Command == "feedback")
if (args.Command == "feedback")
{
Launcher.OpenAsync(new Uri("mailto:feedback@jwetzell.com?subject=qController%20feedback"));
}
@@ -97,6 +93,11 @@ namespace qController.Pages
UserDialogs.Instance.Confirm(new DonatePrompt());
}
}
private void AddInstance(object sender, EventArgs args)
{
AddWorkspace();
}
}
@@ -95,6 +95,7 @@ namespace qController
if (cueGridDict.ContainsKey(args.cueID))
{
var cueGrid = cueGridDict[args.cueID]; //element to scroll to
//TODO: FIX THIS
cueListScrollView.ScrollToAsync(cueGrid, ScrollToPosition.Center, true);
}
}
@@ -112,7 +113,7 @@ namespace qController
{
if(aCue.cues.Count > 0)
{
QCueGrid cueGrid = cueToGrid(aCue);
QCueGrid cueGrid = new QCueGrid(aCue);
cueGridDict.Add(aCue.uid, cueGrid);
@@ -141,25 +142,6 @@ namespace qController
}
QCueGrid cueToGrid(QCue cue)
{
QCueGrid cueGrid = new QCueGrid(cue);
if (cue.cues.Count > 0)
{
foreach (var aCue in cue.cues)
{
cueGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
var aCueGrid = cueToGrid(aCue);
cueGridDict.Add(aCue.uid, aCueGrid);
aCueGrid.Margin = new Thickness(0, 0, 0, 0);
cueGrid.Children.Add(aCueGrid, 0, aCue.sortIndex + 1);
Grid.SetColumnSpan(aCueGrid,cueGrid.ColumnDefinitions.Count);
}
}
return cueGrid;
}
void Back()
{
+5 -4
View File
@@ -57,14 +57,15 @@
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Acr.UserDialogs" Version="7.1.0.468" />
<PackageReference Include="Acr.UserDialogs" Version="7.1.0.470" />
<PackageReference Include="Zeroconf" Version="3.4.2" />
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.1874" />
<PackageReference Include="Acr.Settings" Version="9.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.0-pre4" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.0" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="QControlKit" Version="0.0.10" />
<PackageReference Include="QControlKit" Version="0.0.11" />
<PackageReference Include="Sharpnado.MaterialFrame" Version="1.1.3" />
</ItemGroup>
<ItemGroup>
<None Remove="App.xaml" />