public static string CurrentNickName(GlobalDataModel data) //i think should be able to do without object if i choose. { if (data.MainNickName == "") { return(""); //can't show error because tablets call this and can't control this part. } //throw new BasicBlankException("No nick name can be found. Should have called HasSettings and acted accordingly"); if (data.SecondaryNickName != "") { return(data.SecondaryNickName); } return(data.MainNickName); }
public async Task <GlobalDataModel> OpenAsync() { if (HasSettings(IsXamarinForms) == false) { return(new GlobalDataModel()); //just return a new one period. } string path = GetPath(IsXamarinForms); GlobalDataModel output = new GlobalDataModel(); await Task.Run(() => { JsonSerializerSettings settings = new JsonSerializerSettings(); settings.Formatting = Formatting.Indented; settings.PreserveReferencesHandling = PreserveReferencesHandling.None; settings.TypeNameHandling = TypeNameHandling.None; string content = File.ReadAllText(path); output = JsonConvert.DeserializeObject <GlobalDataModel>(content, settings) !; }); return(output); //return await fs.RetrieveSavedObjectAsync<GlobalDataModel>(path); }
public async Task SaveAsync(GlobalDataModel payLoad) { string path = GetPath(IsXamarinForms); await fs.SaveObjectAsync(path, payLoad); }