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

            base.OnCreate(savedInstanceState);
            Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);

            //       CrossCurrentActivity.Current.Init(this, savedInstanceState);
            //ChechSdk();
            Plugin.InputKit.Platforms.Droid.Config.Init(this, savedInstanceState);
            FormsMaterial.Init(this, savedInstanceState);
            XamEffects.Droid.Effects.Init();
            CachedImageRenderer.Init(true);
            global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");

            //     Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState);
            //PdfSharp.Xamarin.Forms.Droid.Platform.Init();
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjEyOTEwQDMxMzcyZTM0MmUzMEhBclpMNTZSNlpLQTFzUVlhbjFIR3d2aXFlVUFXcmNURVVycTMxQUZOdFk9");

            LoadApplication(new App());
        }
Exemple #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ParentActivityWrapper.ParentActivity = this;
            ExecutingPlatform.Current            = AppPlatform.Android;

#if !DEBUG
            AppCenter.Start(ConfigurationManager.AppSettings["AndroidAppcenterSecret"],
                            typeof(Analytics), typeof(Crashes));
#endif

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            Popup.Init(this, savedInstanceState);
            Forms.Init(this, savedInstanceState);
            FormsMaterial.Init(this, savedInstanceState);
            Material.Init(this, savedInstanceState);

            LoadApplication(new App());
            Platform.Init(this, savedInstanceState);

            StartBackgroundServices();
        }
Exemple #3
0
        /// <inheritdoc/>
        public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            ExecutingPlatform.Current = AppPlatform.iOS;
            ConfigurationManager.Initialise(PortableStream.Current);
            InitLogger();

            RegisterServices();

#if !DEBUG
            AppCenter.Start(ConfigurationManager.AppSettings["IosAppcenterSecret"], typeof(Analytics), typeof(Crashes));
#endif

            Forms.Init();
            FormsMaterial.Init();
            Material.Init();
            LoadApplication(new App());
            Popup.Init();

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.BlackOpaque;
            uiApplication.SetMinimumBackgroundFetchInterval(MINIMUM_BACKGROUND_FETCH_INTERVAL);
            UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum);

            return(base.FinishedLaunching(uiApplication, launchOptions));
        }
Exemple #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.SetTheme(Resource.Style.MainTheme);
            base.OnCreate(bundle);
            AppContext = ApplicationContext;

            Forms.SetFlags("CollectionView_Experimental");

            //Xamarin.FormsMaps.Init(this, bundle);
            HtmlLabelRenderer.Initialize();
            CrossMediaManager.Current.Init(this);
            CrossCurrentActivity.Current.Init(this, bundle);
            Popup.Init(this, bundle);
            Forms.Init(this, bundle);
            FormsMaterial.Init(this, bundle);
            ExperimentalFeatures.Enable(ExperimentalFeatures.EmailAttachments);

            //CachedImageRenderer.Init(enableFastRenderer: true);

            LoadApplication(new App());

            Window.SetStatusBarColor(Android.Graphics.Color.White);
            Window.SetTitleColor(Android.Graphics.Color.Black);
        }
Exemple #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.Window.RequestFeature(WindowFeatures.ActionBar);

            TabLayoutResource = Android.Resource.Layout.Tabbar;
            ToolbarResource   = Android.Resource.Layout.Toolbar;

            base.OnCreate(bundle);
            myActivity = this;

            FormsMaterial.Init(this, bundle);
            UserDialogs.Init(this);
            Rg.Plugins.Popup.Popup.Init(this, bundle);
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);
            Xamarin.FormsMaps.Init(this, bundle);
            TintedImageRenderer.Init();
            Xamarin.Essentials.Platform.Init(this, bundle);
            CrossCurrentActivity.Current.Init(this, bundle);
            Forms9Patch.Droid.Settings.Initialize(this);
            SegmentedControlRenderer.Init();
            Forms.Init(this, bundle);
            LoadApplication(new App());
            GetAccessCoarseLocationPermission();
        }
Exemple #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            // initialisation des composants
            Instance = this;

            Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);

            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            Forms.SetFlags("CollectionView_Experimental");

            //test


            Forms.Init(this, savedInstanceState);

            AiForms.Renderers.Droid.SettingsViewInit.Init(); // need to write here
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true);
            CachedImageRenderer.InitImageViewHandler();

            FormsMaterial.Init(this, savedInstanceState);
            Xamarin.FormsMaps.Init(this, savedInstanceState);

            // initialisation des composants


            CardsViewRenderer.Preserve();
            ImageCircleRenderer.Init();
            // fin d'initialisation
            LoadApplication(new App());
        }
