ContactListModel.h 2.81 KB
Newer Older
atraczyk's avatar
atraczyk committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/***************************************************************************
 * Copyright (C) 2016 by Savoir-faire Linux                                *
 * Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com>              *
 * Author: Traczyk Andreas <andreas.traczyk@savoirfairelinux.com>          *
 *                                                                         *
 * This program is free software; you can redistribute it and/or modify    *
 * it under the terms of the GNU General Public License as published by    *
 * the Free Software Foundation; either version 3 of the License, or       *
 * (at your option) any later version.                                     *
 *                                                                         *
 * This program is distributed in the hope that it will be useful,         *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
 * GNU General Public License for more details.                            *
 *                                                                         *
 * You should have received a copy of the GNU General Public License       *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 **************************************************************************/
#pragma once

using namespace Platform::Collections;
using namespace Concurrency;

namespace RingClientUWP
{
26 27
namespace ViewModel
{
atraczyk's avatar
atraczyk committed
28

29
public ref class ContactListModel sealed
atraczyk's avatar
atraczyk committed
30
{
31 32
public:
    ContactListModel(String^ m_Owner);
atraczyk's avatar
atraczyk committed
33

34
internal:
atraczyk's avatar
atraczyk committed
35 36
    /* functions */
    Contact^    findContactByName(String^ name);
37
    Contact^    findContactByRingId(String^ ringId);
38 39 40 41 42
    Contact^    addNewContact(  String^ name,
                                String^ ringId,
                                TrustStatus trustStatus,
                                bool isIncognitoContact,
                                ContactStatus contactStatus = ContactStatus::READY);
atraczyk's avatar
atraczyk committed
43 44 45 46
    void        saveContactsToFile();
    void        openContactsFromFile();
    String^     Stringify();
    void        Destringify(String^ data);
47
    void        deleteContact(Contact^ contact);
atraczyk's avatar
atraczyk committed
48
    void        modifyContact(Contact^ contact);
atraczyk's avatar
atraczyk committed
49 50

    /* properties */
51 52
    property IVector<Contact^>^ _contactsList {
        IVector<Contact^>^ get() {
atraczyk's avatar
atraczyk committed
53 54
            return contactsList_;
        }
55 56 57
        void set(IVector<Contact^>^ value) {
            contactsList_ = value;
        }
atraczyk's avatar
atraczyk committed
58 59 60
    }

private:
61
    IVector<Contact^>^ contactsList_;
atraczyk's avatar
atraczyk committed
62 63
    Contact^ currentItem_;
    Contact^ oldItem_;
64
    String^ m_Owner;
atraczyk's avatar
atraczyk committed
65

66
    void OnregisteredNameFound(RingClientUWP::LookupStatus status, const std::string& accountId, const std::string &address, const std::string &name);
atraczyk's avatar
atraczyk committed
67 68 69
};
}
}