Files
qController/qController.Standard/Classes/Cell/QInstanceCell.cs
T
jwetzell 8fd0611a12 * qfont.ttf:
* qfont.ttf: Icons

* App.xaml.cs: Set Font String System Wide

* RootPage.xaml.cs:
* QGrid.cs:
* QCueListView.cs:
* qConnectionPage.xaml.cs:
* IPHelper.cs:

* QInstanceCell.cs: Switch to using Icon Font

* QSelectedCueCell.cs: Switch to Type Icon instead of just name

* QClient.cs: Create and dispose of sender for every sent message

* QCue.cs: Add Icon Code method

* ControlPage.xaml: Add hamburger menu

* ControlPage.xaml.cs: Menu for Workspace listing/ cue selection

* MenuPage.xaml.cs: Function to change menu items back for home page
2019-04-18 09:09:19 -05:00

116 lines
3.9 KiB
C#

using System;
using Xamarin.Forms;
namespace qController
{
public class QInstanceCell : ViewCell
{
public QInstanceCell()
{
Label nameLabel = new Label();
Label addressLabel = new Label();
Label connectLabel = new Label();
Label deleteLabel = new Label();
var connectTapGesture = new TapGestureRecognizer();
var deleteTapGesture = new TapGestureRecognizer();
connectTapGesture.Tapped += Connect;
connectLabel.GestureRecognizers.Add(connectTapGesture);
deleteTapGesture.Tapped += Delete;
deleteLabel.GestureRecognizers.Add(deleteTapGesture);
InitItems();
//SET BINDINGS
nameLabel.SetBinding(Label.TextProperty, new Binding("name"));
addressLabel.SetBinding(Label.TextProperty,new Binding("address"));
Grid mainG = new Grid
{
//Padding = new Thickness(10),
RowDefinitions = {
new RowDefinition{Height = GridLength.Auto},
new RowDefinition{Height = GridLength.Auto}
},
ColumnDefinitions = {
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(4,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
}
};
mainG.Children.Add(nameLabel, 1, 0);
mainG.Children.Add(addressLabel,1,1);
mainG.Children.Add(connectLabel,2,0);
Grid.SetRowSpan(connectLabel,2);
mainG.Children.Add(deleteLabel, 0, 0);
Grid.SetRowSpan(deleteLabel,2);
Frame f = new Frame
{
Content = mainG,
OutlineColor = Color.Black,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Padding = 30,
Margin = new Thickness(10,10,10,10),
CornerRadius=20
};
f.BackgroundColor = Color.FromHex("D8D8D8");
View = f;
void InitItems()
{
nameLabel.HorizontalTextAlignment = TextAlignment.Center;
nameLabel.VerticalTextAlignment = TextAlignment.End;
nameLabel.FontAttributes = FontAttributes.Bold;
nameLabel.FontSize = 20;
addressLabel.HorizontalTextAlignment = TextAlignment.Center;
addressLabel.VerticalTextAlignment = TextAlignment.Start;
connectLabel.HorizontalOptions = LayoutOptions.CenterAndExpand;
connectLabel.VerticalOptions = LayoutOptions.CenterAndExpand;
connectLabel.Text = "\uF1EB";
connectLabel.FontSize = 40;
connectLabel.TextColor = Color.LimeGreen;
deleteLabel.HorizontalOptions = LayoutOptions.CenterAndExpand;
deleteLabel.VerticalOptions = LayoutOptions.CenterAndExpand;
deleteLabel.Text = "\uE802";
deleteLabel.FontSize = 40;
deleteLabel.TextColor = Color.Red;
connectLabel.FontFamily = App.QFont;
deleteLabel.FontFamily = App.QFont;
}
void Delete(object sender, EventArgs e)
{
Console.WriteLine("Delete " + nameLabel.Text + "," + addressLabel.Text + " Pressed");
QStorage.RemoveInstance(nameLabel.Text,addressLabel.Text);
}
void Connect(object sender, EventArgs e)
{
App.NavigationPage.Navigation.PushAsync(new ControlPage(nameLabel.Text,addressLabel.Text));
Console.WriteLine("Connect To " + nameLabel.Text + " Pressed");
}
}
}
}