private DatabaseFactory() { connection = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), APPDB_PATH); /* var sync = new SQLiteConnection(APPDB_PATH); * connection = new SQLiteConnection(APPDB_PATH);*/ identityDatabase = new IdentityDatabase(connection); threadDatabase = new ThreadDatabase(connection); groupDatabase = new GroupDatabase(connection); messageDatabase = new MessageDatabase(connection); textMessageDatabase = new TextMessageDatabase(connection); //contactDatabase = new ContactsDatabase(connection); //addressDatabase = new CanonicalAddressDatabase(connection); directoryDatabase = new TextSecureDirectory(connection); pushDatabase = new PushDatabase(connection); recipientDatabase = new RecipientDatabase(connection); }
private DatabaseFactory() { connection = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), APPDB_PATH); /* var sync = new SQLiteConnection(APPDB_PATH); connection = new SQLiteConnection(APPDB_PATH);*/ identityDatabase = new IdentityDatabase(connection); threadDatabase = new ThreadDatabase(connection); groupDatabase = new GroupDatabase(connection); messageDatabase = new MessageDatabase(connection); textMessageDatabase = new TextMessageDatabase(connection); //contactDatabase = new ContactsDatabase(connection); //addressDatabase = new CanonicalAddressDatabase(connection); directoryDatabase = new TextSecureDirectory(connection); pushDatabase = new PushDatabase(connection); recipientDatabase = new RecipientDatabase(connection); }
public Recipient GetOrCreateRecipient(TextSecureDirectory.Directory d) { var query = conn.Table<Recipient>().Where(r => r.Number == d.Number); if (query.Count() != 0) return query.First(); var recipient = new Recipient() { RecipientId = 0, Number = d.Number, ContactId = d.ContactId, Name = d.Name }; conn.Insert(recipient); return recipient; }
public Recipients GetOrCreateRecipients(TextSecureDirectory.Directory d) { var recipients = new List<Recipient>(); /*foreach (var recipientId in recipientIds) { }*/ recipients.Add(GetOrCreateRecipient(d)); return RecipientFactory.getRecipientsFor(recipients, false); }
private void OpenChat(TextSecureDirectory.Directory contacts) { Recipients recipients = DatabaseFactory.getRecipientDatabase().GetOrCreateRecipients(SelectedContact); //RecipientFactory.getRecipientsFromContact(SelectedContact); var chatid = DatabaseFactory.getThreadDatabase().GetThreadIdForRecipients(recipients, 0); var chat = DatabaseFactory.getThreadDatabase().Get(chatid); OpenChat(chat); }