Exemple #7
0
        protected override void OnCreate(Bundle bundle)
        {
            Profile.Start();

            ToolbarResource   = Resource.Layout.Toolbar;
            TabLayoutResource = Resource.Layout.Tabbar;

            // Uncomment the next line to run this as a full screen app (no status bar)
            //Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn);

            base.OnCreate(bundle);

#if TEST_EXPERIMENTAL_RENDERERS
            // Fake_Flag is here so we can test for flag initialization issues
            Forms.SetFlags("Fake_Flag" /*, "CollectionView_Experimental", "Shell_Experimental"*/);
#else
            Forms.SetFlags("UseLegacyRenderers", "SwipeView_Experimental");
#endif
            Forms.Init(this, bundle);

            FormsMaps.Init(this, bundle);
            FormsMaterial.Init(this, bundle);
            AndroidAppLinks.Init(this);
            Forms.ViewInitialized += (sender, e) => {
                //				if (!string.IsNullOrWhiteSpace(e.View.StyleId)) {
                //					e.NativeView.ContentDescription = e.View.StyleId;
                //				}
            };

            // uncomment to verify turning off title bar works. This is not intended to be dynamic really.
            //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never);

            if (RestartAppTest.App != null)
            {
                _app = (App)RestartAppTest.App;
                RestartAppTest.Reinit = true;
            }
            else
            {
                _app = new App();
            }

            // When the native control gallery loads up, it'll let us know so we can add the nested native controls
            MessagingCenter.Subscribe <NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls);

            // When the native binding gallery loads up, it'll let us know so we can set up the native bindings
            MessagingCenter.Subscribe <NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings);

            // Listen for the message from the status bar color toggle test
            MessagingCenter.Subscribe <AndroidStatusBarColor>(this, AndroidStatusBarColor.Message, color => SetStatusBarColor(global::Android.Graphics.Color.Red));

            SetUpForceRestartTest();

            // Make the activity accessible to platform unit tests
            DependencyResolver.ResolveUsing((t) => {
                if (t == typeof(Context))
                {
                    return(this);
                }

                return(null);
            });

            LoadApplication(_app);
            if (Forms.Flags.Contains("FastRenderers_Experimental"))
            {
                var masterPage = ((_app.MainPage as MasterDetailPage)?.Master as ContentPage);
                if (masterPage != null)
                {
                    masterPage.Content = new Label {
                        Text = "Fast Renderers"
                    }
                }
                ;
            }
        }
Exemple #8
0
        protected override void OnCreate(Bundle bundle)
        {
            Profile.Start();

            ToolbarResource   = Resource.Layout.Toolbar;
            TabLayoutResource = Resource.Layout.Tabbar;

            // Uncomment the next line to run this as a full screen app (no status bar)
            //Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn);

            base.OnCreate(bundle);

#if !LEGACY_RENDERERS
#else
            Forms.SetFlags("UseLegacyRenderers");
#endif
            Forms.Init(this, bundle);

            // null out the assembly on the Resource Manager
            // so all of our tests run without using the reflection APIs
            // At some point the Resources class types will go away so
            // reflection will stop working
            ResourceManager.Init(null);

            FormsMaps.Init(this, bundle);
            FormsMaterial.Init(this, bundle);
            AndroidAppLinks.Init(this);
            Forms.ViewInitialized += (sender, e) => {
                //				if (!string.IsNullOrWhiteSpace(e.View.StyleId)) {
                //					e.NativeView.ContentDescription = e.View.StyleId;
                //				}
            };

            // uncomment to verify turning off title bar works. This is not intended to be dynamic really.
            //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never);

            if (RestartAppTest.App != null)
            {
                _app = (App)RestartAppTest.App;
                RestartAppTest.Reinit = true;
            }
            else
            {
                _app = new App();
            }

            // When the native control gallery loads up, it'll let us know so we can add the nested native controls
            MessagingCenter.Subscribe <NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls);

            // When the native binding gallery loads up, it'll let us know so we can set up the native bindings
            MessagingCenter.Subscribe <NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings);

            // Listen for the message from the status bar color toggle test
            MessagingCenter.Subscribe <AndroidStatusBarColor>(this, AndroidStatusBarColor.Message, color => SetStatusBarColor(global::Android.Graphics.Color.Red));

            SetUpForceRestartTest();

            // Make the activity accessible to platform unit tests
            DependencyResolver.ResolveUsing((t) => {
                if (t == typeof(Context))
                {
                    return(this);
                }

                return(null);
            });

            DependencyService.Register <IMultiWindowService, MultiWindowService>();

            LoadApplication(_app);

#if LEGACY_RENDERERS
            if ((int)Build.VERSION.SdkInt >= 21)
            {
                // Show a purple status bar if we're looking at legacy renderers
                Window.SetStatusBarColor(Color.MediumPurple.ToAndroid());
            }
#endif
        }
Exemple #9
0
        protected override void RunAppStart(object hint = null)
        {
            base.RunAppStart(hint);

            FormsMaterial.Init();
        }
        //#if DEBUG
        //RefWatcher? _refWatcher;

        //void SetupLeakCanary()
        //{
        //    // “A small leak will sink a great ship.” - Benjamin Franklin
        //    if (LeakCanaryXamarin.IsInAnalyzerProcess(this))
        //    {
        //        // This process is dedicated to LeakCanary for heap analysis.
        //        // You should not init your app in this process.
        //        return;
        //    }
        //    _refWatcher = LeakCanaryXamarin.Install(this);
        //}
        //#endif

        public override void OnCreate()
        {
            base.OnCreate();
            //#if DEBUG
            //            //SetupLeakCanary();
            //#endif
            var stopwatch  = Stopwatch.StartNew();
            var startTrace = new StringBuilder();

            FileSystem2.InitFileSystem();

            stopwatch.Stop();
            startTrace.AppendFormatLine("init FileSystem {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            IApplication.InitLogDir();

            stopwatch.Stop();
            startTrace.AppendFormatLine("init NLog {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            Startup.InitGlobalExceptionHandler();

            stopwatch.Stop();
            startTrace.AppendFormatLine("init ExceptionHandler {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            VisualStudioAppCenterSDK.Init();

            stopwatch.Stop();
            startTrace.AppendFormatLine("init AppCenter {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            XEFileProvider.TemporaryLocation = FileProviderLocation.Internal;
            XEPlatform.Init(this); // 初始化 Xamarin.Essentials.Platform.Init

            XEPlatform.ActivityStateChanged += OnActivityStateChanged;

            stopwatch.Stop();
            startTrace.AppendFormatLine("init Essentials {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            bool GetIsMainProcess()
            {
                // 注意:进程名可以自定义,默认是包名,如果自定义了主进程名,这里就有误,所以不要自定义主进程名!
                var name = this.GetCurrentProcessName();

                return(name == PackageName);
            }

            IsMainProcess = GetIsMainProcess();

            stopwatch.Stop();
            startTrace.AppendFormatLine("init IsMainProcess {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            SettingsHost.Load();

            stopwatch.Stop();
            startTrace.AppendFormatLine("init SettingsHost {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            InitSettingSubscribe();

            stopwatch.Stop();
            startTrace.AppendFormatLine("init SettingSubscribe {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            var level = DILevel.Min;

            if (IsMainProcess)
            {
                level = DILevel.MainProcess;
            }
            Startup.Init(level);

            stopwatch.Stop();
            startTrace.AppendFormatLine("init Startup {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            if (IsMainProcess)
            {
                XEVersionTracking.Track();

                stopwatch.Stop();
                startTrace.AppendFormatLine("init VersionTracking {0}ms", stopwatch.ElapsedMilliseconds);
                stopwatch.Restart();

                if (XEVersionTracking.IsFirstLaunchForCurrentVersion)
                {
                    // 当前版本第一次启动时,清除存放升级包缓存文件夹的目录
                    IApplicationUpdateService.ClearAllPackCacheDir();

                    stopwatch.Stop();
                    startTrace.AppendFormatLine("init ClearAllPackCacheDir {0}ms", stopwatch.ElapsedMilliseconds);
                    stopwatch.Restart();
                }
            }
            UISettings.Language.Subscribe(x => R.ChangeLanguage(x));

            stopwatch.Stop();
            startTrace.AppendFormatLine("init Language.Subscribe {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            Startup.OnStartup(IsMainProcess);

            stopwatch.Stop();
            startTrace.AppendFormatLine("init OnStartup {0}ms", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();

            if (IsMainProcess)
            {
                var vmService = IViewModelManager.Instance;
                vmService.InitViewModels();

                stopwatch.Stop();
                startTrace.AppendFormatLine("init ViewModels {0}ms", stopwatch.ElapsedMilliseconds);
                stopwatch.Restart();

#if __XAMARIN_FORMS__
                Forms.Init(this, null);
                FormsMaterial.Init(this, null);
                ImageCircleRenderer.Init();

                stopwatch.Stop();
                startTrace.AppendFormatLine("init XF {0}ms", stopwatch.ElapsedMilliseconds);
                stopwatch.Restart();

                _Current = new(RealTheme);

                stopwatch.Stop();
                startTrace.AppendFormatLine("init XFApp {0}ms", stopwatch.ElapsedMilliseconds);
                stopwatch.Restart();
#endif
                vmService.MainWindow.Initialize();
            }

            stopwatch.Stop();
            StartupTrack = startTrace.ToString();
#if DEBUG
            Log.Warn("Application", $"OnCreate Complete({stopwatch.ElapsedMilliseconds}ms");
#endif
        }