blob: 7e84d87a2fc3db59706e43ca3a46fc5aa0f154e5 [file] [log] [blame]
Nicolas Jagerb059a662016-08-30 13:17:30 -04001#pragma once
2/**************************************************************************
3* Copyright (C) 2016 by Savoir-faire Linux *
4* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
5* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
6* *
7* This program is free software; you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation; either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* This program is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with this program. If not, see <http://www.gnu.org/licenses/>. *
19**************************************************************************/
20using namespace Platform;
21using namespace Windows::Data::Json;
Nicolas Jager0788e962016-08-26 15:41:06 -040022using namespace Windows::UI::Xaml;
Nicolas Jagerb059a662016-08-30 13:17:30 -040023using namespace Windows::UI::Xaml::Data;
24
25/* strings required by Windows::Data::Json. Defined here on puprose */
26String^ nameKey = "name";
27String^ ringIDKey = "ringid";
28String^ contactKey = "contact";
29String^ contactListKey = "contactlist";
30
31namespace RingClientUWP
32{
33ref class Conversation;
34public ref class Contact sealed : public INotifyPropertyChanged
35{
36public:
37 Contact(String^ name, String^ ringID);
38 JsonObject^ ToJsonObject();
39
Nicolas Jagerb059a662016-08-30 13:17:30 -040040 virtual event PropertyChangedEventHandler^ PropertyChanged;
41
42 property String^ name_;
43 property String^ ringID_;
44 property Conversation^ _conversation
45 {
46 Conversation^ get()
47 {
48 return conversation_;
49 }
50 }
Nicolas Jager0788e962016-08-26 15:41:06 -040051 property Visibility notificationNewMessage
52 {
53 Visibility get()
54 {
55 return notificationNewMessage_;
56 }
57 void set(Visibility visibility)
58 {
59 notificationNewMessage_ = visibility;
60 PropertyChanged(this, ref new PropertyChangedEventArgs("notificationNewMessage"));
61 }
62 }
63 property String^ unreadMessages
64 {
65 String^ get()
66 {
67 return unreadMessages_.ToString();
68 }
69 }
Nicolas Jagerb059a662016-08-30 13:17:30 -040070
71protected:
72 void NotifyPropertyChanged(String^ propertyName);
73
74private:
75 Conversation^ conversation_;
Nicolas Jager0788e962016-08-26 15:41:06 -040076 Visibility notificationNewMessage_;
77 unsigned int unreadMessages_;
Nicolas Jagerb059a662016-08-30 13:17:30 -040078
79};
80}
81