Пример #1
0
        public override void OnCreate()
        {
            // This will be called whenever anything happens for the first time - including a receiver or service being started.

            _current = new WeakReference <NativeDroidApplication>(this);

            ViewPump.Init(ViewPump.InvokeBuilder()
                          .AddInterceptor(new BindingInterceptor())
                          .Build());

            // Register the view model to view mappings
            foreach (var mapping in GetViewModelToViewMappings())
            {
                ViewModelToViewConverter.AddMapping(mapping.Key, mapping.Value);
            }

            // Register splash mappings
            foreach (var mapping in GetViewModelToSplashMappings())
            {
                ViewModelToViewConverter.AddSplashMapping(mapping.Key, mapping.Value);
            }

            // Register the obtain dispatcher function
            PortableDispatcher.ObtainDispatcherFunction = () => { return(new AndroidDispatcher()); };

            // Register message dialog
            PortableMessageDialog.Extension = (messageDialog) => { AndroidMessageDialog.Show(messageDialog); return(Task.FromResult(true)); };

            PortableLocalizedResources.CultureExtension = GetCultureInfo;

            // Initialize the app
            PortableApp.InitializeAsync((PortableApp)Activator.CreateInstance(GetPortableAppType()));

            base.OnCreate();
        }
        public NativeUwpApplication()
        {
            // Register the view model to view mappings
            foreach (var mapping in GetViewModelToViewMappings())
            {
                ViewModelToViewConverter.AddMapping(mapping.Key, mapping.Value);
            }

            // Register the obtain dispatcher function
            PortableDispatcher.ObtainDispatcherFunction = () => { return(new UwpDispatcher()); };

            // Register message dialog
            PortableMessageDialog.Extension = UwpMessageDialog.ShowAsync;

            PortableLocalizedResources.CultureExtension = GetCultureInfo;

            // Initialize the app
            PortableApp.InitializeAsync((PortableApp)Activator.CreateInstance(GetPortableAppType()));
        }
Пример #3
0
 public void AddMapping(Type viewModelType, Type viewControllerType)
 {
     ViewModelToViewConverter.AddMapping(viewModelType, viewControllerType);
 }