-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Include Data to navigation for addressbar
- Loading branch information
1 parent
b16e160
commit e175333
Showing
9 changed files
with
155 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
testing/TestHarness/TestHarness/Ext/Navigation/AddressBar/AddressBarSecondModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace TestHarness.Ext.Navigation.AddressBar; | ||
|
||
public class AddressBarSecondModel | ||
{ | ||
public AddressBarUser User { get; set; } | ||
|
||
public AddressBarSecondModel(AddressBarUser user) | ||
{ | ||
User = user; | ||
} | ||
} | ||
|
||
public class AddressBarUser(Guid id, string name) | ||
{ | ||
public Guid UserId { get; set; } = id; | ||
public string UserName { get; set; } = name; | ||
} |
37 changes: 37 additions & 0 deletions
37
testing/TestHarness/TestHarness/Ext/Navigation/AddressBar/AddressBarSecondPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Page x:Class="TestHarness.Ext.Navigation.AddressBar.AddressBarSecondPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:TestHarness.Ext.Navigation.RoutesNavigation" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:uen="using:Uno.Extensions.Navigation.UI" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400"> | ||
|
||
<Grid> | ||
<StackPanel Grid.Row="1" | ||
HorizontalAlignment="Center" | ||
Spacing="16"> | ||
<TextBlock Text="AddressBar SecondPage" /> | ||
|
||
<TextBlock HorizontalAlignment="Center" | ||
Style="{StaticResource TitleLarge}"> | ||
<Run Text="User Id: " /><Run Text="{Binding User.UserId}" /> | ||
</TextBlock> | ||
|
||
<TextBlock HorizontalAlignment="Center" | ||
Style="{StaticResource TitleLarge}"> | ||
<Run Text="User name: " /><Run Text="{Binding User.UserName}" /> | ||
</TextBlock> | ||
|
||
<TextBlock x:Name="TxtUrl" | ||
AutomationProperties.AutomationId="TxtUrlFromBrowser" /> | ||
|
||
<Button AutomationProperties.AutomationId="GetUrlFromBrowser" | ||
Click="GetUrlFromBrowser" | ||
Content="Get URL" /> | ||
</StackPanel> | ||
|
||
</Grid> | ||
</Page> |
27 changes: 27 additions & 0 deletions
27
testing/TestHarness/TestHarness/Ext/Navigation/AddressBar/AddressBarSecondPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace TestHarness.Ext.Navigation.AddressBar; | ||
|
||
public sealed partial class AddressBarSecondPage : Page | ||
{ | ||
public AddressBarSecondPage() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
public async void GetUrlFromBrowser(object sender, RoutedEventArgs e) | ||
{ | ||
#if __WASM__ | ||
var url = ImportsJS.GetUrl(); | ||
|
||
TxtUrl.Text = url; | ||
#else | ||
TxtUrl.Text = "Not supported"; | ||
#endif | ||
} | ||
} | ||
#if __WASM__ | ||
internal static partial class ImportsJS | ||
{ | ||
[System.Runtime.InteropServices.JavaScript.JSImport("globalThis.Uno.Extensions.Hosting.getLocation")] | ||
public static partial string GetUrl(); | ||
} | ||
#endif |
26 changes: 26 additions & 0 deletions
26
testing/TestHarness/TestHarness/Ext/Navigation/AddressBar/AddressBarUserService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace TestHarness.Ext.Navigation.AddressBar; | ||
|
||
public class AddressBarUserService | ||
{ | ||
private readonly List<AddressBarUser> _users; | ||
|
||
public AddressBarUserService() | ||
{ | ||
_users = | ||
[ | ||
new(ConvertFromString("8a5c5b2e-ff96-474b-9e4d-65bde598f6bc"), "João Rodrigues"), | ||
new(ConvertFromString("2b64071a-2c8a-45e4-9f48-3eb7d7aace41"), "Ross Polard") | ||
]; | ||
} | ||
|
||
public AddressBarUser? GetById(Guid id) | ||
{ | ||
return _users.FirstOrDefault(user => user.UserId == id); | ||
} | ||
|
||
private static Guid ConvertFromString(string value) | ||
{ | ||
var guid = Guid.Parse(value); | ||
return guid; | ||
} | ||
} |