protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;


            base.OnCreate(savedInstanceState);

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);


            Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState);

            UserDialogs.Init(this);

            ZXing.Net.Mobile.Forms.Android.Platform.Init();

            Toolkit.Init();

            UserDialogs.Init(this);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            LoadApplication(new App());

            AppUpdateService.UpdateCheckVersionAsync(this);
        }
Esempio n. 2
0
        // 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;
            }
        }
Esempio n. 3
0
        private async Task TriggerUpdateCheckAsync(bool silent = false)
        {
            string url = await AppUpdateService.GetUpdateUrl(
                AppConstants.UpdateLink,
                Assembly.GetExecutingAssembly().GetName().Name,
                Assembly.GetExecutingAssembly().GetName().Version.ToString());

            if (string.IsNullOrEmpty(url))
            {
                if (!silent)
                {
                    _displayMessage.Invoke(
                        "No new updates are available.", "Update", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                return;
            }

            if (_displayMessage.Invoke(
                    "An update is available.\n\nWould you like to download it now?", "Update",
                    MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.Yes) == MessageBoxResult.Yes)
            {
                Process.Start("explorer.exe", url);
            }
        }