// Simulates background work that happens behind the splash screen async Task SimulateStartup() { DriverApp.RegisterUrlResource(); Log.Debug(TAG, "Performing some startup work that takes a bit of time."); Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); try { AppUpdateService asc = new AppUpdateService(); var model = await asc.GetServicesVersion(); if (model != null) { GlobalSetting.Instance.ServicesVersion = model.NowVersion; GlobalSetting.Instance.UpdateMsg = model.UpdateMessage; GlobalSetting.Instance.UpdateDownloadUrl = model.UpdateUrl; } StartActivity(new Intent(Application.Context, typeof(MainActivity))); //Log.Debug(TAG, "Startup work is finished - starting MainActivity."); } catch (Exception ex) { builder.SetTitle("启动失败"); builder.SetMessage("由于远程服务器错误,启动失败!"); builder.SetNeutralButton("确定", (IDialogInterfaceOnClickListener)null); builder.Show(); Log.Error(TAG, ex.Message); throw; } }
static void Main(string[] args) { using (DriverApp App = new DriverApp()) { if (App.Init(new IoTHubDriverModule(), args)) { // Do any initialization here App.Log("JPI Solutions IoT Hub Driver Started"); } // Start the main loop App.MainLoop(); } }
static void Main(string[] args) { using (DriverApp App = new DriverApp()) { // Init the driver with the database module if (App.Init(new CSharpModule(), args)) { // Do custom driver init here App.Log("Notify driver started"); // Start the driver MainLoop App.MainLoop(); } } }