Cannot make OnCreate method async or things don't execute in correct order

This commit is contained in:
Kyle Spearrin 2016-08-27 15:00:12 -04:00
parent 379404077a
commit a077944629
3 changed files with 4 additions and 7 deletions

View file

@ -25,7 +25,7 @@ namespace Bit.Android
{ {
private const string HockeyAppId = "d3834185b4a643479047b86c65293d42"; private const string HockeyAppId = "d3834185b4a643479047b86c65293d42";
protected async override void OnCreate(Bundle bundle) protected override void OnCreate(Bundle bundle)
{ {
ToolbarResource = Resource.Layout.toolbar; ToolbarResource = Resource.Layout.toolbar;
TabLayoutResource = Resource.Layout.tabs; TabLayoutResource = Resource.Layout.tabs;
@ -34,7 +34,7 @@ namespace Bit.Android
// workaround for app compat bug // workaround for app compat bug
// ref https://forums.xamarin.com/discussion/62414/app-resuming-results-in-crash-with-formsappcompatactivity // ref https://forums.xamarin.com/discussion/62414/app-resuming-results-in-crash-with-formsappcompatactivity
await Task.Delay(10); Task.Delay(10).Wait();
Console.WriteLine("A OnCreate"); Console.WriteLine("A OnCreate");
Window.SetSoftInputMode(SoftInput.StateHidden); Window.SetSoftInputMode(SoftInput.StateHidden);

View file

@ -43,13 +43,13 @@ namespace Bit.Android
} }
} }
public async override void OnCreate() public override void OnCreate()
{ {
base.OnCreate(); base.OnCreate();
// workaround for app compat bug // workaround for app compat bug
// ref https://forums.xamarin.com/discussion/62414/app-resuming-results-in-crash-with-formsappcompatactivity // ref https://forums.xamarin.com/discussion/62414/app-resuming-results-in-crash-with-formsappcompatactivity
await Task.Delay(10); Task.Delay(10).Wait();
RegisterActivityLifecycleCallbacks(this); RegisterActivityLifecycleCallbacks(this);
AppContext = ApplicationContext; AppContext = ApplicationContext;

View file

@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Bit.App.Pages; using Bit.App.Pages;
using Xamarin.Forms; using Xamarin.Forms;
@ -13,7 +11,6 @@ using Bit.App.Controls;
using Plugin.Connectivity.Abstractions; using Plugin.Connectivity.Abstractions;
using System.Net; using System.Net;
using Acr.UserDialogs; using Acr.UserDialogs;
using PushNotification.Plugin.Abstractions;
using XLabs.Ioc; using XLabs.Ioc;
namespace Bit.App namespace Bit.App