Esempio n. 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 override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // These classes won't be linked away because of the code,
            // but we also won't have to construct unnecessarily either,
            // hence the if statement with (hopefully) impossible
            // runtime condition.
            //
            // This is to resolve crash at CultureInfo.CurrentCulture
            // when language is set to Thai. See
            // https://github.com/xamarin/Xamarin.Forms/issues/4037
            if (Environment.CurrentDirectory == "_never_POSSIBLE_")
            {
                new System.Globalization.ChineseLunisolarCalendar();
                new System.Globalization.HebrewCalendar();
                new System.Globalization.HijriCalendar();
                new System.Globalization.JapaneseCalendar();
                new System.Globalization.JapaneseLunisolarCalendar();
                new System.Globalization.KoreanCalendar();
                new System.Globalization.KoreanLunisolarCalendar();
                new System.Globalization.PersianCalendar();
                new System.Globalization.TaiwanCalendar();
                new System.Globalization.TaiwanLunisolarCalendar();
                new System.Globalization.ThaiBuddhistCalendar();
                new System.Globalization.UmAlQuraCalendar();
            }

            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            _current = new WeakReference <NativeiOSApplication>(this);

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

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

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

            //PortableLocalizedResources.CultureExtension = GetCultureInfo;

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

            return(true);
        }
        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()));
        }