Skip to content

Instantly share code, notes, and snippets.

View dylanberry's full-sized avatar
🛠️
Code.Build.Test.Deploy.Monitor.Repeat(); 🥇

dylanberry dylanberry

🛠️
Code.Build.Test.Deploy.Monitor.Repeat(); 🥇
View GitHub Profile
public class BaseTabViewModel : BaseViewModel, IActiveAware
{
// NOTE: Prism.Forms only sets IsActive, and does not do anything with the event.
public BaseTabViewModel(INavigationService navigationService,
IViewModelServiceProvider viewModelServiceProvider)
: base(navigationService, viewModelServiceProvider)
{
var onIsActiveChanged = new WeakEventHandler<EventArgs>(OnIsActiveChanged);
IsActiveChanged += onIsActiveChanged.Handler;

Agenda

  • Fix issues identified in PageNavigationService
  • Write UI tests!

Notes

  • if Visual Studio for Mac will not build/run due to XAMLC issues, clean, delete output and quit/restart VS

What did we do?

  • Fixed (not really) VS XAMLC headache
  • Debugged PageNavigationService, found/fixed an unawaited async call

Agenda

  • Build pages for tabbed navigation scenario in test "HelloWorld" project
  • Examine existing UI tests
  • Build new UI tests

What did we do?

  • Looked Prism modules for the first time!
  • Brought our list/detail page into the HelloWorld/Module A project
  • Added new dependencies into HelloWorld solution
  • Explored existing UI Tests - ran successfully
public static class TaskUtilities
{
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
public static async void FireAndForgetSafeAsync(this Task task, Action<Exception> handleErrorAction = null)
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
{
try
{
await task.ConfigureAwait(true);
}

Agenda

  • Functional testing
  • Unit testing

Notes

  • Give mfractor kudos for paste class functionality
@dylanberry
dylanberry / StreamNotes-2020-04-18.md
Created April 18, 2020 21:22
Stream Notes - 2020-04-18
var tabbedPage = new TabbedPage();

tabbedPage.Children.Add(new ViewA());

var navigationPage = new NavigationPage(new ViewB());
tabbedPage.Children.Add(navigationPage);

// selectedTab=ViewB
tabbedPage.CurrentPage = navigationPage;
@dylanberry
dylanberry / StreamNotes-2020-04-11.md
Last active April 11, 2020 22:50
StreamNotes-2020-04-11

Notes From Dan

// This should result in a Tabbed Page with ViewA & ViewB as tabs and ViewB as the selected Tab...
// ViewC should be a Modal over the TabbedPage
NavigationService.NavigateAsync("TabbedPage?createTab=ViewA&createTab=ViewB&selectedTab=ViewB/ViewC");
// If we're improving things... then this should create a tab with a NavigationPage with the root ViewB and current page as ViewD...
// The select tab should be able to distinguish it by NavigationPage unless more than one tab has a NavigationPage..
// otherwise it should distinguish which tab by either the root or current which ever matches...
NavigationService.NavigateAsync("TabbedPage?createTab=ViewA&createTab=NavigationPage/ViewB/ViewC/ViewD&selectedTab={NavigationPage|ViewB|ViewD}");
// Second note here that was actually invalid and should not be supported... as the first actual `/` should be treated as an entirely new segment
// Confirm with dialog
public override void OnBackPressed()
{
if (((ConfirmBack.App)App.Current).PromptToConfirmExit)
{
using (var alert = new AlertDialog.Builder(this))
{
alert.SetTitle("Confirm Exit");
alert.SetMessage("Are you sure you want to exit?");
alert.SetPositiveButton("Yes", (sender, args) => { FinishAffinity(); }); // inform Android that we are done with the activity
public bool PromptToConfirmExit
{
get
{
bool promptToConfirmExit = false;
if (MainPage is ContentPage)
{
promptToConfirmExit = true;
}
else if (MainPage is Xamarin.Forms.MasterDetailPage masterDetailPage