예제 #1
0
        public App()
        {
            InitializeComponent();

#if !DEBUG
            if ((Device.RuntimePlatform == Device.Android && CommonConstants.MobileCenterAndroid != "MC_ANDROID") ||
                (Device.RuntimePlatform == Device.iOS && CommonConstants.MobileCenteriOS != "MC_IOS") ||
                (Device.RuntimePlatform == Device.UWP && CommonConstants.MobileCenterUWP != "MC_UWP"))
            {
                MobileCenter.Start($"android={CommonConstants.MobileCenterAndroid};" +
                                   $"uwp={CommonConstants.MobileCenterUWP};" +
                                   $"ios={CommonConstants.MobileCenteriOS}",
                                   typeof(Analytics), typeof(Crashes));
            }
#endif

            //if design register the actual service, else mock
            if (CommonConstants.ClientId == "LIVE_ID")
            {
                DependencyService.Register <IMvpService, DesignMvpService>();
            }
            else
            {
                DependencyService.Register <IMvpService, LiveMvpService>();
            }

            if (LogOnViewModel.Instance.IsLoggedIn)
            {
                GoHome();
            }
            else
            {
                MainPage = new LogOn();
            }
        }
예제 #2
0
        public App()
        {
            InitializeComponent();

            if (LogOnViewModel.Instance.IsLoggedIn)
            {
                MainPage = new MyProfile();
            }
            else
            {
                MainPage = new LogOn();
            }
        }
예제 #3
0
        public App()
        {
            InitializeComponent();

#if DEBUG
            // force a specific culture, useful for quick testing
            System.Diagnostics.Debug.WriteLine("====== resource debug info =========");
            var assembly = typeof(App).GetTypeInfo().Assembly;
            foreach (var res in assembly.GetManifestResourceNames())
            {
                System.Diagnostics.Debug.WriteLine("found resource: " + res);
            }
            System.Diagnostics.Debug.WriteLine("====================================");
#endif


            // This lookup NOT required for Windows platforms - the Culture will be automatically set
            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android || Device.RuntimePlatform == Device.UWP)
            {
                // determine the correct, supported .NET culture
                var ci = DependencyService.Get <ILocalize>().GetCurrentCultureInfo();
                Microsoft.Mvp.Resources.AppResources.Culture = ci;                // set the RESX for resource localization
                DependencyService.Get <ILocalize>().SetLocale(ci);                // set the Thread for locale-aware methods
            }

            //Microsoft.Mvp.Resources.AppResources.Culture = new System.Globalization.CultureInfo("en");

#if !DEBUG
            if ((Device.RuntimePlatform == Device.Android && CommonConstants.MobileCenterAndroid != "MC_ANDROID") ||
                (Device.RuntimePlatform == Device.iOS && CommonConstants.MobileCenteriOS != "MC_IOS") ||
                (Device.RuntimePlatform == Device.UWP && CommonConstants.MobileCenterUWP != "MC_UWP"))
            {
                MobileCenter.Start($"android={CommonConstants.MobileCenterAndroid};" +
                                   $"uwp={CommonConstants.MobileCenterUWP};" +
                                   $"ios={CommonConstants.MobileCenteriOS}",
                                   typeof(Analytics), typeof(Crashes));
            }

            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
            {
                var ci = DependencyService.Get <ILocalize>().GetCurrentCultureInfo();
                Mvp.Resources.AppResources.Culture = ci;                 // set the RESX for resource localization
                DependencyService.Get <ILocalize>().SetLocale(ci);       // set the Thread for locale-aware methods
            }
#endif

#if DEBUG
            //if design register the actual service, else mock
            if (CommonConstants.ClientId == "LIVE_ID")
            {
                DependencyService.Register <IMvpService, DesignMvpService>();
            }
            else
            {
                DependencyService.Register <IMvpService, LiveMvpService>();
            }
#else
            if (CommonConstants.ClientId == "LIVE_ID")
            {
                throw new System.InvalidOperationException("Invalid configuration, please fill in proper Ids.");
            }

            DependencyService.Register <IMvpService, LiveMvpService>();
#endif

            if (LogOnViewModel.Instance.IsLoggedIn)
            {
                GoHome();
            }
            else
            {
                MainPage = new LogOn();
            }
        }