File and Style Organization

This commit is contained in:
2020-10-18 17:25:46 -05:00
parent b0a6124d43
commit 6921d3d62f
11 changed files with 410 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="qController.App">
<Application.Resources>
<!-- Application resource dictionary -->
<OnPlatform x:Key="qfont" x:TypeArguments="x:String">
<On Platform="Android" Value="qfont.ttf#qfont" />
<On Platform="iOS" Value="qfont" />
</OnPlatform>
<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>
<Style TargetType="Label"
Class="QFont"
ApplyToDerivedTypes="true">
<Setter Property="FontFamily"
Value="{StaticResource qfont}" />
</Style>
<Style TargetType="Label"
Class="PrimaryText"
ApplyToDerivedTypes="true">
<Setter Property="TextColor"
Value="{DynamicResource PrimaryTextColor}" />
</Style>
</Application.Resources>
</Application>
@@ -0,0 +1,74 @@
using Xamarin.Forms;
namespace qController.UI
{
public class QNavBar : Grid
{
public Button menuButton;
public Label instanceName;
public QNavBar()
{
RowSpacing = 0;
ColumnSpacing = 0;
Padding = 0;
Margin = 0;
this.SetDynamicResource(Grid.BackgroundColorProperty, "NavigationBarColor");
RowDefinitions = new RowDefinitionCollection {
new RowDefinition { Height = GridLength.Star }
};
ColumnDefinitions = new ColumnDefinitionCollection
{
new ColumnDefinition {Width = GridLength.Star},
new ColumnDefinition {Width = new GridLength(4,GridUnitType.Star)},
};
menuButton = new Button
{
FontFamily = App.QFont,
HorizontalOptions = LayoutOptions.StartAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Padding = 0,
Margin = new Thickness(10,0,0,0),
Text = QIcon.MENU,
CornerRadius = 0,
//BackgroundColor = Color.Red
};
menuButton.SetDynamicResource(Label.TextColorProperty, "IconTextColor");
instanceName = new Label
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalTextAlignment = TextAlignment.End,
VerticalTextAlignment = TextAlignment.Center,
Margin = new Thickness(0,0,10,0),
Padding = 0,
FontSize = App.HeightUnit * 3,
//BackgroundColor = Color.Blue
};
instanceName.SetDynamicResource(Label.TextColorProperty, "PrimaryTextColor");
menuButton.Clicked += App.ShowMenu;
switch (Device.RuntimePlatform)
{
case Device.iOS:
HeightRequest = App.HeightUnit * 6;
menuButton.FontSize = App.Height * .04;
break;
case Device.Android:
HeightRequest = App.HeightUnit * 6;
menuButton.FontSize = App.Height * .04;
break;
}
this.Children.Add(menuButton, 0, 0);
this.Children.Add(instanceName, 1, 0);
}
}
}
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="qController.ControlPage"
BackgroundColor="#4A4A4A">
<ContentPage.Content>
<AbsoluteLayout x:Name="sLayout">
<Grid x:Name="topBar"
HorizontalOptions="FillAndExpand"
AbsoluteLayout.LayoutBounds="0,0,1,.09"
AbsoluteLayout.LayoutFlags="All"
BackgroundColor="{DynamicResource PageBackgroundColor}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="4*" />
</Grid.ColumnDefinitions>
<Label x:Name="menuButton"
StyleClass="QFont"
HorizontalOptions="Start"
VerticalOptions="End"
Margin="20,10,20,10"
Grid.Row="0" Grid.Column="0"
FontSize="25"
Text="&#xF0C9;"/>
<Label x:Name="instanceName"
HorizontalOptions = "FillAndExpand"
VerticalOptions="End"
HorizontalTextAlignment="End"
Margin="20,10,20,10"
Grid.Row="0" Grid.Column="1"/>
</Grid>
</AbsoluteLayout>
</ContentPage.Content>
</ContentPage>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.HomePage">
<ContentPage.Content>
</ContentPage.Content>
</ContentPage>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="qController.MenuPage">
<StackLayout>
<ListView x:Name="listView"
BackgroundColor="{DynamicResource ListViewBackgroundColor}">
</ListView>
</StackLayout>
</ContentPage>
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
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:qui="clr-namespace:qController.UI"
mc:Ignorable="d"
x:Class="qController.Pages.QBrowserPage"
ios:Page.UseSafeArea="true"
BackgroundColor="{DynamicResource PageBackgroundColor}">
<ContentPage.Content>
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="10"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--Ordering is based on the order last is on top seems pretty backwards to me-->
<!--Old "Instance" listview -->
<ListView x:Name="storageListView"
HasUnevenRows="true"
BackgroundColor="{DynamicResource PageBackgroundColor}"
SeparatorVisibility="None"
Grid.Row="1">
</ListView>
<!--Simple Divider-->
<BoxView HeightRequest="10"
BackgroundColor="DarkGray"
Grid.Row="2"/>
<!--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>
<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}"
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>
</Frame>
<qui:QNavBar x:Name="qNavBar"
Grid.Row="0"/>
</Grid>
</ContentPage.Content>
</ContentPage>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.RootPage" xmlns:pages="clr-namespace:qController">
</MasterDetailPage>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.Pages.RootPageDetail" Title="Detail">
<StackLayout Padding="10">
<Label Text="This is a detail page. To get the 'triple' line icon on each platform add a icon to each platform and update the 'Master' page with an Icon that references it." />
</StackLayout>
</ContentPage>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.Pages.RootPageMaster" Title="Master">
<StackLayout>
<ListView x:Name="MenuItemsListView" SeparatorVisibility="None" HasUnevenRows="true" ItemsSource="{Binding MenuItems}">
<ListView.Header>
<Grid BackgroundColor="#03A9F4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="80" />
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
</Grid.RowDefinitions>
<Label Grid.Column="1" Grid.Row="2" Text="AppName" Style="{DynamicResource SubtitleStyle}" />
</Grid>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="15,10" HorizontalOptions="FillAndExpand">
<Label VerticalOptions="FillAndExpand" VerticalTextAlignment="Center" Text="{Binding Title}" FontSize="24" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
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:qui="clr-namespace:qController.UI"
ios:Page.UseSafeArea="true"
mc:Ignorable="d"
x:Class="qController.WorkspacePage"
BackgroundColor="{DynamicResource PageBackgroundColor}">
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="175"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--Ordering is based on the order last is on top seems pretty backwards to me-->
<ScrollView x:Name="cueListScrollView"
Grid.Row="2">
<Grid x:Name="cueListsGrid"
RowSpacing="0"
ColumnSpacing="0"
BackgroundColor="#808080">
</Grid>
</ScrollView>
<qui:QSelectedCueFrame x:Name="selectedCueFrame"
Grid.Row="1"/>
<qui:QNavBar x:Name="qNavBar"
Grid.Row="0"/>
</Grid>
</ContentPage>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="qController.QConnectionPage">
<StackLayout x:Name="sLayout">
<Grid x:Name="topBar"
HorizontalOptions="FillAndExpand"
BackgroundColor="{DynamicResource NavigationBarColor}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label x:Name = "menuButton"
StyleClass="QFont"
HorizontalOptions = "Start"
VerticalOptions="End"
Margin="20,10,20,10"
Grid.Row="0" Grid.Column="0"
Text="&#xF0C9;"/>
</Grid>
<ListView x:Name="listView"
HasUnevenRows="true"
BackgroundColor="#4A4A4A"
SeparatorVisibility="None">
</ListView>
</StackLayout>
</ContentPage>