Пример #1
0
 public async Task<bool> loadSettings()
 {
     var set = new Settings();
     var sets = set.LoadOptions();
     opt = await sets;
     //
     // first time through, give this person a guid
     if (opt == null || opt.teamNumber == 0 || opt.name == "")// || opt.bShowIntro==true)
     {
         opt = new Options();
         DisplayAlert("Identify Your Team", "Enter Team Number and Your Name", "OK");
         teamEntry.BackgroundColor = Color.Yellow;
         teamEntry.TextColor = Color.Black;
         return false;
     }
     else
     {
         teamEntry.Text = opt.teamNumber.ToString();
         nameEntry.Text = opt.name;
         getMatches();
     }
     return true;
 }
Пример #2
0
 public async Task SaveOptions(Options opt)
 {
     string ps = JsonConvert.SerializeObject(opt);
     try
     {
         IFolder rootFolder = FileSystem.Current.LocalStorage;
         IFolder folder = await rootFolder.CreateFolderAsync("Settings", CreationCollisionOption.OpenIfExists, CancellationToken.None);
         IFile f = await folder.CreateFileAsync("options.txt", CreationCollisionOption.ReplaceExisting, CancellationToken.None);
         await f.WriteAllTextAsync(ps);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }