blob: b6ee05fa8602026ebe4652e8e359f4fc57e3d02f [file] [log] [blame]
atraczykb724d332016-08-30 15:25:59 -04001/***************************************************************************
2 * Copyright (C) 2016 by Savoir-faire Linux *
3 * Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
4 * Author: Traczyk Andreas <andreas.traczyk@savoirfairelinux.com> *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 **************************************************************************/
19
20#pragma once
21
22using namespace Platform::Collections;
23using namespace Concurrency;
24
25namespace RingClientUWP
26{
27
Nicolas Jager0788e962016-08-26 15:41:06 -040028/* delegates */
Nicolas Jager7c409f32016-09-08 09:35:16 -040029delegate void ContactAdded(Contact^);
atraczykb724d332016-08-30 15:25:59 -040030
31namespace ViewModel {
32public ref class ContactsViewModel sealed
33{
34internal:
35 /* singleton */
36 static property ContactsViewModel^ instance
37 {
38 ContactsViewModel^ get()
39 {
40 static ContactsViewModel^ instance_ = ref new ContactsViewModel();
41 return instance_;
42 }
43 }
44
45 /* functions */
46 Contact^ findContactByName(String^ name);
47 Contact^ addNewContact(String^ name, String^ ringId);
48 void saveContactsToFile();
49 void openContactsFromFile();
50 String^ Stringify();
51 void Destringify(String^ data);
52
53 /* properties */
atraczykb724d332016-08-30 15:25:59 -040054 property Vector<Contact^>^ contactsList
55 {
56 Vector<Contact^>^ get()
57 {
58 return contactsList_;
59 }
60 }
61
62 /* events */
Nicolas Jager7c409f32016-09-08 09:35:16 -040063 event ContactAdded^ contactAdded;
atraczykb724d332016-08-30 15:25:59 -040064
65private:
66 ContactsViewModel(); // singleton
67 Vector<Contact^>^ contactsList_;
68 Contact^ currentItem_;
69 Contact^ oldItem_;
70
Nicolas Jagerd57809f2016-10-06 11:31:55 -040071 void OnincomingMessage(Platform::String ^callId, Platform::String ^payload);
atraczykb724d332016-08-30 15:25:59 -040072};
73}
74}