コード例 #1
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     Xamarin.Forms.Forms.Init(this, bundle);
     HybridWebViewRenderer.Init();
     LoadApplication(new App());
 }
コード例 #2
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="options">The options.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        /// <remarks>
        /// This method is invoked when the application has loaded and is ready to run. In this
        /// method you should instantiate the window, load the UI into it and then make the window
        /// visible.
        ///
        /// You have 17 seconds to return from this method, or iOS will terminate your application.
        /// </remarks>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            this.SetIoc();

            //new CalendarViewRenderer(); //added so the assembly is included
            HybridWebViewRenderer.CopyBundleDirectory("HTML");
            Forms.Init();

            var formsApp = new App();

            LoadApplication(formsApp);

//			this._window = new UIWindow(UIScreen.MainScreen.Bounds)
//			{
//				RootViewController = App.GetMainPage().CreateViewController()
//			};

            Forms.ViewInitialized += (sender, e) =>
            {
                if (!string.IsNullOrWhiteSpace(e.View.StyleId))
                {
                    e.NativeView.AccessibilityIdentifier = e.View.StyleId;
                }
            };

            base.FinishedLaunching(app, options);

            return(true);
        }
コード例 #3
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            HybridWebViewRenderer.CopyBundleDirectory("www");
            Forms.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
コード例 #4
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Xamarin.Forms.Forms.Init();
            HybridWebViewRenderer.Init();

            LoadApplication(new App());
            return(base.FinishedLaunching(app, options));
        }
コード例 #5
0
        public MainPage()
        {
            var hybrid = new HybridWebViewRenderer();

            InitializeComponent();
            SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new XHybrid.App());
        }
コード例 #6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Forms.Init(this, bundle);
            //HACK. Forcing HybridWebViewRenderer to load.
            var renderer = new HybridWebViewRenderer();
            var mainPage = new MainPage();

            mainPage.UserDialogService = new UserDialogService();
            SetPage(mainPage);
        }
コード例 #7
0
        public MainPage()
        {
            InitializeComponent();

            Forms.Init();
            //HACK. Forcing HybridWebViewRenderer to load.
            var renderer = new HybridWebViewRenderer();
            var mainPage = new Xamarin.Forms.OAuth.Sample.MainPage();

            mainPage.UserDialogService = new UserDialogService();
            Content = mainPage.ConvertPageToUIElement(this);
        }
コード例 #8
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            HybridWebViewRenderer.Initialize();

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App(new AndroidInitializer()));
        }
コード例 #9
0
        protected override void OnCreate(Bundle bundle)
        {
            if (!string.IsNullOrWhiteSpace(Intent.DataString))
            {
                var uri      = Android.Net.Uri.Parse(Intent.DataString);
                var filePath = IOUtil.GetPath(ApplicationContext, uri);
                if (string.IsNullOrEmpty(filePath))
                {
                    filePath = IOUtil.IsMediaStore(Intent.Scheme) ? uri.ToString() : uri.Path;
                }

                var fileName = GetFileName(ApplicationContext, uri);

                var fs = IocManager.Container.Resolve <FileService>();
                UserSettings.OpenBookImmediately = new FileData(filePath, fileName, () => fs.LoadFileStreamAsync(filePath).Result);
            }

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

            base.OnCreate(bundle);
            Xamarin.Essentials.Platform.Init(this, bundle);

            SetUpIoc();

            HybridWebViewRenderer.Initialize();

            HybridWebViewRenderer.OnControlChanged += (sender, webView) => {
                webView.SetLayerType(LayerType.Software, null);
                webView.Settings.LoadWithOverviewMode = true;
                webView.Settings.UseWideViewPort      = true;
            };

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

            // Rg.popup initialization, see: https://github.com/rotorgames/Rg.Plugins.Popup/wiki/Getting-started
            Rg.Plugins.Popup.Popup.Init(this, bundle);

            global::Xamarin.Forms.Forms.SetFlags("FastRenderers_Experimental");
            global::Xamarin.Forms.Forms.Init(this, bundle);

            //TODO: Make sure to compile for all Android versions: https://forums.xamarin.com/discussion/382/suggestions-on-how-to-support-multiple-api-levels-from-a-single-application-apk
#if __ANDROID_28__
            //Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
#endif

            LoadApplication(new App());

            Window.SetSoftInputMode(SoftInput.AdjustResize);

            _batteryBroadcastReceiver = new BatteryBroadcastReceiver();
            Application.Context.RegisterReceiver(_batteryBroadcastReceiver, new IntentFilter(Intent.ActionBatteryChanged));
        }
