Files
LogisticsMgr-Mobile/LogisticsMgrMobile/LogisticsMgrMobile.Android/Mobile/Droid/App/MainActivity.cs
T
2019-08-05 09:02:30 +01:00

67 lines
2.7 KiB
C#

using System;
using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Content;
using Sarand.LogisticsMgr.Mobile.Core.App;
using System.Threading.Tasks;
namespace Sarand.LogisticsMgr.Mobile.Droid
{
//=======================================================================
[Activity(Label = "LogisticsMgrMobile", Icon = "@drawable/icon_solent_stevedores", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
//-------------------------------------------------------------------
// Data members.
private Sarand.LogisticsMgr.Mobile.App.App application = null;
//-------------------------------------------------------------------
// A c t i v i t y E v e n t s
//-------------------------------------------------------------------
protected override void OnCreate (Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
// Unhandled exceptions.
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
// Initialise the application.
application = new Sarand.LogisticsMgr.Mobile.App.App(SlmMobile.Platform.Android);
LoadApplication(application);
}
//-------------------------------------------------------------------
// U n h a n d l e d E x c e p t i o n s
//-------------------------------------------------------------------
private void CurrentDomain_UnhandledException (object sender, UnhandledExceptionEventArgs e)
{
if (application != null)
application.OnUnhandledException(sender, e.ExceptionObject, e.IsTerminating);
}
private void TaskScheduler_UnobservedTaskException (object sender, UnobservedTaskExceptionEventArgs e)
{
if (application != null)
application.UnobservedTaskException(sender, e);
}
private void AndroidEnvironment_UnhandledExceptionRaiser (object sender, RaiseThrowableEventArgs e)
{
if (application != null)
application.UnhandledExceptionRaiser(sender, e.Exception, e.Handled);
}
//-------------------------------------------------------------------
}
//=======================================================================
}