Commit 93abfeaf authored by Nicolas Jager's avatar Nicolas Jager

text message : print message on message text page

Change-Id: I49fae020f196ffa5450d414bcce5ded0c1d0c092
Tuleap: #971
parent 0788e96d
......@@ -50,7 +50,7 @@ ContactsViewModel::ContactsViewModel()
return;
}
screenConversationMessage("" /* accountId not used yet at this stage */, from, payload);
contact->_conversation->addMessage(""/* date not yet used*/, MSG_FROM_CONTACT, payload);
if (contact->ringID_ == from && isNotSelected)
notifyNewConversationMessage();
......
......@@ -28,6 +28,7 @@ using namespace RingClientUWP;
Conversation::Conversation()
{
messagesList_ = ref new Vector<ConversationMessage^>();
}
void
......@@ -40,4 +41,9 @@ Conversation::addMessage(String^ date, bool fromContact, String^ payload)
std::string owner((fromContact) ? "from contact" : " from me");
MSG_("{Conversation::addMessage}");
MSG_("owner = " + owner);
/* add message to _messagesList_ */
messagesList_->Append(message);
// TODO store message on the disk
}
......@@ -36,11 +36,23 @@ private:
public:
/* functions */
Conversation();
void addMessage(String^ date, bool fromContact, String^ payload);
internal:
/* properties */
property Vector<ConversationMessage^>^ _messages
{
Vector<ConversationMessage^>^ get()
{
return messagesList_;
}
}
private:
Vector<ConversationMessage^> messages;
/* members */
Vector<ConversationMessage^>^ messagesList_;
};
#define MSG_FROM_CONTACT true
......
......@@ -9,20 +9,11 @@
mc:Ignorable="d">
<Page.Resources>
<!--<DataTemplate x:Key="MessageTemplate" x:DataType="local:RingInstantMessage">
<DataTemplate x:Key="ConversationMessageTemplate" x:DataType="local:ConversationMessage">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image x:Name="_contactAvatar_"
Margin="2,2"
Source="ms-appx:///contact-avatar-test.png"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock x:Name="_msgContent_" Text="{x:Bind msg_}"/>
<TextBlock x:Name="_msgContent_" Text="{x:Bind Payload}"/>
</Grid>
</DataTemplate>-->
</DataTemplate>
<!-- barre d'envoi de message -->
<Style TargetType="TextBox">
......@@ -121,7 +112,10 @@
Grid.Row="1">
<StackPanel x:Name="_messagesWindowOutput_"
Background="#FFF2F2F2">
<ListBox x:Name="_messagesList_"
Margin="0"
Padding="0"
ItemTemplate="{StaticResource ConversationMessageTemplate}"/>
</StackPanel>
</ScrollViewer>
<Grid Height="50"
......
......@@ -40,6 +40,12 @@ using namespace Windows::UI::Xaml::Navigation;
MessageTextPage::MessageTextPage()
{
InitializeComponent();
/* connect delegates. */ // may be useless
RingD::instance->incomingAccountMessage += ref new IncomingAccountMessage([&](String^ accountId,
String^ from, String^ payload) {
});
}
void
......@@ -57,7 +63,8 @@ RingClientUWP::Views::MessageTextPage::updatePageContent()
_title_->Text = contact->name_;
_messagesWindowOutput_->Children->Clear();
_messagesList_->ItemsSource = contact->_conversation->_messages;
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment