Пример #1
0
 // loading user from appdata folder
 // and deserialize it
 public static void LoadCurrentUserFromCache()
 {
     if (FileFolderHelper.FileExists(FileFolderHelper.LastUserFilePath))
     {
     }
     CurrentUser = SerializationManager.Deserialize <User>(FileFolderHelper.LastUserFilePath);
     if (CurrentUser != null)
     {
         Logger.Log($"\t{CurrentUser.ToString()} succsesfuly auto sign in");
     }
 }
Пример #2
0
        public static void LoadUsers()
        {
            if (FileFolderHelper.FileExists(FileFolderHelper.LastUserFilePath))
            {
                CurrentUsers = SerializationManager.Deserialize <List <Person> >(FileFolderHelper.LastUserFilePath);
            }
            else
            {
                var random = new Random();

                for (var i = 0; i < 50; ++i)
                {
                    var name    = Names[random.Next(Names.Length)];
                    var surname = Surnames[random.Next(Surnames.Length)];
                    CurrentUsers.Add(new Person(name, surname, $"{name}.{surname}@gmail.com", DateTime.Now.AddYears(-random.Next(10, 80)).AddDays(-random.Next(31)).AddMonths(-random.Next(12))));
                }
            }
        }