コード例 #1
0
ファイル: App.xaml.cs プロジェクト: garciart/TestMate
        /// <summary>
        /// Attempt to read and set stored settings upon application load
        /// </summary>
        protected override void OnStart()
        {
            // Handle when your app starts
            // ReadSettingsFromFile() returns null if successful
            string errorMessage = AppFunctions.ReadSettingsFromFile();

            if (!String.IsNullOrEmpty(errorMessage))
            {
                // Display error
                Application.Current.MainPage.DisplayAlert("Test Mate", errorMessage, "OK");
                // Disable application only if the error is NOT a missing settings file (e.g., IOException, etc.)
                App.enableAppFlag = (errorMessage != AppResources.SettingsMissingErrorMessage) ? false : true;
            }
        }