Skip to content

Commit

Permalink
updated UI
Browse files Browse the repository at this point in the history
  • Loading branch information
janseris committed Jun 29, 2022
1 parent 2dd531c commit 52b2a18
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
7 changes: 5 additions & 2 deletions MauiApp11/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
Spacing="25"
Padding="30,0"
VerticalOptions="Center" >

<!-- Margin is: Left, Top, ?, ? -->

<Label
Text="Microsoft.Data.SqlClient 4.0.0+ has Encrypt=true by default which requires a valid certificate (can be disabled either by explicit Encrypt=false or TrustServerCertificate=true"
<Label Margin="0, 10, 0, 0"
FontSize="Small"
Text="Note: Microsoft.Data.SqlClient 4.0.0+ has Encrypt=true by default which requires a valid certificate (can be disabled either by explicit Encrypt=false or TrustServerCertificate=true"
HorizontalOptions="Center" >

</Label>
Expand Down
19 changes: 17 additions & 2 deletions MauiApp11/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,19 @@ private void ExecuteDAOWithUIResult(DAOBase dao, string connectionString, StackL
});
}

private void button_Clicked(object sender, EventArgs e)
private async void button_Clicked(object sender, EventArgs e)
{
results.Children.Clear();

//use custom or from combobox if using custom is not checked
var connectionString = useCustomConnectionStringCheckBox.IsChecked ? customConnectionStringTextEdit.Text : SelectedConnectionString;

if(connectionString == null)
{
await DisplayAlert("", "No connection string selected", "OK");
return;
}

//for appended parts to work, the connection string must end with ";"
if (encryptFalseCheckBox.IsChecked)
{
Expand All @@ -149,12 +155,21 @@ private void button_Clicked(object sender, EventArgs e)
Trace.WriteLine($"Executing {dao.Name}...");
ExecuteDAOWithUIResult(dao, connectionString, results);
}

//these texts should be displayed below the button
foreach (var label in results.Children)
{
Trace.WriteLine((label as Label).Text);
}


//Labels are not displayed on Android (bug) so instead, a MessageBox is shown
#if ANDROID
var labelTexts = results.Children
.Where(item => item.GetType() == typeof(Label))
.Select(label => (label as Label).Text);
await DisplayActionSheet("Results", null, "OK", labelTexts.ToArray());
#endif
}
}

0 comments on commit 52b2a18

Please sign in to comment.