Begin UI Redesign, switch to icon font

This commit is contained in:
2019-04-12 11:02:11 -05:00
parent c7ff2e6269
commit 54965a961f
32 changed files with 591 additions and 40 deletions
+10 -4
View File
@@ -11,7 +11,9 @@ namespace qController
Label instanceName = new Label();
QSelectedCueCell qCell;
QSelectedCueOptionsCell qSelectedCueOptions;
QCueListView qCueListView;
Grid mainG;
ListView listView;
public ControlPage(string name, string address)
{
InitializeComponent();
@@ -44,8 +46,8 @@ namespace qController
switch (Device.RuntimePlatform)
{
case Device.iOS:
backButton.Margin = new Thickness(20, 45, 20, 10);
instanceName.Margin = new Thickness(20, 45, 20, 10);
backButton.Margin = new Thickness(20, 35, 20, 10);
instanceName.Margin = new Thickness(20, 35, 20, 10);
break;
}
@@ -119,6 +121,10 @@ namespace qController
sLayout.Children.Add(mainG);
qCueListView = new QCueListView();
//sLayout.Children.Add(qCueListView);
}
void sendOSC(object sender, EventArgs e)
@@ -128,7 +134,7 @@ namespace qController
void Back(object sender, EventArgs e)
{
App.iNav.PopModalAsync();
App.NavigationPage.Navigation.PopModalAsync();
}
public void SelectedCueUpdated(object sender, CueEventArgs e){
@@ -153,7 +159,7 @@ namespace qController
{
Device.BeginInvokeOnMainThread(() =>
{
//
qCueListView.UpdateWithWorkspace(e.UpdatedWorkspace);
});
qController.qWorkspace = e.UpdatedWorkspace;
Console.WriteLine("Workspace updated in ControlPage: " + qController.qWorkspace.workspace_id);
+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>
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace qController
{
public partial class HomePage : ContentPage
{
public HomePage()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,12 @@
using System;
namespace qController
{
public class MasterPageItem
{
public string Title { get; set; }
public string Icon { get; set; }
public string Command { get; set; }
}
}
+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.MenuPage">
<ContentPage.Content>
</ContentPage.Content>
</ContentPage>
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace qController
{
public partial class MenuPage : ContentPage
{
public ListView ListView { get { return listView; } }
ListView listView;
public MenuPage()
{
Title = "Menu";
InitializeComponent();
var items = new List<MasterPageItem>();
items.Add(new MasterPageItem
{
Title = "Scan Network",
Icon = "\uE800",
Command = "scan"
});
items.Add(new MasterPageItem
{
Title = "Add Manually",
Icon = "\uE801",
Command = "add"
});
/*items.Add(new MasterPageItem
{
Title = "Open Link",
Icon = "\uF0C9",
Command = "open_link"
});*/
listView = new ListView
{
ItemsSource = items,
ItemTemplate = new DataTemplate(() =>
{
var grid = new Grid { Padding = new Thickness(5, 10) };
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(30) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
string qfont = "";
switch (Device.RuntimePlatform)
{
case Device.iOS:
qfont = "qfont";
break;
case Device.Android:
qfont = "qfont.ttf#qfont";
break;
}
var icon = new Label();
icon.FontFamily = qfont as string;
icon.SetBinding(Label.TextProperty, "Icon");
icon.HorizontalTextAlignment = TextAlignment.Center;
icon.VerticalTextAlignment = TextAlignment.Center;
icon.FontSize = 20;
var label = new Label { VerticalOptions = LayoutOptions.FillAndExpand };
label.SetBinding(Label.TextProperty, "Title");
grid.Children.Add(icon);
grid.Children.Add(label, 1, 0);
return new ViewCell { View = grid };
}),
SeparatorVisibility = SeparatorVisibility.None
};
Content = new StackLayout
{
Children = { listView }
};
}
}
}
+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,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace qController
{
public class MenuEventArgs : EventArgs
{
public string Command
{
get;
set;
}
}
public partial class RootPage : MasterDetailPage
{
MenuPage MenuPage;
public delegate void MenuItemSelectedHandler(object source, MenuEventArgs args);
public event MenuItemSelectedHandler MenuItemSelected;
public RootPage()
{
InitializeComponent();
}
public void Init()
{
MenuPage = (MenuPage)Master;
MenuPage.ListView.ItemSelected += OnItemSelected;
}
void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var item = e.SelectedItem as MasterPageItem;
if (item != null)
{
MenuPage.ListView.SelectedItem = null;
IsPresented = false;
if (MenuItemSelected != null)
MenuItemSelected(this, new MenuEventArgs { Command = item.Command });
}
}
}
}
@@ -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,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace qController.Pages
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class RootPageDetail : ContentPage
{
public RootPageDetail()
{
InitializeComponent();
}
}
}
@@ -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,56 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace qController.Pages
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class RootPageMaster : ContentPage
{
public ListView ListView;
public RootPageMaster()
{
InitializeComponent();
BindingContext = new RootPageMasterViewModel();
ListView = MenuItemsListView;
}
class RootPageMasterViewModel : INotifyPropertyChanged
{
public ObservableCollection<RootPageMenuItem> MenuItems { get; set; }
public RootPageMasterViewModel()
{
MenuItems = new ObservableCollection<RootPageMenuItem>(new[]
{
new RootPageMenuItem { Id = 0, Title = "Page 1" },
new RootPageMenuItem { Id = 1, Title = "Page 2" },
new RootPageMenuItem { Id = 2, Title = "Page 3" },
new RootPageMenuItem { Id = 3, Title = "Page 4" },
new RootPageMenuItem { Id = 4, Title = "Page 5" },
});
}
#region INotifyPropertyChanged Implementation
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
if (PropertyChanged == null)
return;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace qController.Pages
{
public class RootPageMenuItem
{
public RootPageMenuItem()
{
TargetType = typeof(RootPageDetail);
}
public int Id { get; set; }
public string Title { get; set; }
public Type TargetType { get; set; }
}
}
@@ -1,6 +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" xmlns:local="clr-namespace:qController" x:Class="qController.qControllerPage">
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:qController" x:Class="qController.QConnectionPage">
<StackLayout x:Name="sLayout">
<Grid x:Name="topBar" HorizontalOptions="FillAndExpand">
<Grid.RowDefinitions>
@@ -10,10 +10,11 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image x:Name = "scanButton" HorizontalOptions = "Start" Margin="20,10,20,10" Grid.Row="0" Grid.Column="0" />
<Image x:Name = "addButton" HorizontalOptions = "End" Margin="20,10,20,10" Grid.Row="0" Grid.Column="1" />
<Label x:Name = "menuButton" FontFamily = "{StaticResource qfont}" HorizontalOptions = "Start" Margin="20,10,20,10" Grid.Row="0" Grid.Column="0" FontSize="25"/>
</Grid>
<ListView x:Name="lstView" HasUnevenRows = "true" >
</ListView>
</StackLayout>
</ContentPage>
@@ -9,13 +9,29 @@ using System.Collections.Generic;
namespace qController
{
public partial class qControllerPage : ContentPage
public partial class QConnectionPage : ContentPage
{
public qControllerPage()
public QConnectionPage()
{
InitializeComponent();
InitGUI();
App.rootPage.MenuItemSelected += OnMenuItemSelected;
}
private void OnMenuItemSelected(object source, MenuEventArgs args)
{
Console.WriteLine("Menu Item Selected: " + args.Command);
if(args.Command == "scan")
{
Scan();
}
else if(args.Command == "add")
{
AddWorkspace();
}else if(args.Command == "open_link")
{
Device.OpenUri(new Uri("http://www.example.com"));
}
}
private void InitGUI()
@@ -38,31 +54,23 @@ namespace qController
switch (Device.RuntimePlatform)
{
case Device.iOS:
scanButton.Margin = new Thickness(20, 45, 20, 10);
addButton.Margin = new Thickness(20, 45, 20, 10);
menuButton.Margin = new Thickness(20, 35, 20, 10);
break;
}
addButton.Source = ImageSource.FromFile("add");
scanButton.Source = ImageSource.FromFile("scan");
menuButton.Text = "\uF0C9";
lstView.BackgroundColor = Color.FromHex("4A4A4A");
BackgroundColor = Color.FromHex("4A4A4A");
var scanButtonGesture = new TapGestureRecognizer();
scanButtonGesture.Tapped += Scan;
scanButton.GestureRecognizers.Add(scanButtonGesture);
scanButtonGesture.Tapped += showMenu;
menuButton.GestureRecognizers.Add(scanButtonGesture);
var addButtonGesture = new TapGestureRecognizer();
addButtonGesture.Tapped += AddWorkspace;
addButton.GestureRecognizers.Add(addButtonGesture);
}
void AddWorkspace(object sender, EventArgs e){
void AddWorkspace(){
UserDialogs.Instance.Prompt(new PromptConfig
{
@@ -97,12 +105,11 @@ namespace qController
}
async void Scan(object sender, EventArgs e){
async void Scan(){
bool workspacesFound = false;
showToast("Scanning for Workspaces...");
Console.WriteLine("Begin Scanning");
IReadOnlyList<IZeroconfHost> results = await ZeroconfResolver.ResolveAsync("_qlab._udp.local.",TimeSpan.FromSeconds(3));
if(results != null){
foreach (var result in results)
@@ -123,6 +130,11 @@ namespace qController
}
}
void showMenu(object sender, EventArgs e)
{
App.MenuIsPresented = true;
}
void showToast(string message)
{
var toastConfig = new ToastConfig(message);