Switch to Heights based on Display Dimensions

This commit is contained in:
2019-06-25 01:59:47 -05:00
parent 20dc095515
commit 60ec28c952
9 changed files with 27 additions and 10 deletions
+9 -2
View File
@@ -1,6 +1,6 @@
using Acr.UserDialogs;
using Xamarin.Forms;
using Xamarin.Essentials;
namespace qController
{
public partial class App : Application
@@ -9,7 +9,9 @@ namespace qController
public static NavigationPage NavigationPage { get; private set; }
public static RootPage rootPage;
public static string QFont;
public static DisplayInfo mainDisplayInfo;
public static double Height;
public static double Width;
public static bool MenuIsPresented
{
get
@@ -29,6 +31,11 @@ namespace qController
/*MainPage = new NavigationPage(new QConnectionPage());
iNav = MainPage.Navigation;*/
mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
Height = mainDisplayInfo.Height / mainDisplayInfo.Density;
Width = mainDisplayInfo.Width / mainDisplayInfo.Density;
System.Console.WriteLine(Height);
System.Console.WriteLine(Width);
switch (Device.RuntimePlatform)
{
case Device.iOS:
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<ContentPage.Content>
<StackLayout x:Name="sLayout">
@@ -73,11 +73,14 @@ namespace qController
{
App.rootPage.MenuPage.ChangeToControl();
NavigationPage.SetHasNavigationBar(this, false);
instanceName.HorizontalTextAlignment = TextAlignment.Center;
instanceName.HorizontalOptions = LayoutOptions.CenterAndExpand;
instanceName.VerticalOptions = LayoutOptions.CenterAndExpand;
topBar.Children.Add(instanceName, 1, 0);
topBar.BackgroundColor = Color.FromHex("71AEFF");
topBar.HeightRequest = Math.Max(App.Height * .09, 65);
BackgroundColor = Color.FromHex("4A4A4A");
menuButton.Text = QIcon.MENU;
@@ -96,6 +99,8 @@ namespace qController
qCell = new QSelectedCueCell();
qCell.HeightRequest = Math.Max(App.Height * .20, 125);
sLayout.Children.Add(qCell);
}
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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.QConnectionPage">
<StackLayout x:Name="sLayout">
@@ -11,7 +11,6 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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>
@@ -30,13 +30,14 @@ namespace qController
AddWorkspace();
}else if(args.Command == "open_link")
{
Device.OpenUri(new Uri("http://www.example.com"));
Device.OpenUri(new Uri("http://www.jwetzell.com"));
}
}
private void InitGUI()
{
NavigationPage.SetHasNavigationBar(this, false);
topBar.HeightRequest = Math.Max(App.Height * .09, 65);
lstView.ItemsSource = QStorage.qInstances;
lstView.ItemTemplate = new DataTemplate(typeof(QInstanceCell));