67 lines
2.7 KiB
C#
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.BusinessMgr.Mobile.Core.App;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Sarand.BusinessMgr.Mobile.Droid
|
|
{
|
|
//=======================================================================
|
|
[Activity(Label = "BusinessMgrMobile", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
|
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private Sarand.BusinessMgr.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.BusinessMgr.Mobile.App.App(SbmMobile.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);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
} |