Пример #1
0
 /// <summary>
 /// Initializes a new instance of the AddViewModel class.
 /// </summary>
 public AddViewModel()
 {
     Messenger.Default.Register<NotificationMessageAction<PasswordItem>>(this, "add", m =>
     {
         _addItem = m;
         if (m.Sender == null) return;
         _item = (PasswordItem)m.Sender;
     });
 }
 private void GetPassword(string where = null, params SQLiteParameter[] parameters)
 {
     Task.Factory.StartNew(() =>
     {
         DatabaseHelper.Open();
         var reader = DatabaseHelper.Select<PasswordItem>("*", $"{where} GROUP BY Url ORDER BY Url", parameters);
         while (reader.Read())
         {
             if (reader.HasRows)
             {
                 var item = new PasswordItem(reader);
                 Application.Current.Dispatcher.Invoke(() => { PasswordList.Add(item); });
             }
         }
         reader.Close();
         DatabaseHelper.Close();
     });
 }