コード例 #1
0
ファイル: HACCP.cs プロジェクト: PVSPReddy/HACCP
        /// <summary>
        /// App Constructor
        /// </summary>
        public App()
        {
            HaccpAppSettings.SharedInstance.IsWindows = Device.OS == TargetPlatform.Windows ||
                                                        Device.OS == TargetPlatform.WinPhone;


            if (HaccpAppSettings.SharedInstance.IsWindows)
            {
                Task.Run(
                    async() =>
                {
                    HaccpAppSettings.SharedInstance.ResourceString =
                        await DependencyService.Get <IResourceFileHelper>().LoadResourceAsync("ResourceFile.xml");
                });
            }

            else
            {
                try
                {
                    HaccpAppSettings.SharedInstance.ResourceString =
                        DependencyService.Get <IResourceFileHelper>().LoadResource("ResourceFile.xml");
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }


            IDataStore dataStore = new SQLiteDataStore();

            dataStore.LoadAppSettings(HaccpAppSettings.SharedInstance);
            Localization.SetLocale();
            HACCPUtil.PreCalculateSlopes();


            var netLanguage = DependencyService.Get <ILocale>().GetCurrent();

            AppResources.Culture = netLanguage;

            Styles.LoadStyles();


            if (string.IsNullOrEmpty(HaccpAppSettings.SharedInstance.SiteSettings.ServerAddress))
            {
                MainPage = new NavigationPage(new ServerSettings())
                {
                    BarBackgroundColor = Color.FromRgb(20, 34, 43),
                    BarTextColor       = Color.FromRgb(225, 225, 225),
                    HeightRequest      = 41
                };
            }
            else
            {
                MainPage = new NavigationPage(new Home())
                {
                    BarBackgroundColor = Color.FromRgb(20, 34, 43),
                    BarTextColor       = Color.FromRgb(225, 225, 225),
                    HeightRequest      = 41
                };
            }
        }