public void EnsureInitialized(Context applicationContext)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            var ioc = MvxSimpleIoCContainer.Initialise();

            ioc.RegisterSingleton <IMvxTrace>(new MvxDebugOnlyTrace());
            MvxTrace.Initialize();

            ioc.RegisterSingleton <IMvxAndroidGlobals>(new AndroidGlobals(applicationContext));

            var builder = new MvxAndroidBindingBuilder();

            builder.DoRegistration();

            var viewCache = ioc.Resolve <IMvxTypeCache <View> >();

            viewCache.AddAssembly(typeof(View).Assembly);

            var namespaces = ioc.Resolve <IMvxNamespaceListViewTypeResolver>();

            namespaces.Add("Android.Views");
            namespaces.Add("Android.Widget");
            namespaces.Add("Android.Webkit");
        }
        public void EnsureInitialized(Context applicationContext)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            var ioc = MvxSimpleIoCContainer.Initialise();

            ioc.RegisterSingleton <IMvxPluginManager>(new MvxFilePluginManager(".Droid", ".dll"));

            ioc.RegisterSingleton <IMvxAndroidGlobals>(new AndroidGlobals(applicationContext, GetType().Namespace));

            var topActivity = new AndroidTopActivity();

            ioc.RegisterSingleton <ITopActivity>(topActivity);
            ioc.RegisterSingleton <IMvxMainThreadDispatcher>(topActivity);

            var builder = new MvxAndroidBindingBuilder();

            builder.DoRegistration();

            var viewCache = ioc.Resolve <IMvxTypeCache <View> >();

            viewCache.AddAssembly(typeof(View).Assembly);

            var namespaces = ioc.Resolve <IMvxNamespaceListViewTypeResolver>();

            namespaces.Add("Android.Views");
            namespaces.Add("Android.Widget");
            namespaces.Add("Android.Webkit");
        }
Example #3
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            DispatcherHelper.Initialize();

            ServiceLocator.MessageService        = new MessageService();
            ServiceLocator.LiveTileNotifyService = new LiveTileNotifyService();
            ServiceLocator.NavigationService     = new NavigationService();
            ServiceLocator.AzureMobileService    = new AzureMobileService();
            ServiceLocator.ResourceFileService   = new ResourceFileService();

            //Using MVVM Cross Container
            var iocProvider = MvxSimpleIoCContainer.Initialise();

            Mvx.RegisterSingleton <IMvxFileStore>(new MvxWindowsStoreBlockingFileStore());

            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();

                if (args.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
            //    if (!rootFrame.Navigate(typeof(ItemsShowcaseView), args.Arguments))
            //    {
            //        throw new Exception("Failed to create initial page");
            //    }
            //}

            //MVVMCross setup
            var setup = new Setup(rootFrame);

            setup.Initialize();

            //MVVMCross setup
            var start = Mvx.Resolve <IMvxAppStart>();

            start.Start();

            // Ensure the current window is active
            Window.Current.Activate();
        }
Example #4
0
 protected virtual void ClearAll()
 {
     // fake set up of the IoC
     MvxSingleton.ClearAllSingletons();
     _ioc = MvxSimpleIoCContainer.Initialise();
     _ioc.RegisterSingleton(_ioc);
     _ioc.RegisterSingleton <IMvxTrace>(new TestTrace());
     MvxTrace.Initialize();
     MvxBindingStatics.ClearCaches();
     AdditionalSetup();
 }
Example #5
0
 protected void ClearAll()
 {
     // fake set up of the IoC
     MvxSingleton.ClearAllSingletons();
     _ioc = MvxSimpleIoCContainer.Initialise();
     _ioc.RegisterSingleton(_ioc);
     _ioc.RegisterSingleton <IMvxTrace>(new TestTrace());
     RegisterAdditionalSingletons();
     InitialiseSingletonCache();
     InitialiseMvxSettings();
     MvxTrace.Initialize();
 }
Example #6
0
        public void EnsureInitialized(Context applicationContext)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            var ioc = MvxSimpleIoCContainer.Initialise();

            ioc.RegisterSingleton <IMvxPluginManager>(new MvxFilePluginManager(".Droid", ".dll"));

            ioc.RegisterSingleton <IMvxAndroidGlobals>(new AndroidGlobals(applicationContext, GetType().Namespace));
        }
Example #7
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            ServiceLocator.MessageService        = new MessageService();
            ServiceLocator.LiveTileNotifyService = new LiveTileNotifyService();
            ServiceLocator.NavigationService     = new XPlatformCloudKit.Services.NavigationService();
            ServiceLocator.AzureMobileService    = new AzureMobileService();
            ServiceLocator.ResourceFileService   = new ResourceFileService();

            //Using MVVM Cross IOCContainer
            var iocProvider = MvxSimpleIoCContainer.Initialise();

            Mvx.RegisterSingleton <IMvxFileStore>(new MvxIsolatedStorageFileStore());
        }