コード例 #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            HybridWebViewRenderer.Initialize();
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
コード例 #11
0
ファイル: AppDelegate.cs プロジェクト: coldfins/Xamarin
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            SetIoC();

            HybridWebViewRenderer.CopyBundleDirectory("HTML");

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());
            var file = Resolver.Resolve <IFilePath>().GetFilePath();

            Debug.WriteLine("call from OnAppearing: " + file + "/" + "index.html");
            return(base.FinishedLaunching(app, options));
        }
コード例 #12
0
ファイル: MainActivity.cs プロジェクト: Li-Yanzhi/XamHybrid
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            HybridWebViewRenderer.Initialize();
            Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState);
            global::ZXing.Net.Mobile.Forms.Android.Platform.Init();

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
コード例 #13
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                var assemblies = new List <Assembly> {
                    typeof(HybridWebViewRenderer).GetTypeInfo().Assembly
                };

                HybridWebViewRenderer.Initialize();

                //Rg initialization, see: https://github.com/rotorgames/Rg.Plugins.Popup/wiki/Getting-started
                Rg.Plugins.Popup.Popup.Init();
                assemblies.AddRange(Rg.Plugins.Popup.Popup.GetExtraAssemblies());

                Xamarin.Forms.Forms.Init(e, assemblies);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
コード例 #14
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();
            //HACK. Forcing HybridWebViewRenderer to load.
            var renderer = new HybridWebViewRenderer();
            var mainPage = new MainPage();

            mainPage.UserDialogService = new UserDialogService();
            window = new UIWindow(UIScreen.MainScreen.Bounds)
            {
                RootViewController = mainPage.CreateViewController()
            };

            window.MakeKeyAndVisible();

            return(true);
        }
コード例 #15
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            this.SetIoc();

            HybridWebViewRenderer.CopyBundleDirectory("HTML");

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new XLabs.Samples.App());

            Xamarin.Forms.Forms.ViewInitialized += (sender, e) =>
            {
                if (!string.IsNullOrWhiteSpace(e.View.StyleId))
                {
                    e.NativeView.AccessibilityIdentifier = e.View.StyleId;
                }
            };

            return(base.FinishedLaunching(app, options));
        }
コード例 #16
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            HybridWebViewRenderer.CopyBundleDirectory("HTML");
            if (!Resolver.IsSet)
            {
                var container = new SimpleContainer();
                container.Register <IDevice>(t => AppleDevice.CurrentDevice);
                container.Register <IDisplay>(t => t.Resolve <IDevice>().Display);
                container.Register <INetwork>(t => t.Resolve <IDevice>().Network);

                Resolver.SetResolver(container.GetResolver());
            }

            global::Xamarin.Forms.Forms.Init();

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
コード例 #17
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var web = new HybridWebViewRenderer();

            var container = new SimpleContainer();

            container.Register <IJsonSerializer, JsonSerializer>();
            container.Register <IDevice>(AppleDevice.CurrentDevice);

            Resolver.SetResolver(container.GetResolver());

            global::Xamarin.Forms.Forms.Init();

            // Code for starting up the Xamarin Test Cloud Agent
            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            #endif

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
コード例 #18
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                HybridWebViewRenderer.Initialize();

                Xamarin.Forms.Forms.Init(e);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
コード例 #19
0
ファイル: CustomHybrid.cs プロジェクト: luckychel/DanfossFCC
 public CustomClient(HybridWebViewRenderer webHybrid) : base(webHybrid)
 {
 }
コード例 #20
0
 public HybridWebViewClient(HybridWebViewRenderer webHybrid)
 {
     this.WebHybrid = new WeakReference <HybridWebViewRenderer>(webHybrid);
 }
コード例 #21
0
 public JSBridge(HybridWebViewRenderer hybridRenderer)
 {
     hybridWebViewRenderer = new WeakReference <HybridWebViewRenderer>(hybridRenderer);
 }
コード例 #22
0
		public JSBridge (HybridWebViewRenderer hybridRenderer)
		{
			hybridWebViewRenderer = new WeakReference <HybridWebViewRenderer> (hybridRenderer);
		}
コード例 #23
0
 public AdvancedWebViewRendererClient(HybridWebViewRenderer webHybrid) : base(webHybrid)
 {
 }