Files
qController/qController.Standard/Pages/MenuPage.xaml.cs
T
jwetzell e97f9a7382 * qfont.ttf:
* qfont.ttf:
* QIcon.cs: Add LIST and LEFT_DIR icons

* Info.plist:
* AndroidManifest.xml: Update Version Numbers

* App.xaml.cs:
* QCue.cs:
* MenuPage.xaml.cs:
* QCueList.cs:
* ControlPage.xaml.cs:
* QWorkSpace.cs:
* QCueListCell.cs:
* qConnectionPage.xaml.cs:
* QParser.cs:
* QUpdater.cs:
* QController.cs: Android v1.0.8 / iOS v2.0.8
2019-07-20 20:10:21 -05:00

121 lines
3.8 KiB
C#

using System;
using System.Collections.ObjectModel;
using Xamarin.Forms;
namespace qController
{
public partial class MenuPage : ContentPage
{
public ListView listView;
public ObservableCollection<MenuPageItem> items;
int subLevel = 0;
public MenuPage()
{
Title = "Menu";
InitializeComponent();
items = new ObservableCollection<MenuPageItem>();
ChangeToHome();
listView = new ListView
{
ItemsSource = items,
RowHeight = (int)(App.HeightUnit * 6),
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 });
var icon = new Label();
icon.FontFamily = App.QFont;
icon.SetBinding(Label.TextProperty, "Icon");
icon.HorizontalTextAlignment = TextAlignment.Center;
icon.VerticalTextAlignment = TextAlignment.Center;
icon.FontSize = App.HeightUnit * 3;
var label = new Label { VerticalOptions = LayoutOptions.FillAndExpand };
label.SetBinding(Label.TextProperty, "Title");
if (label.Text == "Disconnect")
{
label.TextColor = Color.DarkRed;
}
switch (Device.RuntimePlatform)
{
case Device.iOS:
label.FontSize = App.HeightUnit * 3;
break;
case Device.Android:
label.FontSize = App.HeightUnit * 2.2;
break;
}
grid.Children.Add(icon);
grid.Children.Add(label, 1, 0);
return new ViewCell {View = grid};
})
};
Content = new StackLayout
{
Children = { listView }
};
}
public void ChangeToControl()
{
items.Clear();
items.Add(new MenuPageItem
{
Title = "Disconnect",
Icon = QIcon.CANCEL,
Command = "disconnect"
});
}
public void ChangeToWorkspace(QWorkspace workspace)
{
for(int i = 0; i < workspace.data.Count; i++)
{
var cueList = workspace.data[i];
items.Add(new MenuPageItem
{
Title = cueList.listName,
Icon = cueList.IconText,
Command = "cueList " + cueList.uniqueID
});
}
}
public void ChangeToHome()
{
items.Clear();
items.Add(new MenuPageItem
{
Title = "Scan Network",
Icon = "\uE800",
Command = "scan"
});
items.Add(new MenuPageItem
{
Title = "Add Manually",
Icon = "\uE801",
Command = "add"
});
items.Add(new MenuPageItem
{
Title = "Send Feedback",
Icon = QIcon.MAIL,
Command = "feedback"
});
items.Add(new MenuPageItem
{
Title = "Support Project",
Icon = QIcon.DOLLAR,
Command = "support"
});
}
}
}