Beispiel #1
0
 private async Task ProcessRemoteFileList()
 {
     await ForEachAsync(_Files, async delegate(IpfsFile file)
     {
         string filename = Path.Combine(FileSystemConstants.PswmgrDataFolder, Path.ChangeExtension(file.LocalFilename, ".json"));
         if (File.Exists(filename))
         {
             ResolveConflict(file.LocalFilename, filename);
         }
         else
         {
             await IpfsApiWrapper.Get(file.RemoteFilename, filename);
             PasswordEntryManager.Instance.AddEntry(PasswordEntry.Load(filename));
         }
     });
 }
        public async void LoadPasswords()
        {
            _Passwords.Clear();

            Directory.CreateDirectory(FileSystemConstants.PswmgrDataFolder);

            var files = Directory.GetFiles(FileSystemConstants.PswmgrDataFolder, "*.json");
            await Task.Run(delegate
            {
                Parallel.ForEach(files, delegate(string file)
                {
                    var val = PasswordEntry.Load(file);
                    ExceptionUtilities.TryCatchIgnore(() => App.Instance.Dispatcher.Invoke(() => _Passwords.Add(val)));
                });
            });

            OnFinishedLoading();
        }