Example #8
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            ServiceLocator.MessageService        = new MessageService();
            ServiceLocator.LiveTileNotifyService = new LiveTileNotifyService();
            ServiceLocator.NavigationService     = new XPlatformCloudKit.Services.NavigationService();
            ServiceLocator.AzureMobileService    = new AzureMobileService();
            ServiceLocator.ResourceFileService   = new ResourceFileService();

            //Using MVVM Cross IOCContainer
            var iocProvider = MvxSimpleIoCContainer.Initialise();

            Mvx.RegisterSingleton <IMvxFileStore>(new MvxIsolatedStorageFileStore());

            //Oauth Init
            OAuthUtility.ComputeHash = (key, buffer) => { using (var hmac = new HMACSHA1(key)) { return(hmac.ComputeHash(buffer)); } };
        }
Example #9
0
        public void EnsureInitialized(Context applicationContext)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            var ioc = MvxSimpleIoCContainer.Initialise();

            ioc.RegisterSingleton <IMvxTrace>(new MvxDebugOnlyTrace());
            ioc.RegisterSingleton <IMvxPluginManager>(new MvxFilePluginManager(".Droid", ".dll"));

            ioc.RegisterSingleton <IMvxAndroidGlobals>(new AndroidGlobals(applicationContext, GetType().Namespace));

            var topActivity = new AndroidTopActivity();

            ioc.RegisterSingleton <ITopActivity>(topActivity);
            ioc.RegisterSingleton <IMvxMainThreadDispatcher>(topActivity);
        }
Example #10
0
        public void EnsureInitialized(Context applicationContext)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            var ioc = MvxSimpleIoCContainer.Initialise();

            ioc.RegisterSingleton <IMvxTrace>(new MvxDebugOnlyTrace());
            ioc.RegisterSingleton <IMvxPluginManager>(new MvxFilePluginManager(".Droid", ".dll"));

            ioc.RegisterSingleton <IMvxAndroidGlobals>(new AndroidGlobals(applicationContext));

            var topActivity = new AndroidTopActivity();

            ioc.RegisterSingleton <ITopActivity>(topActivity);
            ioc.RegisterSingleton <IMvxAndroidCurrentTopActivity>(topActivity);
            ioc.RegisterSingleton <IMvxMainThreadDispatcher>(topActivity);

            var builder = new MvxAndroidBindingBuilder(ignored => { }, ignored => { }, ignored => { });

            builder.DoRegistration();
        }
Example #11
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            DispatcherHelper.Initialize();

            ServiceLocator.MessageService        = new MessageService();
            ServiceLocator.LiveTileNotifyService = new LiveTileNotifyService();
            ServiceLocator.NavigationService     = new NavigationService();
            ServiceLocator.AzureMobileService    = new AzureMobileService();
            ServiceLocator.ResourceFileService   = new ResourceFileService();

            //Using MVVM Cross Container
            var iocProvider = MvxSimpleIoCContainer.Initialise();

            Mvx.RegisterSingleton <IMvxFileStore>(new MvxWindowsStoreBlockingFileStore());

            //Oauth Init
            OAuthUtility.ComputeHash = (key, buffer) =>
            {
                var crypt     = Windows.Security.Cryptography.Core.MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA1");
                var keyBuffer = Windows.Security.Cryptography.CryptographicBuffer.CreateFromByteArray(key);
                var cryptKey  = crypt.CreateKey(keyBuffer);

                var dataBuffer = Windows.Security.Cryptography.CryptographicBuffer.CreateFromByteArray(buffer);
                var signBuffer = Windows.Security.Cryptography.Core.CryptographicEngine.Sign(cryptKey, dataBuffer);

                byte[] value;
                Windows.Security.Cryptography.CryptographicBuffer.CopyToByteArray(signBuffer, out value);
                return(value);
            };

            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();

                if (args.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
            //    if (!rootFrame.Navigate(typeof(ItemsShowcaseView), args.Arguments))
            //    {
            //        throw new Exception("Failed to create initial page");
            //    }
            //}

            //MVVMCross setup
            var setup = new Setup(rootFrame);

            setup.Initialize();

            //MVVMCross setup
            var start = Mvx.Resolve <IMvxAppStart>();

            start.Start();

            // Ensure the current window is active
            Window.Current.Activate();
        }
Example #12
0
 protected virtual IMvxIoCProvider CreateIocProvider()
 {
     return(MvxSimpleIoCContainer.Initialise());
 }