Exemple #1
0
 public async void OnClosePopup(View item, object parameter)
 {
     if (item is SelectImportSourceView)
     {
         if (parameter != null)
         {
             Dictionary <string, object> parameters = parameter as Dictionary <string, object>;
             if (parameters != null)
             {
                 CSVImporter  csvImporter  = (CSVImporter)parameters["CSVImporter"];
                 ImportSource importSource = (ImportSource)parameters["ImportSource"];
                 if (importSource.Format != Common.CSVFormat.Unknown)
                 {
                     List <ImportFieldMapping> mappings = CSVImporter.CreateMappings(importSource.Format);
                     await csvImporter.ImportToVault(Vault, mappings);
                 }
                 else
                 {
                     App.Controller.ShowPopup(
                         "vault.importmap",
                         new KeyValuePair <string, object>("CSVImporter", csvImporter),
                         new KeyValuePair <string, object>("ImportHeaders", csvImporter.Headers),
                         new KeyValuePair <string, object>("StandardFields", Credential.StandardFields));
                 }
             }
         }
     }
     else if (item is ImportMappingView)
     {
         Dictionary <string, object> parameters = parameter as Dictionary <string, object>;
         if (parameters != null)
         {
             CSVImporter csvImporter            = (CSVImporter)parameters["CSVImporter"];
             List <ImportFieldMapping> mappings = (List <ImportFieldMapping>)parameters["Mappings"];
             await csvImporter.ImportToVault(Vault, mappings);
         }
     }
     else if (item is VaultReportView)
     {
         string filter = (string)parameter;
         if (!String.IsNullOrEmpty(filter))
         {
             Entry searchEntry = View.FindByName <Entry>("SearchEntry");
             if (searchEntry != null)
             {
                 searchEntry.Text = "@" + filter;
             }
         }
     }
     ResetIdleTime();
     ClearSelectedCredential(true);
     NotifyPropertyChanged("FilteredCredentials");
 }